summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/camera/libcameraservice/device3/Camera3OutputStream.cpp')
-rw-r--r--services/camera/libcameraservice/device3/Camera3OutputStream.cpp59
1 files changed, 27 insertions, 32 deletions
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
index 77ad503..0c739e9 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
@@ -33,9 +33,10 @@ namespace camera3 {
Camera3OutputStream::Camera3OutputStream(int id,
sp<ANativeWindow> consumer,
- uint32_t width, uint32_t height, int format) :
+ uint32_t width, uint32_t height, int format,
+ android_dataspace dataSpace, camera3_stream_rotation_t rotation) :
Camera3IOStreamBase(id, CAMERA3_STREAM_OUTPUT, width, height,
- /*maxSize*/0, format),
+ /*maxSize*/0, format, dataSpace, rotation),
mConsumer(consumer),
mTransform(0),
mTraceFirstBuffer(true) {
@@ -48,9 +49,10 @@ Camera3OutputStream::Camera3OutputStream(int id,
Camera3OutputStream::Camera3OutputStream(int id,
sp<ANativeWindow> consumer,
- uint32_t width, uint32_t height, size_t maxSize, int format) :
+ uint32_t width, uint32_t height, size_t maxSize, int format,
+ android_dataspace dataSpace, camera3_stream_rotation_t rotation) :
Camera3IOStreamBase(id, CAMERA3_STREAM_OUTPUT, width, height, maxSize,
- format),
+ format, dataSpace, rotation),
mConsumer(consumer),
mTransform(0),
mTraceFirstBuffer(true) {
@@ -69,10 +71,12 @@ Camera3OutputStream::Camera3OutputStream(int id,
Camera3OutputStream::Camera3OutputStream(int id, camera3_stream_type_t type,
uint32_t width, uint32_t height,
- int format) :
+ int format,
+ android_dataspace dataSpace,
+ camera3_stream_rotation_t rotation) :
Camera3IOStreamBase(id, type, width, height,
/*maxSize*/0,
- format),
+ format, dataSpace, rotation),
mTransform(0) {
// Subclasses expected to initialize mConsumer themselves
@@ -153,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();
/**
@@ -213,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);
@@ -323,6 +310,14 @@ status_t Camera3OutputStream::configureQueueLocked() {
return res;
}
+ res = native_window_set_buffers_data_space(mConsumer.get(),
+ camera3_stream::data_space);
+ if (res != OK) {
+ ALOGE("%s: Unable to configure stream dataspace %#x for stream %d",
+ __FUNCTION__, camera3_stream::data_space, mId);
+ return res;
+ }
+
int maxConsumerBuffers;
res = mConsumer->query(mConsumer.get(),
NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &maxConsumerBuffers);