From patchwork Tue Nov 25 16:28:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 25197 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 89D7CC333C for ; Tue, 25 Nov 2025 16:29:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3F61860AA9; Tue, 25 Nov 2025 17:29:50 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="c49g6m8j"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 49F5460AA9 for ; Tue, 25 Nov 2025 17:29:48 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:bae1:340c:573c:570b]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 4814813DE; Tue, 25 Nov 2025 17:27:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1764088059; bh=HfLvjKiNNLE6G9AXy7i70zO8RwYQ/+PKMZMMvzip0xI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c49g6m8jUxw+bi79WTL1MYRDjsCev16RQP+Yh7xDKEH17i2SqzzMt5R1G/FMINJKB Qhv5GIGC/mHqEbeDk4JVK4Q0JVv/SBXDLiOFrDLsaHjF6qN3mkmbys3yJhv9qycLON 9euCljBdTGq9BtTvPXSCP9/0TPfcNvmDbgmQVIGc= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v3 18/29] pipeline: rksip1: Move isRaw up in scope Date: Tue, 25 Nov 2025 17:28:30 +0100 Message-ID: <20251125162851.2301793-19-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251125162851.2301793-1-stefan.klug@ideasonboard.com> References: <20251125162851.2301793-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 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" In raw mode the number of configurations is actively limited to 1. It is therefore safe to move isRaw up one level to simplify the code and prepare for later use. During that rework it was noticed that the old code actually has a bug in that it reduces the number of configurations to 1 in case a raw config is found, but it doesn't reduce the config vector to that raw config, but the first config. Change that behavior to check the first config and either remove all remaining configs if the first is raw or drop all raw configs if the first is non-raw. Signed-off-by: Stefan Klug Reviewed-by: Kieran Bingham --- Changes in v3: - Added fix for cases where only one stream is requested - Fix adjustment in case of multiple configs - Small code cleanup --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 35 ++++++++++++------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 6256a67bc31e..a11d70849121 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -551,31 +551,30 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate() status = Adjusted; /* - * Simultaneous capture of raw and processed streams isn't possible. If - * there is any raw stream, cap the number of streams to one. + * Simultaneous capture of raw and processed streams isn't possible. + * Let the first stream decide on the type. */ - if (config_.size() > 1) { - for (const auto &cfg : config_) { - if (PixelFormatInfo::info(cfg.pixelFormat).colourEncoding == + bool isRaw = (PixelFormatInfo::info(config_[0].pixelFormat).colourEncoding == + PixelFormatInfo::ColourEncodingRAW); + if (isRaw) { + if (config_.size() > 1) { + config_.resize(1); + status = Adjusted; + } + } else { + /* Drop all raw configs. */ + for (auto it = config_.begin(); it != config_.end();) { + if (PixelFormatInfo::info(it->pixelFormat).colourEncoding == PixelFormatInfo::ColourEncodingRAW) { - config_.resize(1); + it = config_.erase(it); status = Adjusted; - break; + continue; } + ++it; } } - bool useDewarper = false; - if (pipe->dewarper_) { - /* - * Platforms with dewarper support, such as i.MX8MP, support - * only a single stream. We can inspect config_[0] only here. - */ - bool isRaw = PixelFormatInfo::info(config_[0].pixelFormat).colourEncoding == - PixelFormatInfo::ColourEncodingRAW; - if (!isRaw) - useDewarper = true; - } + bool useDewarper = (pipe->dewarper_ && !isRaw); /* * If there are more than one stream in the configuration figure out the