From patchwork Thu Jul 9 08:41:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 8697 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 BEF8BBDB1C for ; Thu, 9 Jul 2020 08:38:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 66DCD611AA; Thu, 9 Jul 2020 10:38:12 +0200 (CEST) Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5096B61169 for ; Thu, 9 Jul 2020 10:38:10 +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 6F205100015; Thu, 9 Jul 2020 08:38:08 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 9 Jul 2020 10:41:14 +0200 Message-Id: <20200709084128.5316-7-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 06/20] libcamera: ipu3: Report StreamFormats 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" Report StreamFormats associated to each StreamConfiguration generated by the IPU3 pipeline handler. The StreamFormats are generated differently for RAW and processed streams, with the former using the sensor enumerated resolutions and the latter using a continuous range of sizes constructed by matching the sensor capabilities with the platform constraints. Reviewed-by: Niklas Söderlund Signed-off-by: Jacopo Mondi --- src/libcamera/pipeline/ipu3/ipu3.cpp | 50 ++++++++++++++++++---------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 978a6e58c72f..d27acb405a1d 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -306,7 +306,10 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera, Size sensorResolution = data->cio2_.sensor()->resolution(); for (const StreamRole role : roles) { - StreamConfiguration cfg = {}; + std::map> streamFormats; + unsigned int bufferCount; + PixelFormat pixelFormat; + Size size; switch (role) { case StreamRole::StillCapture: @@ -314,20 +317,27 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera, * Use the sensor resolution aligned to the ImgU * output constraints. */ - cfg.size.width = std::min(sensorResolution.width, - IPU3_OUTPUT_MAX_WIDTH); - cfg.size.height = std::min(sensorResolution.height, - IPU3_OUTPUT_MAX_HEIGHT); - cfg.size.width &= ~IPU3_OUTPUT_WIDTH_ALIGN; - cfg.size.height &= ~IPU3_OUTPUT_HEIGHT_ALIGN; - cfg.pixelFormat = formats::NV12; - cfg.bufferCount = IPU3_BUFFER_COUNT; + size.width = std::min(sensorResolution.width, + IPU3_OUTPUT_MAX_WIDTH); + size.height = std::min(sensorResolution.height, + IPU3_OUTPUT_MAX_HEIGHT); + size.width &= ~IPU3_OUTPUT_WIDTH_ALIGN; + size.height &= ~IPU3_OUTPUT_HEIGHT_ALIGN; + pixelFormat = formats::NV12; + bufferCount = IPU3_BUFFER_COUNT; + streamFormats[pixelFormat] = { { minIPU3OutputSize, size } }; break; case StreamRole::StillCaptureRaw: { - cfg = data->cio2_.generateConfiguration(sensorResolution); - cfg.bufferCount = 1; + StreamConfiguration cio2Config = + data->cio2_.generateConfiguration(sensorResolution); + pixelFormat = cio2Config.pixelFormat; + size = cio2Config.size; + bufferCount = cio2Config.bufferCount; + + for (const PixelFormat &format : data->cio2_.formats()) + streamFormats[format] = data->cio2_.sizes(); break; } @@ -339,12 +349,13 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera, * sensor resolution and aligned to the ImgU output * constraints. */ - cfg.size.width = std::min(1280U, sensorResolution.width); - cfg.size.height = std::min(720U, sensorResolution.height); - cfg.size.width &= ~IPU3_OUTPUT_WIDTH_ALIGN; - cfg.size.height &= ~IPU3_OUTPUT_HEIGHT_ALIGN; - cfg.pixelFormat = formats::NV12; - cfg.bufferCount = IPU3_BUFFER_COUNT; + size.width = std::min(1280U, sensorResolution.width); + size.height = std::min(720U, sensorResolution.height); + size.width &= ~IPU3_OUTPUT_WIDTH_ALIGN; + size.height &= ~IPU3_OUTPUT_HEIGHT_ALIGN; + pixelFormat = formats::NV12; + bufferCount = IPU3_BUFFER_COUNT; + streamFormats[pixelFormat] = { { minIPU3OutputSize, size } }; break; } @@ -356,6 +367,11 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera, return nullptr; } + StreamFormats formats(streamFormats); + StreamConfiguration cfg(formats); + cfg.size = size; + cfg.pixelFormat = pixelFormat; + cfg.bufferCount = bufferCount; config->addConfiguration(cfg); }