diff options
author | Akwasi Boateng <akwasi.boateng@ti.com> | 2011-09-30 13:39:31 -0500 |
---|---|---|
committer | Iliyan Malchev <malchev@google.com> | 2011-10-07 11:12:14 -0700 |
commit | 6cd6e6f0f952d68e0301b58f7c77422448f51730 (patch) | |
tree | 4ee2531b1c0ccbd2893844ded9a9e76b4cb3021d /camera/CameraHal.cpp | |
parent | b0f698a6430c3a9478bd476af7189849a1fb1a9d (diff) | |
download | hardware_ti_omap4-6cd6e6f0f952d68e0301b58f7c77422448f51730.zip hardware_ti_omap4-6cd6e6f0f952d68e0301b58f7c77422448f51730.tar.gz hardware_ti_omap4-6cd6e6f0f952d68e0301b58f7c77422448f51730.tar.bz2 |
omap4xxx: camera: switch to executing state when surface is null
Partial fix for b/5422679
To enhance standby to first shot performance
Change-Id: Ib32e8120a7908419c76e8cf2f1830f0667b258c0
Signed-off-by: Akwasi Boateng <akwasi.boateng@ti.com>
Signed-off-by: Iliyan Malchev <malchev@google.com>
Diffstat (limited to 'camera/CameraHal.cpp')
-rw-r--r-- | camera/CameraHal.cpp | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp index 257c2a8..3ced011 100644 --- a/camera/CameraHal.cpp +++ b/camera/CameraHal.cpp @@ -1378,33 +1378,47 @@ status_t CameraHal::startPreview() unsigned int max_queueble_buffers; #if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS - gettimeofday(&mStartPreview, NULL); - #endif LOG_FUNCTION_NAME; - if ( mPreviewEnabled ) - { - CAMHAL_LOGDA("Preview already running"); - - LOG_FUNCTION_NAME_EXIT; - - return ALREADY_EXISTS; + if ( mPreviewEnabled ){ + CAMHAL_LOGDA("Preview already running"); + LOG_FUNCTION_NAME_EXIT; + return ALREADY_EXISTS; } if ( NULL != mCameraAdapter ) { + ret = mCameraAdapter->setParameters(mParameters); + } + + if ((mPreviewStartInProgress == false) && (mDisplayPaused == false)){ + ret = mCameraAdapter->sendCommand(CameraAdapter::CAMERA_QUERY_RESOLUTION_PREVIEW,( int ) &frame); + if ( NO_ERROR != ret ){ + CAMHAL_LOGEB("Error: CAMERA_QUERY_RESOLUTION_PREVIEW %d", ret); + return ret; + } + + ///Update the current preview width and height + mPreviewWidth = frame.mWidth; + mPreviewHeight = frame.mHeight; + //Update the padded width and height - required for VNF and VSTAB + mParameters.set(TICameraParameters::KEY_PADDED_WIDTH, mPreviewWidth); + mParameters.set(TICameraParameters::KEY_PADDED_HEIGHT, mPreviewHeight); - ret = mCameraAdapter->setParameters(mParameters); } ///If we don't have the preview callback enabled and display adapter, - if(!mSetPreviewWindowCalled || (mDisplayAdapter.get() == NULL)) - { - CAMHAL_LOGEA("Preview not started. Preview in progress flag set"); - mPreviewStartInProgress = true; - return NO_ERROR; + if(!mSetPreviewWindowCalled || (mDisplayAdapter.get() == NULL)){ + CAMHAL_LOGEA("Preview not started. Preview in progress flag set"); + mPreviewStartInProgress = true; + ret = mCameraAdapter->sendCommand(CameraAdapter::CAMERA_SWITCH_TO_EXECUTING); + if ( NO_ERROR != ret ){ + CAMHAL_LOGEB("Error: CAMERA_SWITCH_TO_EXECUTING %d", ret); + return ret; + } + return NO_ERROR; } if( (mDisplayAdapter.get() != NULL) && ( !mPreviewEnabled ) && ( mDisplayPaused ) ) @@ -1438,27 +1452,11 @@ status_t CameraHal::startPreview() } } - /// Ensure that buffers for preview are allocated before we start the camera - ///Get the updated size from Camera Adapter, to account for padding etc - ret = mCameraAdapter->sendCommand(CameraAdapter::CAMERA_QUERY_RESOLUTION_PREVIEW, - ( int ) &frame); - if ( NO_ERROR != ret ) - { - return ret; - } - - ///Update the current preview width and height - mPreviewWidth = frame.mWidth; - mPreviewHeight = frame.mHeight; - - //Update the padded width and height - required for VNF and VSTAB - mParameters.set(TICameraParameters::KEY_PADDED_WIDTH, mPreviewWidth); - mParameters.set(TICameraParameters::KEY_PADDED_HEIGHT, mPreviewHeight); required_buffer_count = atoi(mCameraProperties->get(CameraProperties::REQUIRED_PREVIEW_BUFS)); ///Allocate the preview buffers - ret = allocPreviewBufs(frame.mWidth, frame.mHeight, mParameters.getPreviewFormat(), required_buffer_count, max_queueble_buffers); + ret = allocPreviewBufs(mPreviewWidth, mPreviewHeight, mParameters.getPreviewFormat(), required_buffer_count, max_queueble_buffers); if ( NO_ERROR != ret ) { |