summaryrefslogtreecommitdiff
path: root/src/android/camera_stream.cpp
diff options
context:
space:
mode:
authorUmang Jain <umang.jain@ideasonboard.com>2021-10-26 12:51:45 +0530
committerUmang Jain <umang.jain@ideasonboard.com>2021-10-26 16:11:17 +0530
commit79cdb1f19d8033cf2e291b284fe1419098d5df81 (patch)
tree64b42319999fb367fcbd0cb5cbe336dbba2732ec /src/android/camera_stream.cpp
parent64bcbd0e2c2ac78fae7e329cec86bc4806cd5c45 (diff)
android: post_processor: Consolidate contextual information
Save and provide the context for post-processor of a camera stream via Camera3RequestDescriptor::StreamBuffer. We extend the structure to include source and destination buffers for the post processor, along with CameraStream::Type::Internal buffer pointer (if any). In addition to that, a back pointer to Camera3RequestDescriptor is convenient to get access to overall descriptor (status, metadata settings etc.). Also, migrate CameraStream::process() and PostProcessor::process() signature to use Camera3RequestDescriptor::StreamBuffer only. This will be helpful when we move to async post-processing in subsequent commits. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Diffstat (limited to 'src/android/camera_stream.cpp')
-rw-r--r--src/android/camera_stream.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp
index 5d991fe5..282b19b0 100644
--- a/src/android/camera_stream.cpp
+++ b/src/android/camera_stream.cpp
@@ -146,23 +146,21 @@ int CameraStream::waitFence(int fence)
return -errno;
}
-int CameraStream::process(const FrameBuffer &source,
- Camera3RequestDescriptor::StreamBuffer &dest,
- Camera3RequestDescriptor *request)
+int CameraStream::process(Camera3RequestDescriptor::StreamBuffer *streamBuffer)
{
ASSERT(type_ != Type::Direct);
/* Handle waiting on fences on the destination buffer. */
- if (dest.fence != -1) {
- int ret = waitFence(dest.fence);
+ if (streamBuffer->fence != -1) {
+ int ret = waitFence(streamBuffer->fence);
if (ret < 0) {
LOG(HAL, Error) << "Failed waiting for fence: "
- << dest.fence << ": " << strerror(-ret);
+ << streamBuffer->fence << ": " << strerror(-ret);
return ret;
}
- ::close(dest.fence);
- dest.fence = -1;
+ ::close(streamBuffer->fence);
+ streamBuffer->fence = -1;
}
/*
@@ -170,14 +168,15 @@ int CameraStream::process(const FrameBuffer &source,
* separate thread.
*/
const StreamConfiguration &output = configuration();
- CameraBuffer destBuffer(*dest.camera3Buffer, output.pixelFormat,
- output.size, PROT_READ | PROT_WRITE);
- if (!destBuffer.isValid()) {
+ streamBuffer->dstBuffer = std::make_unique<CameraBuffer>(
+ *streamBuffer->camera3Buffer, output.pixelFormat, output.size,
+ PROT_READ | PROT_WRITE);
+ if (!streamBuffer->dstBuffer->isValid()) {
LOG(HAL, Error) << "Failed to create destination buffer";
return -EINVAL;
}
- return postProcessor_->process(source, &destBuffer, request);
+ return postProcessor_->process(streamBuffer);
}
FrameBuffer *CameraStream::getBuffer()