From patchwork Fri Mar 12 13:03:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 11570 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 AEEFDBD80E for ; Fri, 12 Mar 2021 13:03:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 608E768C6C; Fri, 12 Mar 2021 14:03:11 +0100 (CET) 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="T8gIkgyV"; 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 5852868C66 for ; Fri, 12 Mar 2021 14:03:09 +0100 (CET) Received: from localhost.localdomain (unknown [IPv6:2a01:e0a:169:7140:ddbd:a3a3:e47b:e390]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 054A7ACB; Fri, 12 Mar 2021 14:03:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1615554189; bh=S+sw8AnNzixDGFsi29crSAPwFg2agjZAZr/P/Xy5owI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T8gIkgyVWf1O0ld/WDIFgcTay/oQFCbxa0SN0oiYWUCBwP8VBUOlvNL1JzQrCXRaj 9sFJ5ouDdcwgydIRixhILcPodppvsjaSkCWQaM2Kzjj2HDXLKSMlX3suEAEdglcpgV Szp3I/dwwx9FfIyVGXiO+7Zrn7TTjQIdQEuDQ0Gw= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Mar 2021 14:03:03 +0100 Message-Id: <20210312130304.34698-2-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210312130304.34698-1-jeanmichel.hautbois@ideasonboard.com> References: <20210312130304.34698-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] libcamera: ipu3: Move Imgu configuration to IPU3CameraData 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" The IPU3 IPA needs to know the BayerDownScaler (BDS) configuration to calculate the statistics grids. This patch makes it possible for PipelineHandlerIPU3::start() to access the BDS configuration and later pass the rectangle to the IPU3 IPA configure method. Signed-off-by: Jean-Michel Hautbois --- src/libcamera/pipeline/ipu3/ipu3.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 00da2bb2..0d133031 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -70,6 +70,8 @@ public: CIO2Device cio2_; ImgUDevice *imgu_; + ImgUDevice::PipeConfig pipeConfig_; + Stream outStream_; Stream vfStream_; Stream rawStream_; @@ -97,7 +99,6 @@ public: Status validate() override; const StreamConfiguration &cio2Format() const { return cio2Configuration_; } - const ImgUDevice::PipeConfig imguConfig() const { return pipeConfig_; } /* Cache the combinedTransform_ that will be applied to the sensor */ Transform combinedTransform_; @@ -108,10 +109,9 @@ private: * corresponding Camera instance is valid. In order to borrow a * reference to the camera data, store a new reference to the camera. */ - const IPU3CameraData *data_; + IPU3CameraData *data_; StreamConfiguration cio2Configuration_; - ImgUDevice::PipeConfig pipeConfig_; }; class PipelineHandlerIPU3 : public PipelineHandler @@ -375,12 +375,13 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate() /* Only compute the ImgU configuration if a YUV stream has been requested. */ if (yuvCount) { - pipeConfig_ = data_->imgu_->calculatePipeConfig(&pipe); - if (pipeConfig_.isNull()) { + ImgUDevice::PipeConfig imguConfig = data_->imgu_->calculatePipeConfig(&pipe); + if (imguConfig.isNull()) { LOG(IPU3, Error) << "Failed to calculate pipe configuration: " << "unsupported resolutions."; return Invalid; } + data_->pipeConfig_ = imguConfig; } return status; @@ -576,7 +577,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) * stream has been requested: return here to skip the ImgU configuration * part. */ - ImgUDevice::PipeConfig imguConfig = config->imguConfig(); + ImgUDevice::PipeConfig imguConfig = data->pipeConfig_; if (imguConfig.isNull()) return 0; From patchwork Fri Mar 12 13:03:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 11571 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 23575BD1F1 for ; Fri, 12 Mar 2021 13:03:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D03C068AA1; Fri, 12 Mar 2021 14:03:13 +0100 (CET) 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="IuR0O15q"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2635F68C6C for ; Fri, 12 Mar 2021 14:03:10 +0100 (CET) Received: from localhost.localdomain (unknown [IPv6:2a01:e0a:169:7140:ddbd:a3a3:e47b:e390]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B5914A2A; Fri, 12 Mar 2021 14:03:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1615554189; bh=jRaPSBmnyA2T0zu3Y/AwTMDyooztmN7esGJryc+sWdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IuR0O15qXNOCEoxYBKXvFc34g3dOlJZlqJNFwaH8DR4flB1DWvfBDJJKApF+XBNhh 0u20QbH/2oqkbY2yaYkfqnW2tG9TA4coPBMByRTQ8WMTZSEINLW0XqzWgDxbqgM2Dv IDAPb5caH6w0RXeyh9YLOMjTa5Vtxqi4Rmnkx0dA= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Mar 2021 14:03:04 +0100 Message-Id: <20210312130304.34698-3-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210312130304.34698-1-jeanmichel.hautbois@ideasonboard.com> References: <20210312130304.34698-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] libcamera: ipu3: Pass the BDS rectangle at IPA configure call 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" The IPU3 IPA will need the BDS configuration when the AWB/AGC algorithm will be integrated. In order to do that, the configure() interface needs to be modified. Signed-off-by: Jean-Michel Hautbois Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/ipu3.mojom | 2 +- src/ipa/ipu3/ipu3.cpp | 7 +++++-- src/libcamera/pipeline/ipu3/ipu3.cpp | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom index 6ee11333..71b61c60 100644 --- a/include/libcamera/ipa/ipu3.mojom +++ b/include/libcamera/ipa/ipu3.mojom @@ -30,7 +30,7 @@ interface IPAIPU3Interface { start() => (int32 ret); stop(); - configure(map entityControls) => (); + configure(map entityControls, Rectangle bds) => (); mapBuffers(array buffers); unmapBuffers(array ids); diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index b63e58be..4bce5c27 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -35,7 +35,9 @@ public: int start() override { return 0; } void stop() override {} - void configure(const std::map &entityControls) override; + void configure( + const std::map &entityControls, + const Rectangle &bds) override; void mapBuffers(const std::vector &buffers) override; void unmapBuffers(const std::vector &ids) override; @@ -62,7 +64,8 @@ private: uint32_t maxGain_; }; -void IPAIPU3::configure(const std::map &entityControls) +void IPAIPU3::configure(const std::map &entityControls, + [[maybe_unused]] const Rectangle &bds) { if (entityControls.empty()) return; diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 0d133031..4958d2fe 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -722,6 +722,7 @@ int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] const ControlLis IPU3CameraData *data = cameraData(camera); CIO2Device *cio2 = &data->cio2_; ImgUDevice *imgu = data->imgu_; + Rectangle bds{ 0, 0, data->pipeConfig_.bds }; int ret; /* Allocate buffers for internal pipeline usage. */ @@ -746,7 +747,8 @@ int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] const ControlLis goto error; entityControls.emplace(0, data->cio2_.sensor()->controls()); - data->ipa_->configure(entityControls); + + data->ipa_->configure(entityControls, bds); return 0;