diff options
author | Mike J. Chen <mjchen@sta.samsung.com> | 2010-11-03 10:19:37 -0700 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-01-19 18:27:02 -0800 |
commit | 050e57e0f0738fa9c7312de75c6223572ba5d529 (patch) | |
tree | d7a6d5cfa7e6c55970070dcecd2a9029c476158a /libcamera/SecCameraHWInterface.h | |
parent | 0bd85d7b37790a2486319001d5bdd2e86a866c4f (diff) | |
download | device_samsung_crespo-050e57e0f0738fa9c7312de75c6223572ba5d529.zip device_samsung_crespo-050e57e0f0738fa9c7312de75c6223572ba5d529.tar.gz device_samsung_crespo-050e57e0f0738fa9c7312de75c6223572ba5d529.tar.bz2 |
S5PC11X: libcamera: buffer cleanup
Cleanup how buffers are managed. Before, buffers for preview
and capture and record were mixed together, with one thread
cleaning up buffers for another. Now, each mode cleans up
its own buffers. Implement asychronous buffer release for record
case to fix a bug where we allowed FIMC to update a buffer that
was still in use by encoder, resulting in encoding a frame that
was part one image and part another.
Change-Id: I42d0032cea61197a1f3a665a7248b700599d5a6a
Signed-off-by: Mike J. Chen <mjchen@sta.samsung.com>
Diffstat (limited to 'libcamera/SecCameraHWInterface.h')
-rw-r--r-- | libcamera/SecCameraHWInterface.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/libcamera/SecCameraHWInterface.h b/libcamera/SecCameraHWInterface.h index f416d9f..724d1bc 100644 --- a/libcamera/SecCameraHWInterface.h +++ b/libcamera/SecCameraHWInterface.h @@ -82,13 +82,12 @@ private: PreviewThread(CameraHardwareSec *hw): Thread(false), mHardware(hw) { } + virtual void onFirstRef() { + run("CameraPreviewThread", PRIORITY_URGENT_DISPLAY); + } virtual bool threadLoop() { - int ret = mHardware->previewThread(); - // loop until we need to quit - if(ret == NO_ERROR) - return true; - else - return false; + mHardware->previewThreadWrapper(); + return false; } }; @@ -100,6 +99,7 @@ private: mHardware(hw) { } virtual bool threadLoop() { mHardware->pictureThread(); + mHardware->mSecCamera->endSnapshot(); return false; } }; @@ -122,7 +122,7 @@ private: sp<PreviewThread> mPreviewThread; int previewThread(); - bool mPreviewRunning; + int previewThreadWrapper(); sp<AutoFocusThread> mAutoFocusThread; int autoFocusThread(); @@ -158,9 +158,16 @@ private: void setSkipFrame(int frame); /* used by auto focus thread to block until it's told to run */ mutable Mutex mFocusLock; - mutable Condition mCondition; + mutable Condition mFocusCondition; bool mExitAutoFocusThread; + /* used by preview thread to block until it's told to run */ + mutable Mutex mPreviewLock; + mutable Condition mPreviewCondition; + mutable Condition mPreviewStoppedCondition; + bool mPreviewRunning; + bool mExitPreviewThread; + /* used to guard threading state */ mutable Mutex mStateLock; |