Merge "Camera VTS: Keep buffer ids and frame numbers consistent" into android13-tests-dev am: ceeef2d2bf am: d1798b790d am: a9f5ace3b6

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2393593

Change-Id: Iacb7cde297b338e105da36daa0d72a2baa5c76b3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-01-26 02:37:40 +00:00 committed by Automerger Merge Worker
commit 0e7ece2b4e
2 changed files with 12 additions and 9 deletions

View file

@ -1847,7 +1847,6 @@ TEST_P(CameraAidlTest, processUltraHighResolutionRequest) {
// Generate and verify 10-bit dynamic range request
TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) {
std::vector<std::string> cameraDeviceNames = getCameraDeviceNames(mProvider);
int64_t bufferId = 1;
CameraMetadata settings;
for (const auto& name : cameraDeviceNames) {
@ -1928,12 +1927,12 @@ TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) {
// Stream as long as needed to fill the Hal inflight queue
std::vector<CaptureRequest> requests(halStreams[0].maxBuffers);
for (int32_t frameNumber = 0; frameNumber < requests.size(); frameNumber++) {
for (int32_t requestId = 0; requestId < requests.size(); requestId++) {
std::shared_ptr<InFlightRequest> inflightReq = std::make_shared<InFlightRequest>(
static_cast<ssize_t>(halStreams.size()), false, supportsPartialResults,
partialResultCount, std::unordered_set<std::string>(), resultQueue);
CaptureRequest& request = requests[frameNumber];
CaptureRequest& request = requests[requestId];
std::vector<StreamBuffer>& outputBuffers = request.outputBuffers;
outputBuffers.resize(halStreams.size());
@ -1942,6 +1941,7 @@ TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) {
std::vector<buffer_handle_t> graphicBuffers;
graphicBuffers.reserve(halStreams.size());
auto bufferId = requestId + 1; // Buffer id value 0 is not valid
for (const auto& halStream : halStreams) {
buffer_handle_t buffer_handle;
if (useHalBufManager) {
@ -1960,14 +1960,13 @@ TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) {
outputBuffers[k] = {halStream.id, bufferId,
android::makeToAidl(buffer_handle), BufferStatus::OK, NativeHandle(),
NativeHandle()};
bufferId++;
}
k++;
}
request.inputBuffer = {
-1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()};
request.frameNumber = frameNumber;
request.frameNumber = bufferId;
request.fmqSettingsSize = 0;
request.settings = settings;
request.inputWidth = 0;
@ -1975,7 +1974,7 @@ TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) {
{
std::unique_lock<std::mutex> l(mLock);
mInflightMap[frameNumber] = inflightReq;
mInflightMap[bufferId] = inflightReq;
}
}
@ -1991,7 +1990,10 @@ TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) {
std::vector<int32_t> {halStreams[0].id});
ASSERT_TRUE(returnStatus.isOk());
for (int32_t frameNumber = 0; frameNumber < requests.size(); frameNumber++) {
// We are keeping frame numbers and buffer ids consistent. Buffer id value of 0
// is used to indicate a buffer that is not present/available so buffer ids as well
// as frame numbers begin with 1.
for (int32_t frameNumber = 1; frameNumber <= requests.size(); frameNumber++) {
const auto& inflightReq = mInflightMap[frameNumber];
std::unique_lock<std::mutex> l(mLock);
while (!inflightReq->errorCodeValid &&

View file

@ -429,10 +429,11 @@ bool DeviceCb::processCaptureResultLocked(
CameraAidlTest::InFlightRequest::StreamBufferAndTimestamp streamBufferAndTimestamp;
auto outstandingBuffers = mUseHalBufManager ? mOutstandingBufferIds :
request->mOutstandingBufferIds;
auto bufferId = mUseHalBufManager ? buffer.bufferId : results.frameNumber;
auto outputBuffer = outstandingBuffers.empty() ? ::android::makeFromAidl(buffer.buffer) :
outstandingBuffers[buffer.streamId][buffer.bufferId];
outstandingBuffers[buffer.streamId][bufferId];
streamBufferAndTimestamp.buffer = {buffer.streamId,
buffer.bufferId,
bufferId,
outputBuffer,
buffer.status,
::android::makeFromAidl(buffer.acquireFence),