diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2013-08-14 11:37:00 -0700 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2013-08-23 14:08:27 -0700 |
commit | abaa51d3ca31f0eda99e1d271e6dc64c877dbf58 (patch) | |
tree | 52f4cc1078708f7c0099fded06dcb01daf6ca6bb /services/camera/libcameraservice/device2 | |
parent | 62c1a46eec047eb5fbc4b90432ec1ce65b76fb75 (diff) | |
download | frameworks_av-abaa51d3ca31f0eda99e1d271e6dc64c877dbf58.zip frameworks_av-abaa51d3ca31f0eda99e1d271e6dc64c877dbf58.tar.gz frameworks_av-abaa51d3ca31f0eda99e1d271e6dc64c877dbf58.tar.bz2 |
Camera2: Add flush support
- On HAL2 devices, fall back to wait until idle
- On HAL3 devices, call HAL flush method
Bug: 9758581
Change-Id: Ie1c570a15f6590a1ee6c271e3b989c48079b468a
Diffstat (limited to 'services/camera/libcameraservice/device2')
-rw-r--r-- | services/camera/libcameraservice/device2/Camera2Device.cpp | 28 | ||||
-rw-r--r-- | services/camera/libcameraservice/device2/Camera2Device.h | 5 |
2 files changed, 30 insertions, 3 deletions
diff --git a/services/camera/libcameraservice/device2/Camera2Device.cpp b/services/camera/libcameraservice/device2/Camera2Device.cpp index 710d0e9..fe2cd77 100644 --- a/services/camera/libcameraservice/device2/Camera2Device.cpp +++ b/services/camera/libcameraservice/device2/Camera2Device.cpp @@ -567,6 +567,13 @@ status_t Camera2Device::pushReprocessBuffer(int reprocessStreamId, return res; } +status_t Camera2Device::flush() { + ATRACE_CALL(); + + mRequestQueue.clear(); + return waitUntilDrained(); +} + /** * Camera2Device::MetadataQueue */ @@ -591,9 +598,7 @@ Camera2Device::MetadataQueue::MetadataQueue(): Camera2Device::MetadataQueue::~MetadataQueue() { ATRACE_CALL(); - Mutex::Autolock l(mMutex); - freeBuffers(mEntries.begin(), mEntries.end()); - freeBuffers(mStreamSlot.begin(), mStreamSlot.end()); + clear(); } // Connect to camera2 HAL as consumer (input requests/reprocessing) @@ -784,6 +789,23 @@ status_t Camera2Device::MetadataQueue::setStreamSlot( return signalConsumerLocked(); } +status_t Camera2Device::MetadataQueue::clear() +{ + ATRACE_CALL(); + ALOGV("%s: E", __FUNCTION__); + + Mutex::Autolock l(mMutex); + + // Clear streaming slot + freeBuffers(mStreamSlot.begin(), mStreamSlot.end()); + mStreamSlotCount = 0; + + // Clear request queue + freeBuffers(mEntries.begin(), mEntries.end()); + mCount = 0; + return OK; +} + status_t Camera2Device::MetadataQueue::dump(int fd, const Vector<String16>& /*args*/) { ATRACE_CALL(); diff --git a/services/camera/libcameraservice/device2/Camera2Device.h b/services/camera/libcameraservice/device2/Camera2Device.h index 8945ec2..2aa22a2 100644 --- a/services/camera/libcameraservice/device2/Camera2Device.h +++ b/services/camera/libcameraservice/device2/Camera2Device.h @@ -67,6 +67,8 @@ class Camera2Device: public CameraDeviceBase { virtual status_t triggerPrecaptureMetering(uint32_t id); virtual status_t pushReprocessBuffer(int reprocessStreamId, buffer_handle_t *buffer, wp<BufferReleasedListener> listener); + // Flush implemented as just a wait + virtual status_t flush(); private: const int mId; camera2_device_t *mHal2Device; @@ -113,6 +115,9 @@ class Camera2Device: public CameraDeviceBase { status_t setStreamSlot(camera_metadata_t *buf); status_t setStreamSlot(const List<camera_metadata_t*> &bufs); + // Clear the request queue and the streaming slot + status_t clear(); + status_t dump(int fd, const Vector<String16>& args); private: |