From patchwork Thu Aug 26 21:30:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13519 X-Patchwork-Delegate: umang.jain@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 8AABEC3241 for ; Thu, 26 Aug 2021 21:30:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3943A68946; Thu, 26 Aug 2021 23:30:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="RMTxw7wu"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EC0B268939 for ; Thu, 26 Aug 2021 23:30:33 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.246]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E28161924; Thu, 26 Aug 2021 23:30:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1630013433; bh=44YKH3zVrd0HTQ8zZnbsoGzcW6FpaIMi3DHZizbS9A8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RMTxw7wu+Bt7Ls4AESXCr58IP2IbxkPJZQKPA4hFAPwwGJhwmcz7sWM/0RSt3dwoj 4XKxEUXwLv7HDzYhVfy/g4PiqDrCjq+dN8/OaeWNLERCSfFwR1ooNRpBN3C8bUnueq ITEasP3X1idyqWTE4qD8hh3Q4tO0gfL2vSfuJCL0= From: Umang Jain 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 Subject: [libcamera-devel] [RFC PATCH 4/5] android: camera_stream: Notify process() status with a Signal X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" CameraStream takes care of any post-processing required via the CameraStream::process(). Since the post-processor will be moved to a separate thread (in subsequent commit), the caller of CameraStream::process() should be able to get notified about the status, in order to proceed further for completing the callbacks to android framework. Therefore, chain up to PostProcessor::processComplete signal in its signal handler. Currently, we have only one post-processor in-use, hence emit the corresponding CameraStream::PostProcessing value according to the PostProcessor::status received in the signal handler. Signed-off-by: Umang Jain --- src/android/camera_stream.cpp | 17 +++++++++++++++++ src/android/camera_stream.h | 14 +++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp index 59b1df6e..bdcc7cf9 100644 --- a/src/android/camera_stream.cpp +++ b/src/android/camera_stream.cpp @@ -81,6 +81,8 @@ int CameraStream::configure() int ret = postProcessor_->configure(configuration(), output); if (ret) return ret; + + postProcessor_->processComplete.connect(this, &CameraStream::handlePostProcessing); } if (allocator_) { @@ -119,6 +121,21 @@ int CameraStream::process(const libcamera::FrameBuffer *source, return postProcessor_->process(source, &dest, requestMetadata, resultMetadata); } +void CameraStream::handlePostProcessing(PostProcessor::Status status, + CameraMetadata *resultMetadata) +{ + switch (status) { + case PostProcessor::Status::Success: + processComplete.emit(this, ProcessStatus::Success, resultMetadata); + break; + case PostProcessor::Status::Failed: + processComplete.emit(this, ProcessStatus::Failed, resultMetadata); + break; + default: + LOG(HAL, Error) << "PostProcessor status invalid"; + } +} + FrameBuffer *CameraStream::getBuffer() { if (!allocator_) diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h index 5c232cb6..d54d3f58 100644 --- a/src/android/camera_stream.h +++ b/src/android/camera_stream.h @@ -13,15 +13,18 @@ #include +#include + #include #include #include #include #include +#include "post_processor.h" + class CameraDevice; class CameraMetadata; -class PostProcessor; class CameraStream { @@ -125,7 +128,16 @@ public: libcamera::FrameBuffer *getBuffer(); void putBuffer(libcamera::FrameBuffer *buffer); + enum ProcessStatus { + Failed, + Success, + }; + libcamera::Signal processComplete; + private: + void handlePostProcessing(PostProcessor::Status status, + CameraMetadata *resultMetadata); + CameraDevice *const cameraDevice_; const libcamera::CameraConfiguration *config_; const Type type_;