From patchwork Tue Mar 16 14:47:09 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: 11586 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 85CAFBD80C for ; Tue, 16 Mar 2021 14:47:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 48A7068D50; Tue, 16 Mar 2021 15:47:22 +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="DEiH9TXd"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0B0BE68D3F for ; Tue, 16 Mar 2021 15:47:21 +0100 (CET) Received: from localhost.localdomain (unknown [IPv6:2a01:e0a:169:7140:f840:1816:ba68:a009]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BC5688CF; Tue, 16 Mar 2021 15:47:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1615906040; bh=2uZo6Sqx0DIVCM906OwPvQX4ycTUHpD6n/jFrogHGzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DEiH9TXdRrDMQRYSevrbnZD+MraRtKSagzE1ujCrGBbe7lsJVrf0qmd+hbMFHS7/m Y427olYUrE2K62oxFmM6GoWlWtCSPFESCKNHaIoyDsi86rjUvdDAeIwURym71SoLH0 E2wpomdGWui5BLxWrxddVPQwvs2n329I4rw3gzrs= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Tue, 16 Mar 2021 15:47:09 +0100 Message-Id: <20210316144711.40778-2-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210316144711.40778-1-jeanmichel.hautbois@ideasonboard.com> References: <20210316144711.40778-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/3] 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 --- v3: - remove bds argument which is in a separate patch - split in two patches ipa configure moving v2: - move pipe configuration calculation from validate to configure - move ipa configuration from start to configure --- src/libcamera/pipeline/ipu3/ipu3.cpp | 38 +++++++++++++--------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 2ea13ec9..65657dcc 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -97,11 +97,14 @@ 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_; + /* Store the pipe configuration */ + ImgUDevice::PipeConfig pipeConfig_; + ImgUDevice::Pipe pipe_; + private: /* * The IPU3CameraData instance is guaranteed to be valid as long as the @@ -111,7 +114,6 @@ private: const IPU3CameraData *data_; StreamConfiguration cio2Configuration_; - ImgUDevice::PipeConfig pipeConfig_; }; class PipelineHandlerIPU3 : public PipelineHandler @@ -170,6 +172,7 @@ IPU3CameraConfiguration::IPU3CameraConfiguration(IPU3CameraData *data) CameraConfiguration::Status IPU3CameraConfiguration::validate() { Status status = Valid; + pipe_ = {}; if (config_.empty()) return Invalid; @@ -272,8 +275,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate() LOG(IPU3, Debug) << "CIO2 configuration: " << cio2Configuration_.toString(); - ImgUDevice::Pipe pipe{}; - pipe.input = cio2Configuration_.size; + pipe_.input = cio2Configuration_.size; /* * Adjust the configurations if needed and assign streams while @@ -349,15 +351,15 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate() cfg->setStream(const_cast(&data_->outStream_)); mainOutputAvailable = false; - pipe.main = cfg->size; + pipe_.main = cfg->size; if (yuvCount == 1) - pipe.viewfinder = pipe.main; + pipe_.viewfinder = pipe_.main; LOG(IPU3, Debug) << "Assigned " << cfg->toString() << " to the main output"; } else { cfg->setStream(const_cast(&data_->vfStream_)); - pipe.viewfinder = cfg->size; + pipe_.viewfinder = cfg->size; LOG(IPU3, Debug) << "Assigned " << cfg->toString() << " to the viewfinder output"; @@ -373,16 +375,6 @@ 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()) { - LOG(IPU3, Error) << "Failed to calculate pipe configuration: " - << "unsupported resolutions."; - return Invalid; - } - } - return status; } @@ -576,11 +568,17 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) * stream has been requested: return here to skip the ImgU configuration * part. */ - ImgUDevice::PipeConfig imguConfig = config->imguConfig(); - if (imguConfig.isNull()) + if (config->pipe_.main.isNull() && config->pipe_.viewfinder.isNull()) return 0; - ret = imgu->configure(imguConfig, &cio2Format); + config->pipeConfig_ = imgu->calculatePipeConfig(&config->pipe_); + if (config->pipeConfig_.isNull()) { + LOG(IPU3, Error) << "Failed to calculate pipe configuration: " + << "unsupported resolutions."; + return CameraConfiguration::Invalid; + } + + ret = imgu->configure(config->pipeConfig_, &cio2Format); if (ret) return ret; From patchwork Tue Mar 16 14:47:10 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: 11587 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 2F2AABD80C for ; Tue, 16 Mar 2021 14:47:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E3CD968D4F; Tue, 16 Mar 2021 15:47:24 +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="G+tvmEhW"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6B19868D4D for ; Tue, 16 Mar 2021 15:47:23 +0100 (CET) Received: from localhost.localdomain (unknown [IPv6:2a01:e0a:169:7140:f840:1816:ba68:a009]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1A3EA8C8; Tue, 16 Mar 2021 15:47:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1615906043; bh=m1ptAZBNku/80rSrV60VyvMk0o6/PR1Zm5R4W9mlVtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G+tvmEhWiXhHczU94ZFww2ddVzKTNGd0Ce8NXz9EI9tZxNWgKPn/9jMsSTkaQ+yHV STMlyWrXuPRSSMcra/NLHKVd2toBOze4t7Pp5r1xd0WiJ1476MzAlwUhuDqxUzuSDU pbxPYR3EZ1W91vVyJCRGhC7FX3/q8Bo2uvvQi27Y= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Tue, 16 Mar 2021 15:47:10 +0100 Message-Id: <20210316144711.40778-3-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210316144711.40778-1-jeanmichel.hautbois@ideasonboard.com> References: <20210316144711.40778-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/3] libcamera: ipu3: Move ipa configuration from start() to configure() 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" IPA was configured after all the pipeline devices were started, including IPA itself... Move it at the end of configure() call. Signed-off-by: Jean-Michel Hautbois --- src/libcamera/pipeline/ipu3/ipu3.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 65657dcc..174c1dd8 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -631,6 +631,10 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) return ret; } + std::map entityControls; + entityControls.emplace(0, data->cio2_.sensor()->controls()); + data->ipa_->configure(entityControls); + return 0; } @@ -715,7 +719,6 @@ int PipelineHandlerIPU3::freeBuffers(Camera *camera) int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] const ControlList *controls) { - std::map entityControls; IPU3CameraData *data = cameraData(camera); CIO2Device *cio2 = &data->cio2_; ImgUDevice *imgu = data->imgu_; @@ -742,9 +745,6 @@ int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] const ControlLis if (ret) goto error; - entityControls.emplace(0, data->cio2_.sensor()->controls()); - data->ipa_->configure(entityControls); - return 0; error: From patchwork Tue Mar 16 14:47:11 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: 11588 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 A68F5C32E2 for ; Tue, 16 Mar 2021 14:47:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 49D6968D57; Tue, 16 Mar 2021 15:47:25 +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="nUvhgFZ1"; 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 7DA8868D4F for ; Tue, 16 Mar 2021 15:47:24 +0100 (CET) Received: from localhost.localdomain (unknown [IPv6:2a01:e0a:169:7140:f840:1816:ba68:a009]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 16DC28C8; Tue, 16 Mar 2021 15:47:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1615906044; bh=Nx0KwrE+Le+uO0UpwsTZcT2BoR1LGMbwJXe2nAogpYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nUvhgFZ1UkreZOW4fYG3gKp7H7gbSDoOzUNVm0blfAoObSpx1b59MlO+mC1c9119z P5aH8swxPYQtUt8AsRQWdEaYnCldwzkOTXc9JiN4qaKqNrYqu9jjaC1stxuQvKovYR PzdvuTWfwTmyekWtsxmLtFym+LoZhvJcqsVtDnVo= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Tue, 16 Mar 2021 15:47:11 +0100 Message-Id: <20210316144711.40778-4-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210316144711.40778-1-jeanmichel.hautbois@ideasonboard.com> References: <20210316144711.40778-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 3/3] 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 --- v3: - pass bds size to ipa->configure() v2: - rename bds => bdsOutputSize - use a libcamera::Size instead of libcamera::Rectangle --- include/libcamera/ipa/ipu3.mojom | 2 +- src/ipa/ipu3/ipu3.cpp | 7 +++++-- src/libcamera/pipeline/ipu3/ipu3.cpp | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom index 6ee11333..5d13e7ea 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, Size bdsOutputSize) => (); mapBuffers(array buffers); unmapBuffers(array ids); diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index b63e58be..be73a225 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 Size &bdsOutputSize) 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 Size &bdsOutputSize) { if (entityControls.empty()) return; diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 174c1dd8..dcc6ad22 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -633,7 +633,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) std::map entityControls; entityControls.emplace(0, data->cio2_.sensor()->controls()); - data->ipa_->configure(entityControls); + data->ipa_->configure(entityControls, config->pipeConfig_.bds); return 0; }