{"id":11452,"url":"https://patchwork.libcamera.org/api/1.1/patches/11452/?format=json","web_url":"https://patchwork.libcamera.org/patch/11452/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210302141844.126634-6-jacopo@jmondi.org>","date":"2021-03-02T14:18:38","name":"[libcamera-devel,v4,05/11] android: Move buffer mapping to CameraStream","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"cf4cb6e4fcc935a1b3e86d6c15def8e8d50fb929","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11452/mbox/","series":[{"id":1740,"url":"https://patchwork.libcamera.org/api/1.1/series/1740/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1740","date":"2021-03-02T14:18:33","name":"android: Supports memory backends","version":4,"mbox":"https://patchwork.libcamera.org/series/1740/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11452/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11452/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id D2FA9BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Mar 2021 14:18:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ABF3A68A98;\n\tTue,  2 Mar 2021 15:18:31 +0100 (CET)","from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C068768A7E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Mar 2021 15:18:29 +0100 (CET)","from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id 67AAF200011;\n\tTue,  2 Mar 2021 14:18:27 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  2 Mar 2021 15:18:38 +0100","Message-Id":"<20210302141844.126634-6-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.30.0","In-Reply-To":"<20210302141844.126634-1-jacopo@jmondi.org>","References":"<20210302141844.126634-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v4 05/11] android: Move buffer mapping to\n\tCameraStream","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"Han-lin Chen <hanlinchen@chromium.org>,\n\tDaniel Hung-yu Wu <hywu@google.com>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The destination buffer for the post-processing component is\ncurrently first mapped in the CameraDevice class and then passed\nto CameraStream which simply calls the post-processor interface.\n\nMove the mapping to CameraStream::process() to tie the buffer\nmapping to the lifetime of the CameraBuffer instance.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 15 ++-------------\n src/android/camera_device.h   |  1 -\n src/android/camera_stream.cpp | 16 +++++++++++++---\n src/android/camera_stream.h   |  2 +-\n 4 files changed, 16 insertions(+), 18 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 1c3b0f56ed28..ae01c362559e 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1857,19 +1857,8 @@ void CameraDevice::requestComplete(Request *request)\n \t\t\tcontinue;\n \t\t}\n \n-\t\t/*\n-\t\t * \\todo Buffer mapping and compression should be moved to a\n-\t\t * separate thread.\n-\t\t */\n-\n-\t\tCameraBuffer dest(*descriptor->buffers_[i].buffer,\n-\t\t\t\t  PROT_READ | PROT_WRITE);\n-\t\tif (!dest.isValid()) {\n-\t\t\tLOG(HAL, Error) << \"Failed to map android blob buffer\";\n-\t\t\tcontinue;\n-\t\t}\n-\n-\t\tint ret = cameraStream->process(*src, &dest,\n+\t\tint ret = cameraStream->process(*src,\n+\t\t\t\t\t\t*descriptor->buffers_[i].buffer,\n \t\t\t\t\t\tdescriptor->settings_,\n \t\t\t\t\t\tresultMetadata.get());\n \t\tif (ret) {\ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex e6c192c2100b..4905958e63c6 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -24,7 +24,6 @@\n #include \"libcamera/internal/log.h\"\n #include \"libcamera/internal/message.h\"\n \n-#include \"camera_buffer.h\"\n #include \"camera_metadata.h\"\n #include \"camera_stream.h\"\n #include \"camera_worker.h\"\ndiff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\nindex 611ec0d1c42e..b2f03b505199 100644\n--- a/src/android/camera_stream.cpp\n+++ b/src/android/camera_stream.cpp\n@@ -7,6 +7,7 @@\n \n #include \"camera_stream.h\"\n \n+#include \"camera_buffer.h\"\n #include \"camera_device.h\"\n #include \"camera_metadata.h\"\n #include \"jpeg/post_processor_jpeg.h\"\n@@ -96,15 +97,24 @@ int CameraStream::configure()\n }\n \n int CameraStream::process(const libcamera::FrameBuffer &source,\n-\t\t\t  libcamera::MappedBuffer *destination,\n+\t\t\t  buffer_handle_t camera3Dest,\n \t\t\t  const CameraMetadata &requestMetadata,\n \t\t\t  CameraMetadata *resultMetadata)\n {\n \tif (!postProcessor_)\n \t\treturn 0;\n \n-\treturn postProcessor_->process(source, destination,\n-\t\t\t\t       requestMetadata, resultMetadata);\n+\t/*\n+\t * \\todo Buffer mapping and processing should be moved to a\n+\t * separate thread.\n+\t */\n+\tCameraBuffer dest(camera3Dest, PROT_READ | PROT_WRITE);\n+\tif (!dest.isValid()) {\n+\t\tLOG(HAL, Error) << \"Failed to map android blob buffer\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn postProcessor_->process(source, &dest, requestMetadata, resultMetadata);\n }\n \n FrameBuffer *CameraStream::getBuffer()\ndiff --git a/src/android/camera_stream.h b/src/android/camera_stream.h\nindex fc242b2aadf1..f68fdd3a17cd 100644\n--- a/src/android/camera_stream.h\n+++ b/src/android/camera_stream.h\n@@ -120,7 +120,7 @@ public:\n \n \tint configure();\n \tint process(const libcamera::FrameBuffer &source,\n-\t\t    libcamera::MappedBuffer *destination,\n+\t\t    buffer_handle_t camera3Dest,\n \t\t    const CameraMetadata &requestMetadata,\n \t\t    CameraMetadata *resultMetadata);\n \tlibcamera::FrameBuffer *getBuffer();\n","prefixes":["libcamera-devel","v4","05/11"]}