diff options
author | Yin-Chia Yeh <yinchiayeh@google.com> | 2015-03-05 15:01:36 -0800 |
---|---|---|
committer | Yin-Chia Yeh <yinchiayeh@google.com> | 2015-03-24 17:14:17 -0700 |
commit | 4c9736fbc82b8b76c996c966583d71ca1df17ca6 (patch) | |
tree | 0388c2ca426e1615052359f5ff65655705966e3f /services/camera/libcameraservice | |
parent | 0e4421286b92a81e952f53210227adbf05d97c25 (diff) | |
download | frameworks_av-4c9736fbc82b8b76c996c966583d71ca1df17ca6.zip frameworks_av-4c9736fbc82b8b76c996c966583d71ca1df17ca6.tar.gz frameworks_av-4c9736fbc82b8b76c996c966583d71ca1df17ca6.tar.bz2 |
Camera: fix release fence logic
According to spec, HAL will set release_fence to acquire_fence
when error happened (usually during flush call). Camera service
should not refer to the acquireFence anyhow since per spec HAL
needs to set it to -1 if acquireFence has been waited on.
Change-Id: I809355d0c8c71f78f657e37d19221fd1f5bdc90b
Diffstat (limited to 'services/camera/libcameraservice')
-rw-r--r-- | services/camera/libcameraservice/device3/Camera3OutputStream.cpp | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp index 96bed0d..0c739e9 100644 --- a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp +++ b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp @@ -157,33 +157,9 @@ status_t Camera3OutputStream::returnBufferCheckedLocked( ALOG_ASSERT(output, "Expected output to be true"); status_t res; - sp<Fence> releaseFence; - - /** - * Fence management - calculate Release Fence - */ - if (buffer.status == CAMERA3_BUFFER_STATUS_ERROR) { - if (buffer.release_fence != -1) { - ALOGE("%s: Stream %d: HAL should not set release_fence(%d) when " - "there is an error", __FUNCTION__, mId, buffer.release_fence); - close(buffer.release_fence); - } - - /** - * Reassign release fence as the acquire fence in case of error - */ - releaseFence = new Fence(buffer.acquire_fence); - } else { - res = native_window_set_buffers_timestamp(mConsumer.get(), timestamp); - if (res != OK) { - ALOGE("%s: Stream %d: Error setting timestamp: %s (%d)", - __FUNCTION__, mId, strerror(-res), res); - return res; - } - - releaseFence = new Fence(buffer.release_fence); - } + // Fence management - always honor release fence from HAL + sp<Fence> releaseFence = new Fence(buffer.release_fence); int anwReleaseFence = releaseFence->dup(); /** @@ -217,6 +193,13 @@ status_t Camera3OutputStream::returnBufferCheckedLocked( mTraceFirstBuffer = false; } + res = native_window_set_buffers_timestamp(mConsumer.get(), timestamp); + if (res != OK) { + ALOGE("%s: Stream %d: Error setting timestamp: %s (%d)", + __FUNCTION__, mId, strerror(-res), res); + return res; + } + res = currentConsumer->queueBuffer(currentConsumer.get(), container_of(buffer.buffer, ANativeWindowBuffer, handle), anwReleaseFence); |