diff options
author | Tyler Luu <tluu@ti.com> | 2012-06-21 09:55:44 -0500 |
---|---|---|
committer | Daniel Levin <dendy@ti.com> | 2012-11-26 20:09:16 +0200 |
commit | 7eeb4f61f989b3aa0da6f77a579d6e4de1b5e885 (patch) | |
tree | 1082816d04a28286bbc6a362fe1d8f14c763186a | |
parent | 7f483836fab38c86abd3fd9ee5d996ac99379674 (diff) | |
download | hardware_ti_omap4-7eeb4f61f989b3aa0da6f77a579d6e4de1b5e885.zip hardware_ti_omap4-7eeb4f61f989b3aa0da6f77a579d6e4de1b5e885.tar.gz hardware_ti_omap4-7eeb4f61f989b3aa0da6f77a579d6e4de1b5e885.tar.bz2 |
CameraHal: Init capture reference count logic to derived adapters
- Moving initializing for capture reference count to
derived adapters since useBuffers call for capture
is going to called queuing shots as well.
- This patch needs to include V4L adapter before merging
on mainline.
Change-Id: Ifc4986a68173234ec636ef943b62009f7df1e041
Signed-off-by: Tyler Luu <tluu@ti.com>
Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>
-rw-r--r-- | camera/BaseCameraAdapter.cpp | 11 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXCapture.cpp | 11 | ||||
-rwxr-xr-x | camera/V4LCameraAdapter/V4LCameraAdapter.cpp | 11 |
3 files changed, 22 insertions, 11 deletions
diff --git a/camera/BaseCameraAdapter.cpp b/camera/BaseCameraAdapter.cpp index d40ef61..5301c6d 100644 --- a/camera/BaseCameraAdapter.cpp +++ b/camera/BaseCameraAdapter.cpp @@ -541,17 +541,6 @@ status_t BaseCameraAdapter::sendCommand(CameraCommands operation, int value1, in android::AutoMutex lock(mCaptureBufferLock); mCaptureBuffers = desc->mBuffers; mCaptureBuffersLength = desc->mLength; - mCaptureBuffersAvailable.clear(); - for ( uint32_t i = 0 ; i < desc->mMaxQueueable ; i++ ) - { - mCaptureBuffersAvailable.add(&mCaptureBuffers[i], 0); - } - // initial ref count for undeqeueued buffers is 1 since buffer provider - // is still holding on to it - for ( uint32_t i = desc->mMaxQueueable ; i < desc->mCount ; i++ ) - { - mCaptureBuffersAvailable.add(&mCaptureBuffers[i], 1); - } } if ( NULL != desc ) diff --git a/camera/OMXCameraAdapter/OMXCapture.cpp b/camera/OMXCameraAdapter/OMXCapture.cpp index e5de0c5..5231960 100644 --- a/camera/OMXCameraAdapter/OMXCapture.cpp +++ b/camera/OMXCameraAdapter/OMXCapture.cpp @@ -1877,6 +1877,17 @@ status_t OMXCameraAdapter::UseBuffersCapture(CameraBuffer * bufArr, int num) // CPCam mode only supports vector shot // Regular capture is not supported if (mCapMode == CP_CAM) initVectorShot(); + + mCaptureBuffersAvailable.clear(); + for (unsigned int i = 0; i < imgCaptureData->mMaxQueueable; i++ ) { + mCaptureBuffersAvailable.add(&mCaptureBuffers[i], 0); + } + + // initial ref count for undeqeueued buffers is 1 since buffer provider + // is still holding on to it + for (unsigned int i = imgCaptureData->mMaxQueueable; i < imgCaptureData->mNumBufs; i++ ) { + mCaptureBuffersAvailable.add(&mCaptureBuffers[i], 1); + } } if ( NO_ERROR == ret ) diff --git a/camera/V4LCameraAdapter/V4LCameraAdapter.cpp b/camera/V4LCameraAdapter/V4LCameraAdapter.cpp index d87a72a..799221d 100755 --- a/camera/V4LCameraAdapter/V4LCameraAdapter.cpp +++ b/camera/V4LCameraAdapter/V4LCameraAdapter.cpp @@ -506,6 +506,17 @@ status_t V4LCameraAdapter::UseBuffersCapture(CameraBuffer *bufArr, int num) { CAMHAL_LOGDB("capture- buff [%d] = 0x%x ",i, mCaptureBufs.keyAt(i)); } + mCaptureBuffersAvailable.clear(); + for (int i = 0; i < mCaptureBufferCountQueueable; i++ ) { + mCaptureBuffersAvailable.add(&mCaptureBuffers[i], 0); + } + + // initial ref count for undeqeueued buffers is 1 since buffer provider + // is still holding on to it + for (int i = mCaptureBufferCountQueueable; i < num; i++ ) { + mCaptureBuffersAvailable.add(&mCaptureBuffers[i], 1); + } + // Update the preview buffer count mCaptureBufferCount = num; EXIT: |