diff options
author | Igor Murashkin <iam@google.com> | 2014-08-21 22:33:24 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-21 22:33:25 +0000 |
commit | 1da8c89a9d4a2319bb939771e43960c118445329 (patch) | |
tree | 01bf6b4f2a51383c5a0c7b199331bc49ba7b485f /services/camera | |
parent | 0e522ed229053c7d0238425e407431fc08cd7c63 (diff) | |
parent | e2d167eb689d7a536805f950c31f11b9e9c578ae (diff) | |
download | frameworks_av-1da8c89a9d4a2319bb939771e43960c118445329.zip frameworks_av-1da8c89a9d4a2319bb939771e43960c118445329.tar.gz frameworks_av-1da8c89a9d4a2319bb939771e43960c118445329.tar.bz2 |
Merge "camera: Configure streams immediately when API2 does configuration" into lmp-dev
Diffstat (limited to 'services/camera')
6 files changed, 49 insertions, 3 deletions
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp index 86f82a3..80c797a 100644 --- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp +++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp @@ -254,9 +254,17 @@ status_t CameraDeviceClient::beginConfigure() { } status_t CameraDeviceClient::endConfigure() { - // TODO: Implement this. - ALOGE("%s: Not implemented yet.", __FUNCTION__); - return OK; + ALOGV("%s: ending configure (%zu streams)", + __FUNCTION__, mStreamMap.size()); + + status_t res; + if ( (res = checkPid(__FUNCTION__) ) != OK) return res; + + Mutex::Autolock icl(mBinderSerializationLock); + + if (!mDevice.get()) return DEAD_OBJECT; + + return mDevice->configureStreams(); } status_t CameraDeviceClient::deleteStream(int streamId) { diff --git a/services/camera/libcameraservice/common/CameraDeviceBase.h b/services/camera/libcameraservice/common/CameraDeviceBase.h index 9e124b0..d26e20c 100644 --- a/services/camera/libcameraservice/common/CameraDeviceBase.h +++ b/services/camera/libcameraservice/common/CameraDeviceBase.h @@ -141,6 +141,18 @@ class CameraDeviceBase : public virtual RefBase { virtual status_t deleteReprocessStream(int id) = 0; /** + * Take the currently-defined set of streams and configure the HAL to use + * them. This is a long-running operation (may be several hundered ms). + * + * The device must be idle (see waitUntilDrained) before calling this. + * + * Returns OK on success; otherwise on error: + * - BAD_VALUE if the set of streams was invalid (e.g. fmts or sizes) + * - INVALID_OPERATION if the device was in the wrong state + */ + virtual status_t configureStreams() = 0; + + /** * Create a metadata buffer with fields that the HAL device believes are * best for the given use case */ diff --git a/services/camera/libcameraservice/device2/Camera2Device.cpp b/services/camera/libcameraservice/device2/Camera2Device.cpp index d473a76..8caadd6 100644 --- a/services/camera/libcameraservice/device2/Camera2Device.cpp +++ b/services/camera/libcameraservice/device2/Camera2Device.cpp @@ -415,6 +415,19 @@ status_t Camera2Device::deleteReprocessStream(int id) { return OK; } +status_t Camera2Device::configureStreams() { + ATRACE_CALL(); + ALOGV("%s: E", __FUNCTION__); + + /** + * HAL2 devices do not need to configure streams; + * streams are created on the fly. + */ + ALOGW("%s: No-op for HAL2 devices", __FUNCTION__); + + return OK; +} + status_t Camera2Device::createDefaultRequest(int templateId, CameraMetadata *request) { diff --git a/services/camera/libcameraservice/device2/Camera2Device.h b/services/camera/libcameraservice/device2/Camera2Device.h index d0ca46e..2a3f1d9 100644 --- a/services/camera/libcameraservice/device2/Camera2Device.h +++ b/services/camera/libcameraservice/device2/Camera2Device.h @@ -64,6 +64,8 @@ class Camera2Device: public CameraDeviceBase { virtual status_t setStreamTransform(int id, int transform); virtual status_t deleteStream(int id); virtual status_t deleteReprocessStream(int id); + // No-op on HAL2 devices + virtual status_t configureStreams(); virtual status_t createDefaultRequest(int templateId, CameraMetadata *request); virtual status_t waitUntilDrained(); virtual status_t setNotifyCallback(NotificationListener *listener); diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp index ed350c1..93c8662 100644 --- a/services/camera/libcameraservice/device3/Camera3Device.cpp +++ b/services/camera/libcameraservice/device3/Camera3Device.cpp @@ -1000,6 +1000,15 @@ status_t Camera3Device::deleteReprocessStream(int id) { return INVALID_OPERATION; } +status_t Camera3Device::configureStreams() { + ATRACE_CALL(); + ALOGV("%s: E", __FUNCTION__); + + Mutex::Autolock il(mInterfaceLock); + Mutex::Autolock l(mLock); + + return configureStreamsLocked(); +} status_t Camera3Device::createDefaultRequest(int templateId, CameraMetadata *request) { diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h index 7656237..e071cc2 100644 --- a/services/camera/libcameraservice/device3/Camera3Device.h +++ b/services/camera/libcameraservice/device3/Camera3Device.h @@ -114,6 +114,8 @@ class Camera3Device : virtual status_t deleteStream(int id); virtual status_t deleteReprocessStream(int id); + virtual status_t configureStreams(); + virtual status_t createDefaultRequest(int templateId, CameraMetadata *request); // Transitions to the idle state on success |