From patchwork Thu Sep 24 14:51:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 9792 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 66DC6C3B5B for ; Thu, 24 Sep 2020 14:47:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4436A60367; Thu, 24 Sep 2020 16:47:58 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1A4DF60367 for ; Thu, 24 Sep 2020 16:47:56 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id AF1A324000C; Thu, 24 Sep 2020 14:47:55 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 24 Sep 2020 16:51:41 +0200 Message-Id: <20200924145143.117733-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200924145143.117733-1-jacopo@jmondi.org> References: <20200924145143.117733-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/3] libcamera: ipu3: Fix RAW+YUV capture 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" When requesting one RAW stream and one YUV stream the StreamConfiguration assigned to the RAW stream is the first one added to the CameraConfiguration, while the YUV stream gets assigned to the main output. At configure() time the viewfinder output needs to be configured with the same format as the main output, but since the introduction of RAW capture support, the pipeline has not been updated and still assumes the main output configuration is the first one in the CameraConfiguration. This causes the viewfinder to be configured with the same format as the raw stream, breaking capture operations. Before this commit the following command fails and the ImgU does not produce frames: cam -srole=stillraw -srole=viewfinder -c2 -C Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/pipeline/ipu3/ipu3.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 221259c7fe61..9cea6c7e9611 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -476,25 +476,23 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) return ret; /* Apply the format to the configured streams output devices. */ - bool outActive = false; - bool vfActive = false; + StreamConfiguration *mainCfg = nullptr; + StreamConfiguration *vfCfg = nullptr; for (unsigned int i = 0; i < config->size(); ++i) { StreamConfiguration &cfg = (*config)[i]; Stream *stream = cfg.stream(); if (stream == outStream) { + mainCfg = &cfg; ret = imgu->configureOutput(cfg, &outputFormat); if (ret) return ret; - - outActive = true; } else if (stream == vfStream) { + vfCfg = &cfg; ret = imgu->configureViewfinder(cfg, &outputFormat); if (ret) return ret; - - vfActive = true; } } @@ -503,14 +501,14 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) * the configuration of the active one for that purpose (there should * be at least one active stream in the configuration request). */ - if (!outActive) { - ret = imgu->configureOutput(config->at(0), &outputFormat); + if (!mainCfg) { + ret = imgu->configureOutput(*vfCfg, &outputFormat); if (ret) return ret; } - if (!vfActive) { - ret = imgu->configureViewfinder(config->at(0), &outputFormat); + if (!vfCfg) { + ret = imgu->configureViewfinder(*mainCfg, &outputFormat); if (ret) return ret; } @@ -529,7 +527,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) /* Apply the "pipe_mode" control to the ImgU subdevice. */ ControlList ctrls(imgu->imgu_->controls()); ctrls.set(V4L2_CID_IPU3_PIPE_MODE, - static_cast(vfActive ? IPU3PipeModeVideo : + static_cast(vfCfg ? IPU3PipeModeVideo : IPU3PipeModeStillCapture)); ret = imgu->imgu_->setControls(&ctrls); if (ret) { From patchwork Thu Sep 24 14:51:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 9793 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 D1F7EC3B5B for ; Thu, 24 Sep 2020 14:47:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 64AE663009; Thu, 24 Sep 2020 16:47:58 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A201860367 for ; Thu, 24 Sep 2020 16:47:56 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 42E1924000B; Thu, 24 Sep 2020 14:47:56 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 24 Sep 2020 16:51:42 +0200 Message-Id: <20200924145143.117733-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200924145143.117733-1-jacopo@jmondi.org> References: <20200924145143.117733-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/3] libcamera: ipu3: Remove dead code check 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" Since the re-implementation of the IPU3 pipeline handler configuration procedure, the main output is always assigned in case any YUV stream is requested. Remove a dead code block that checks for the main output to be valid. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/pipeline/ipu3/ipu3.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 9cea6c7e9611..477f85a45755 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -501,12 +501,6 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) * the configuration of the active one for that purpose (there should * be at least one active stream in the configuration request). */ - if (!mainCfg) { - ret = imgu->configureOutput(*vfCfg, &outputFormat); - if (ret) - return ret; - } - if (!vfCfg) { ret = imgu->configureViewfinder(*mainCfg, &outputFormat); if (ret) From patchwork Thu Sep 24 14:51:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 9794 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 7BAB4C3B5B for ; Thu, 24 Sep 2020 14:47:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D61B66300D; Thu, 24 Sep 2020 16:47:58 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 414F560363 for ; Thu, 24 Sep 2020 16:47:57 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id DA967240010; Thu, 24 Sep 2020 14:47:56 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 24 Sep 2020 16:51:43 +0200 Message-Id: <20200924145143.117733-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200924145143.117733-1-jacopo@jmondi.org> References: <20200924145143.117733-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/3] libcamera: ipu3: Adjust comment on ImgU 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" Be more precise in commenting why the ImgU shall not be configured if only the RAW stream is requested. As an example, if the ImgU gets unecessary configured: cam -srole=viewfinder -c2 -C -> WORKS cam -srole=stillraw -c2 -C -> WORKS cam -srole=viewfinder -c2 -C -> Failed to queue buffer 0: Invalid argument Since commit 1bd2e981a209 ("libcamera: ipu3: Fix RAW+YUV capture") the ImgU configuration procedure also correctly implements the assumption that at least one of the YUV output is being operated. If that's not the case, as in the RAW-only capture use case, the code tries to access a non-existing configuration. One more reason to exit early if no YUV stream is requested. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/pipeline/ipu3/ipu3.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 477f85a45755..2f90ad2e2780 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -459,9 +459,9 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) return ret; /* - * If the ImgU gets configured with proper IF, BDS and GDC sizes, it - * is then expected that frames are dequeued from its main output - * otherwise the system stalls. + * If the ImgU gets configured it is then expected that buffers are + * queued to its outputs, otherwise the next capture session + * that uses the ImgU fails at queueing buffers at its input. * * If no ImgU configuration has been computed, it means only a RAW * stream has been requested: return here to skip the ImgU configuration