From patchwork Tue Mar 16 10:18:38 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: 11581 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 2ED0ABD80C for ; Tue, 16 Mar 2021 10:18:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DF33068D4B; Tue, 16 Mar 2021 11:18:48 +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="gzUBflEm"; 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 7271468D3D for ; Tue, 16 Mar 2021 11:18:45 +0100 (CET) Received: from localhost.localdomain (unknown [IPv6:2a01:e0a:169:7140:f840:1816:ba68:a009]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 23663D8B; Tue, 16 Mar 2021 11:18:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1615889925; bh=IZA01gZFLG4IskMW8GZO0fqhzhl+H50SlZ3yTkWxgL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gzUBflEmCYs4YBCba+1+25iM/AIhhpn31WeeBM9T38ZLpP9RSHoY7Hvvdj2Eru7N8 Q5d7P9xE0dISq+oT27wfqyJWoN2Nr7I9UGSV0kkyMNhX0z41/8Ua4KE68mBCYKZceg skncYf8ckZX1+Oq3ky2Sm4I0kGRRT+s5IkY5zcwE= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Tue, 16 Mar 2021 11:18:38 +0100 Message-Id: <20210316101842.18674-2-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210316101842.18674-1-jeanmichel.hautbois@ideasonboard.com> References: <20210316101842.18674-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 --- v2: - move pipe configuration calculation from validate to configure - move ipa configuration from start to configure --- src/libcamera/pipeline/ipu3/ipu3.cpp | 45 +++++++++++++--------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 2ea13ec9..3f49ded3 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -97,21 +97,23 @@ 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 * 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 @@ -272,8 +274,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 +350,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 +374,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 +567,15 @@ 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()) + + config->pipeConfig_ = imgu->calculatePipeConfig(&config->pipe_); + if (config->pipeConfig_.isNull()) { + LOG(IPU3, Error) << "Failed to calculate pipe configuration: " + << "unsupported resolutions."; return 0; + } - ret = imgu->configure(imguConfig, &cio2Format); + ret = imgu->configure(config->pipeConfig_, &cio2Format); if (ret) return ret; @@ -633,6 +628,10 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) return ret; } + std::map entityControls; + entityControls.emplace(0, data->cio2_.sensor()->controls()); + data->ipa_->configure(entityControls, config->pipeConfig_.bds); + return 0; } @@ -717,7 +716,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_; @@ -744,9 +742,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: