diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2013-06-11 16:04:06 -0700 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2013-06-11 16:06:02 -0700 |
commit | ea26c7772f4721657db409068d4bed194ae49c94 (patch) | |
tree | 20600997090d036235aeda08a46ddcbd126efa21 /services | |
parent | ba696bbff88d5627beaa0be95be78ba30138983d (diff) | |
download | frameworks_av-ea26c7772f4721657db409068d4bed194ae49c94.zip frameworks_av-ea26c7772f4721657db409068d4bed194ae49c94.tar.gz frameworks_av-ea26c7772f4721657db409068d4bed194ae49c94.tar.bz2 |
Camera3: Skip no-op stream configurations.
If configuring the same set of streams more than once, don't actually
call into the HAL for the second and subsequent configure calls, since
they're no-ops.
This can speed up camera operation substantially if the
HAL implementation does not detect no-ops on its own and does a full
shutdown/restart on each configure call.
Bug: 9392513
Change-Id: I23baf4acbae2304735899adcf8e17565fa94d31d
Diffstat (limited to 'services')
-rw-r--r-- | services/camera/libcameraservice/Camera3Device.cpp | 9 | ||||
-rw-r--r-- | services/camera/libcameraservice/Camera3Device.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/Camera3Device.cpp b/services/camera/libcameraservice/Camera3Device.cpp index c7edb76..bc4db91 100644 --- a/services/camera/libcameraservice/Camera3Device.cpp +++ b/services/camera/libcameraservice/Camera3Device.cpp @@ -170,6 +170,7 @@ status_t Camera3Device::initialize(camera_module_t *module) mHal3Device = device; mStatus = STATUS_IDLE; mNextStreamId = 0; + mNeedConfig = true; return OK; } @@ -582,6 +583,7 @@ status_t Camera3Device::createStream(sp<ANativeWindow> consumer, } *id = mNextStreamId++; + mNeedConfig = true; // Continue captures if active at start if (wasActive) { @@ -707,6 +709,7 @@ status_t Camera3Device::deleteStream(int id) { // fall through since we want to still list the stream as deleted. } mDeletedStreams.add(deletedStream); + mNeedConfig = true; return res; } @@ -1007,6 +1010,11 @@ status_t Camera3Device::configureStreamsLocked() { return INVALID_OPERATION; } + if (!mNeedConfig) { + ALOGV("%s: Skipping config, no stream changes", __FUNCTION__); + return OK; + } + // Start configuring the streams camera3_stream_configuration config; @@ -1091,6 +1099,7 @@ status_t Camera3Device::configureStreamsLocked() { // Finish configuring the streams lazily on first reference mStatus = STATUS_ACTIVE; + mNeedConfig = false; return OK; } diff --git a/services/camera/libcameraservice/Camera3Device.h b/services/camera/libcameraservice/Camera3Device.h index 7a8c22a..faa42b9 100644 --- a/services/camera/libcameraservice/Camera3Device.h +++ b/services/camera/libcameraservice/Camera3Device.h @@ -149,6 +149,7 @@ class Camera3Device : StreamSet mOutputStreams; sp<camera3::Camera3Stream> mInputStream; int mNextStreamId; + bool mNeedConfig; // Need to hold on to stream references until configure completes. Vector<sp<camera3::Camera3StreamInterface> > mDeletedStreams; |