Camera VTS: Fix processColorSpaceRequests.

Changes were made to process10BitDynamicRangeRequest and the way frames
are numbered. This needs to be carried over to
processColorSpaceRequests.

Bug: 275007341
Test: Ran process10BitColorSpaceRequest / process8BitColorSpaceRequest
Change-Id: Ia0eb2fd71aff1bfc8398c85c68e1b9575a1cc058
This commit is contained in:
Austin Borger 2023-03-24 18:28:12 -07:00
parent 8712639df1
commit 5e80374926

View file

@ -3337,7 +3337,6 @@ void CameraAidlTest::processColorSpaceRequest(
RequestAvailableColorSpaceProfilesMap colorSpace, RequestAvailableColorSpaceProfilesMap colorSpace,
RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile) { RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile) {
std::vector<std::string> cameraDeviceNames = getCameraDeviceNames(mProvider); std::vector<std::string> cameraDeviceNames = getCameraDeviceNames(mProvider);
int64_t bufferId = 1;
CameraMetadata settings; CameraMetadata settings;
for (const auto& name : cameraDeviceNames) { for (const auto& name : cameraDeviceNames) {
@ -3456,12 +3455,12 @@ void CameraAidlTest::processColorSpaceRequest(
// Stream as long as needed to fill the Hal inflight queue // Stream as long as needed to fill the Hal inflight queue
std::vector<CaptureRequest> requests(halStreams[0].maxBuffers); 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>( std::shared_ptr<InFlightRequest> inflightReq = std::make_shared<InFlightRequest>(
static_cast<ssize_t>(halStreams.size()), false, supportsPartialResults, static_cast<ssize_t>(halStreams.size()), false, supportsPartialResults,
partialResultCount, std::unordered_set<std::string>(), resultQueue); partialResultCount, std::unordered_set<std::string>(), resultQueue);
CaptureRequest& request = requests[frameNumber]; CaptureRequest& request = requests[requestId];
std::vector<StreamBuffer>& outputBuffers = request.outputBuffers; std::vector<StreamBuffer>& outputBuffers = request.outputBuffers;
outputBuffers.resize(halStreams.size()); outputBuffers.resize(halStreams.size());
@ -3470,6 +3469,7 @@ void CameraAidlTest::processColorSpaceRequest(
std::vector<buffer_handle_t> graphicBuffers; std::vector<buffer_handle_t> graphicBuffers;
graphicBuffers.reserve(halStreams.size()); graphicBuffers.reserve(halStreams.size());
auto bufferId = requestId + 1; // Buffer id value 0 is not valid
for (const auto& halStream : halStreams) { for (const auto& halStream : halStreams) {
buffer_handle_t buffer_handle; buffer_handle_t buffer_handle;
if (useHalBufManager) { if (useHalBufManager) {
@ -3485,17 +3485,16 @@ void CameraAidlTest::processColorSpaceRequest(
inflightReq->mOutstandingBufferIds[halStream.id][bufferId] = buffer_handle; inflightReq->mOutstandingBufferIds[halStream.id][bufferId] = buffer_handle;
graphicBuffers.push_back(buffer_handle); graphicBuffers.push_back(buffer_handle);
outputBuffers[k] = {halStream.id, bufferId, outputBuffers[k] = {
android::makeToAidl(buffer_handle), BufferStatus::OK, NativeHandle(), halStream.id, bufferId, android::makeToAidl(buffer_handle),
NativeHandle()}; BufferStatus::OK, NativeHandle(), NativeHandle()};
bufferId++;
} }
k++; k++;
} }
request.inputBuffer = { request.inputBuffer = {
-1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()}; -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()};
request.frameNumber = frameNumber; request.frameNumber = bufferId;
request.fmqSettingsSize = 0; request.fmqSettingsSize = 0;
request.settings = settings; request.settings = settings;
request.inputWidth = 0; request.inputWidth = 0;
@ -3503,9 +3502,8 @@ void CameraAidlTest::processColorSpaceRequest(
{ {
std::unique_lock<std::mutex> l(mLock); std::unique_lock<std::mutex> l(mLock);
mInflightMap[frameNumber] = inflightReq; mInflightMap[bufferId] = inflightReq;
} }
} }
int32_t numRequestProcessed = 0; int32_t numRequestProcessed = 0;
@ -3519,7 +3517,10 @@ void CameraAidlTest::processColorSpaceRequest(
std::vector<int32_t> {halStreams[0].id}); std::vector<int32_t> {halStreams[0].id});
ASSERT_TRUE(returnStatus.isOk()); 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]; const auto& inflightReq = mInflightMap[frameNumber];
std::unique_lock<std::mutex> l(mLock); std::unique_lock<std::mutex> l(mLock);
while (!inflightReq->errorCodeValid && while (!inflightReq->errorCodeValid &&