{"id":13519,"url":"https://patchwork.libcamera.org/api/patches/13519/?format=json","web_url":"https://patchwork.libcamera.org/patch/13519/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20210826213016.1829504-5-umang.jain@ideasonboard.com>","date":"2021-08-26T21:30:15","name":"[libcamera-devel,RFC,4/5] android: camera_stream: Notify process() status with a Signal","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"e2b29a602298ccdec190b39c228c5c2c78614935","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":{"id":12,"url":"https://patchwork.libcamera.org/api/users/12/?format=json","username":"uajain","first_name":"Umang","last_name":"Jain","email":"umang.jain@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/13519/mbox/","series":[{"id":2401,"url":"https://patchwork.libcamera.org/api/series/2401/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2401","date":"2021-08-26T21:30:11","name":"android: Async post-processing","version":1,"mbox":"https://patchwork.libcamera.org/series/2401/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13519/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13519/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 8AABEC3241\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Aug 2021 21:30:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3943A68946;\n\tThu, 26 Aug 2021 23:30:36 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EC0B268939\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Aug 2021 23:30:33 +0200 (CEST)","from perceval.ideasonboard.com (unknown [103.251.226.246])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E28161924;\n\tThu, 26 Aug 2021 23:30:32 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"RMTxw7wu\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630013433;\n\tbh=44YKH3zVrd0HTQ8zZnbsoGzcW6FpaIMi3DHZizbS9A8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=RMTxw7wu+Bt7Ls4AESXCr58IP2IbxkPJZQKPA4hFAPwwGJhwmcz7sWM/0RSt3dwoj\n\t4XKxEUXwLv7HDzYhVfy/g4PiqDrCjq+dN8/OaeWNLERCSfFwR1ooNRpBN3C8bUnueq\n\tITEasP3X1idyqWTE4qD8hh3Q4tO0gfL2vSfuJCL0=","From":"Umang Jain <umang.jain@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 27 Aug 2021 03:00:15 +0530","Message-Id":"<20210826213016.1829504-5-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20210826213016.1829504-1-umang.jain@ideasonboard.com>","References":"<20210826213016.1829504-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC PATCH 4/5] android: camera_stream: Notify\n\tprocess() status with a Signal","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"CameraStream takes care of any post-processing required via the\nCameraStream::process(). Since the post-processor will be moved\nto a separate thread (in subsequent commit), the caller of\nCameraStream::process() should be able to get notified about the\nstatus, in order to proceed further for completing the callbacks\nto android framework.\n\nTherefore, chain up to PostProcessor::processComplete signal in its\nsignal handler. Currently, we have only one post-processor in-use,\nhence emit the corresponding CameraStream::PostProcessing value\naccording to the  PostProcessor::status received in the signal handler.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/android/camera_stream.cpp | 17 +++++++++++++++++\n src/android/camera_stream.h   | 14 +++++++++++++-\n 2 files changed, 30 insertions(+), 1 deletion(-)","diff":"diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\nindex 59b1df6e..bdcc7cf9 100644\n--- a/src/android/camera_stream.cpp\n+++ b/src/android/camera_stream.cpp\n@@ -81,6 +81,8 @@ int CameraStream::configure()\n \t\tint ret = postProcessor_->configure(configuration(), output);\n \t\tif (ret)\n \t\t\treturn ret;\n+\n+\t\tpostProcessor_->processComplete.connect(this, &CameraStream::handlePostProcessing);\n \t}\n \n \tif (allocator_) {\n@@ -119,6 +121,21 @@ int CameraStream::process(const libcamera::FrameBuffer *source,\n \treturn postProcessor_->process(source, &dest, requestMetadata, resultMetadata);\n }\n \n+void CameraStream::handlePostProcessing(PostProcessor::Status status,\n+\t\t\t\t\tCameraMetadata *resultMetadata)\n+{\n+\tswitch (status) {\n+\tcase PostProcessor::Status::Success:\n+\t\tprocessComplete.emit(this, ProcessStatus::Success, resultMetadata);\n+\t\tbreak;\n+\tcase PostProcessor::Status::Failed:\n+\t\tprocessComplete.emit(this, ProcessStatus::Failed, resultMetadata);\n+\t\tbreak;\n+\tdefault:\n+\t\tLOG(HAL, Error) << \"PostProcessor status invalid\";\n+\t}\n+}\n+\n FrameBuffer *CameraStream::getBuffer()\n {\n \tif (!allocator_)\ndiff --git a/src/android/camera_stream.h b/src/android/camera_stream.h\nindex 5c232cb6..d54d3f58 100644\n--- a/src/android/camera_stream.h\n+++ b/src/android/camera_stream.h\n@@ -13,15 +13,18 @@\n \n #include <hardware/camera3.h>\n \n+#include <libcamera/base/signal.h>\n+\n #include <libcamera/camera.h>\n #include <libcamera/framebuffer.h>\n #include <libcamera/framebuffer_allocator.h>\n #include <libcamera/geometry.h>\n #include <libcamera/pixel_format.h>\n \n+#include \"post_processor.h\"\n+\n class CameraDevice;\n class CameraMetadata;\n-class PostProcessor;\n \n class CameraStream\n {\n@@ -125,7 +128,16 @@ public:\n \tlibcamera::FrameBuffer *getBuffer();\n \tvoid putBuffer(libcamera::FrameBuffer *buffer);\n \n+\tenum ProcessStatus {\n+\t\tFailed,\n+\t\tSuccess,\n+\t};\n+\tlibcamera::Signal<CameraStream *, ProcessStatus, CameraMetadata *> processComplete;\n+\n private:\n+\tvoid handlePostProcessing(PostProcessor::Status status,\n+\t\t\t\t  CameraMetadata *resultMetadata);\n+\n \tCameraDevice *const cameraDevice_;\n \tconst libcamera::CameraConfiguration *config_;\n \tconst Type type_;\n","prefixes":["libcamera-devel","RFC","4/5"]}