diff options
author | Shuzhen Wang <shuzhenwang@google.com> | 2020-05-21 21:30:15 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-05-21 21:30:15 +0000 |
commit | 94daee85eee1226db428846d29f7c8d9a0f8bc2e (patch) | |
tree | 7744a4fae5977175c7516fff55f6a59c00100512 | |
parent | dc00670814d19d9fd8e7d2b7bb767ed5578ade51 (diff) | |
parent | 6777bc3ddce6e0560ed8c5634009e6bae660402f (diff) | |
download | camera-94daee85eee1226db428846d29f7c8d9a0f8bc2e.tar.gz |
QCamera2: HAL3: Fix ERROR_REQUEST/ERROR_BUFFER bugs am: 6777bc3ddcandroid-mainline-12.0.0_r112android-mainline-11.0.0_r44android-mainline-11.0.0_r43android-mainline-11.0.0_r42android-mainline-11.0.0_r41android-mainline-11.0.0_r40android-mainline-11.0.0_r39android-mainline-11.0.0_r38android-mainline-11.0.0_r37android-mainline-11.0.0_r36android-mainline-11.0.0_r35android-mainline-11.0.0_r34android-mainline-11.0.0_r32android-mainline-11.0.0_r31android-mainline-11.0.0_r30android-mainline-11.0.0_r28android-mainline-11.0.0_r27android-mainline-11.0.0_r26android-mainline-11.0.0_r25android-mainline-11.0.0_r24android-mainline-11.0.0_r23android-mainline-11.0.0_r22android-mainline-11.0.0_r21android-mainline-11.0.0_r20android-mainline-11.0.0_r18android-mainline-11.0.0_r17android-mainline-11.0.0_r16android-mainline-11.0.0_r15android-mainline-11.0.0_r14android-mainline-11.0.0_r13android-mainline-11.0.0_r12aml_tz2_305400500aml_tz2_305400300aml_tz2_305400100aml_tz2_304500300aml_tz2_303900110aml_tz2_303900102aml_tz2_303800002aml_tz2_303800001aml_tz2_303200001android12-mainline-tzdata2-releaseandroid11-mainline-tethering-releaseandroid11-mainline-permission-releaseandroid11-mainline-os-statsd-releaseandroid11-mainline-networkstack-releaseandroid11-mainline-media-swcodec-releaseandroid11-mainline-media-releaseandroid11-mainline-extservices-releaseandroid11-mainline-documentsui-releaseandroid11-mainline-conscrypt-releaseandroid11-mainline-cellbroadcast-releaseandroid11-mainline-captiveportallogin-releaseaml_tz2_305400100
Change-Id: I9c3e4d75d81fd2382bf9da695295440ed86a8e21
-rw-r--r-- | msm8998/QCamera2/HAL3/QCamera3HWI.cpp | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/msm8998/QCamera2/HAL3/QCamera3HWI.cpp b/msm8998/QCamera2/HAL3/QCamera3HWI.cpp index fad216a..2b14f84 100644 --- a/msm8998/QCamera2/HAL3/QCamera3HWI.cpp +++ b/msm8998/QCamera2/HAL3/QCamera3HWI.cpp @@ -4592,6 +4592,15 @@ void QCamera3HardwareInterface::handleBufferWithLock( LOGH("result frame_number = %d, buffer = %p", frame_number, buffer->buffer); + if (buffer->status == CAMERA3_BUFFER_STATUS_ERROR) { + camera3_notify_msg_t notify_msg = {}; + notify_msg.type = CAMERA3_MSG_ERROR; + notify_msg.message.error.frame_number = frame_number; + notify_msg.message.error.error_code = CAMERA3_MSG_ERROR_BUFFER ; + notify_msg.message.error.error_stream = buffer->stream; + orchestrateNotify(¬ify_msg); + } + mPendingBuffersMap.removeBuf(buffer->buffer); mOutputBufferDispatcher.markBufferReady(frame_number, *buffer); @@ -15216,8 +15225,11 @@ int32_t QCamera3HardwareInterface::notifyErrorForPendingRequests() pendingBuffer = mPendingBuffersMap.mPendingBuffersInRequest.erase(pendingBuffer); } else if (pendingBuffer == mPendingBuffersMap.mPendingBuffersInRequest.end() || ((pendingRequest != mPendingRequestsList.end()) && - (pendingBuffer->frame_number > pendingRequest->frame_number))) { - // If the buffers for this frame were sent already, notify about a result error. + (pendingBuffer->frame_number > pendingRequest->frame_number || + (pendingBuffer->frame_number == pendingRequest->frame_number && + pendingBuffer->mPendingBufferList.size() < pendingRequest->num_buffers)))) { + // If some or all buffers for this frame were sent already, notify about a result error, + // as well as remaining buffer errors. camera3_notify_msg_t notify_msg; memset(¬ify_msg, 0, sizeof(camera3_notify_msg_t)); notify_msg.type = CAMERA3_MSG_ERROR; @@ -15234,20 +15246,41 @@ int32_t QCamera3HardwareInterface::notifyErrorForPendingRequests() orchestrateResult(&result); } + if (pendingBuffer != mPendingBuffersMap.mPendingBuffersInRequest.end() && + pendingBuffer->frame_number == pendingRequest->frame_number) { + for (const auto &info : pendingBuffer->mPendingBufferList) { + // Send a buffer error for this frame number. + camera3_notify_msg_t notify_msg; + memset(¬ify_msg, 0, sizeof(camera3_notify_msg_t)); + notify_msg.type = CAMERA3_MSG_ERROR; + notify_msg.message.error.error_code = CAMERA3_MSG_ERROR_BUFFER; + notify_msg.message.error.error_stream = info.stream; + notify_msg.message.error.frame_number = pendingBuffer->frame_number; + orchestrateNotify(¬ify_msg); + + camera3_stream_buffer_t buffer = {}; + buffer.acquire_fence = -1; + buffer.release_fence = -1; + buffer.buffer = info.buffer; + buffer.status = CAMERA3_BUFFER_STATUS_ERROR; + buffer.stream = info.stream; + mOutputBufferDispatcher.markBufferReady(pendingBuffer->frame_number, buffer); + } + pendingBuffer = mPendingBuffersMap.mPendingBuffersInRequest.erase(pendingBuffer); + } mShutterDispatcher.clear(pendingRequest->frame_number); pendingRequest = mPendingRequestsList.erase(pendingRequest); } else { // If both buffers and result metadata weren't sent yet, notify about a request error // and return buffers with error. - for (auto &info : pendingBuffer->mPendingBufferList) { - camera3_notify_msg_t notify_msg; - memset(¬ify_msg, 0, sizeof(camera3_notify_msg_t)); - notify_msg.type = CAMERA3_MSG_ERROR; - notify_msg.message.error.error_code = CAMERA3_MSG_ERROR_REQUEST; - notify_msg.message.error.error_stream = info.stream; - notify_msg.message.error.frame_number = pendingBuffer->frame_number; - orchestrateNotify(¬ify_msg); + camera3_notify_msg_t notify_msg; + memset(¬ify_msg, 0, sizeof(camera3_notify_msg_t)); + notify_msg.type = CAMERA3_MSG_ERROR; + notify_msg.message.error.error_code = CAMERA3_MSG_ERROR_REQUEST; + notify_msg.message.error.frame_number = pendingBuffer->frame_number; + orchestrateNotify(¬ify_msg); + for (auto &info : pendingBuffer->mPendingBufferList) { camera3_stream_buffer_t buffer = {}; buffer.acquire_fence = -1; buffer.release_fence = -1; |