From a725baf4b33320a71f03474627c9bf19cdafc4ed Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Wed, 24 Feb 2021 12:50:40 +0100 Subject: android: Move buffer mapping to CameraStream The destination buffer for the post-processing component is currently first mapped in the CameraDevice class and then passed to CameraStream which simply calls the post-processor interface. Move the mapping to CameraStream::process() to tie the buffer mapping to the lifetime of the CameraBuffer instance. Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/android/camera_stream.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/android/camera_stream.cpp') diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp index 611ec0d1..b2f03b50 100644 --- a/src/android/camera_stream.cpp +++ b/src/android/camera_stream.cpp @@ -7,6 +7,7 @@ #include "camera_stream.h" +#include "camera_buffer.h" #include "camera_device.h" #include "camera_metadata.h" #include "jpeg/post_processor_jpeg.h" @@ -96,15 +97,24 @@ int CameraStream::configure() } int CameraStream::process(const libcamera::FrameBuffer &source, - libcamera::MappedBuffer *destination, + buffer_handle_t camera3Dest, const CameraMetadata &requestMetadata, CameraMetadata *resultMetadata) { if (!postProcessor_) return 0; - return postProcessor_->process(source, destination, - requestMetadata, resultMetadata); + /* + * \todo Buffer mapping and processing should be moved to a + * separate thread. + */ + CameraBuffer dest(camera3Dest, PROT_READ | PROT_WRITE); + if (!dest.isValid()) { + LOG(HAL, Error) << "Failed to map android blob buffer"; + return -EINVAL; + } + + return postProcessor_->process(source, &dest, requestMetadata, resultMetadata); } FrameBuffer *CameraStream::getBuffer() -- cgit v1.2.1