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;