From 492a2506b49ab9dfd574ab354ef6edcfd7ba6a68 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Wed, 19 Nov 2014 08:38:54 -0800 Subject: manta: libcamera2: drain requests on empty request queue Bug: 18118823 Bug: 17771002 Bug: 17660746 Bug: 13921808 Bug: 13358648 Bug: 13299991 Change-Id: Ib81b7d8b76470eebcd434a20b46d6235f5381f8b --- libcamera2/ExynosCameraHWInterface2.cpp | 21 +++++++++++++++------ libcamera2/ExynosCameraHWInterface2.h | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'libcamera2') diff --git a/libcamera2/ExynosCameraHWInterface2.cpp b/libcamera2/ExynosCameraHWInterface2.cpp index 8fce907..cab01b4 100644 --- a/libcamera2/ExynosCameraHWInterface2.cpp +++ b/libcamera2/ExynosCameraHWInterface2.cpp @@ -615,10 +615,15 @@ void RequestManager::ApplyDynamicMetadata(struct camera2_shot_ext *shot_ext) ALOGV("DEBUG(%s): frameCnt(%d)", __FUNCTION__, shot_ext->shot.ctl.request.frameCount); for (i = 0 ; i < NUM_MAX_REQUEST_MGR_ENTRY ; i++) { - if((entries[i].internal_shot.shot.ctl.request.frameCount == shot_ext->shot.ctl.request.frameCount) - && (entries[i].status == CAPTURED)){ - entries[i].status = METADONE; - break; + if (entries[i].internal_shot.shot.ctl.request.frameCount + == shot_ext->shot.ctl.request.frameCount) { + if (entries[i].status == CAPTURED) { + entries[i].status = METADONE; + break; + } + if (entries[i].status == METADONE) { + return; + } } } @@ -861,9 +866,10 @@ camera2_shot_ext * RequestManager::GetInternalShotExt(int index) return ¤tEntry->internal_shot; } -int RequestManager::FindFrameCnt(struct camera2_shot_ext * shot_ext) +int RequestManager::FindFrameCnt(struct camera2_shot_ext * shot_ext, bool drain) { Mutex::Autolock lock(m_requestMutex); + Mutex::Autolock lock2(m_numOfEntriesLock); int i; if (m_numOfEntries == 0) { @@ -879,6 +885,9 @@ int RequestManager::FindFrameCnt(struct camera2_shot_ext * shot_ext) entries[i].status = CAPTURED; return entries[i].internal_shot.shot.ctl.request.frameCount; } + if (drain && (entries[i].status >= CAPTURED)) { + return entries[i].internal_shot.shot.ctl.request.frameCount; + } CAM_LOGE("ERR(%s): frameCount(%d), index(%d), status(%d)", __FUNCTION__, shot_ext->shot.ctl.request.frameCount, i, entries[i].status); } @@ -3154,7 +3163,7 @@ void ExynosCameraHWInterface2::m_sensorThreadFunc(SignalDrivenThread * self) matchedFrameCnt = m_ctlInfo.flash.m_flashFrameCount; ALOGV("Skip frame, request is fixed at %d", matchedFrameCnt); } else { - matchedFrameCnt = m_requestManager->FindFrameCnt(shot_ext); + matchedFrameCnt = m_requestManager->FindFrameCnt(shot_ext, m_isRequestQueueNull); } if (matchedFrameCnt == -1 && m_vdisBubbleCnt > 0) { diff --git a/libcamera2/ExynosCameraHWInterface2.h b/libcamera2/ExynosCameraHWInterface2.h index a8e3348..927eace 100644 --- a/libcamera2/ExynosCameraHWInterface2.h +++ b/libcamera2/ExynosCameraHWInterface2.h @@ -283,7 +283,7 @@ public: uint8_t GetOutputStream(int index); camera2_shot_ext * GetInternalShotExtByFrameCnt(int frameCnt); camera2_shot_ext * GetInternalShotExt(int index); - int FindFrameCnt(struct camera2_shot_ext * shot_ext); + int FindFrameCnt(struct camera2_shot_ext * shot_ext, bool drain); bool IsVdisEnable(void); int FindEntryIndexByFrameCnt(int frameCnt); void Dump(void); -- cgit v1.2.3