From patchwork Thu Jul 9 08:41:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 8709 X-Patchwork-Delegate: jacopo@jmondi.org 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 5977ABDB1D for ; Thu, 9 Jul 2020 08:38:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 179FC61211; Thu, 9 Jul 2020 10:38:23 +0200 (CEST) Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 664B261184 for ; Thu, 9 Jul 2020 10:38:21 +0200 (CEST) Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id D7C60100002; Thu, 9 Jul 2020 08:38:20 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 9 Jul 2020 10:41:26 +0200 Message-Id: <20200709084128.5316-19-jacopo@jmondi.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200709084128.5316-1-jacopo@jmondi.org> References: <20200709084128.5316-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 18/20] libcamera: ipu3: Calculate ImgU pipe configuration 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" Collect the ImgU device desired pipe configuration while assigning streams in the pipeline handler validate() function and ask the ImgUDevice class to calculate the pipe configuration parameters. If the requested pipe configuration results in a non-valid configuration, return an error from the validate() function. Signed-off-by: Jacopo Mondi Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/ipu3/ipu3.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 9a6e71514c90..72261d16e9f8 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -71,6 +71,7 @@ private: IPU3CameraData *data_; StreamConfiguration cio2Configuration_; + ImgUDevice::PipeConfig pipeConfig_; }; class PipelineHandlerIPU3 : public PipelineHandler @@ -179,6 +180,9 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate() LOG(IPU3, Debug) << "CIO2 configuration: " << cio2Configuration_.toString(); + ImgUDevice::Pipe pipe{}; + pipe.input = cio2Configuration_.size; + /* * Adjust the configurations if needed and assign streams while * iterating them. @@ -250,11 +254,13 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate() (oldCfg.size == yuvSize || outCount == 1)) { cfg.setStream(&data_->outStream_); mainOutputAvailable = false; + pipe.output = cfg.size; LOG(IPU3, Debug) << "Assigned " << cfg.toString() << " to the main output"; } else { cfg.setStream(&data_->vfStream_); + pipe.viewfinder = cfg.size; LOG(IPU3, Debug) << "Assigned " << cfg.toString() << " to the viewfinder output"; @@ -269,6 +275,13 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate() } } + pipeConfig_ = data_->imgu_->calculatePipeConfig(&pipe); + if (pipeConfig_.isNull()) { + LOG(IPU3, Error) << "Failed to calculate pipe configuration: " + << "unsupported resolutions."; + return Invalid; + } + return status; }