From patchwork Thu Nov 12 14:12:13 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 28876 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 1CB3BC3307 for ; Thu, 12 Nov 2026 14:12:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 04D9E69213; Thu, 12 Nov 2026 15:12:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="t1gYBd5T"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4591E6910C for ; Thu, 12 Nov 2026 15:12:29 +0100 (CET) Received: from ideasonboard.com (93-46-82-201.ip106.fastwebnet.it [93.46.82.201]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 23260219; Thu, 12 Nov 2026 15:10:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1794492605; bh=he6OjCxOMTlxc0+ReP8o3Mwu7ww0KeUI3rppXbJEoYU=; h=From:To:Cc:Subject:Date:From; b=t1gYBd5TSv+iVH14vOKNPDbX8SMnS9HhOWqdXimHF4NyuUhVKu3wFrk79yNi9qFq0 DHZIk8mJaf53hT7Ft4KW1TrdXV+Qtn67fVtoF42HGCY0ktWPtyT2czUsCE+5DJaH9L Nh8MzGOWFp155ufrRlSgd/Idlclb4Pj1ReIGt2oo= From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi Subject: [PATCH] libcamera: rkisp1: Ensure a raw format is found with sensorConfig Date: Thu, 12 Nov 2026 15:12:13 +0100 Message-ID: <20261112141214.976332-1-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.56.0 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" The RkISP1Path::validate() function walks the list of all available formats at the ISP output to ensure the supplied StreamConfiguration has a valid pixelformat, or adjust it a supported one in case it doesn't. When a sensorConfig is specified, the selection of the sensor format is restricted by the attributes of the supplied sensorConfig itself and the presence of a valid rawFormat is required in the rest of the function. Currently, whenever a valid pixel format is found, the loop is interrupted, risking the rawFormat variable to remain non initialized. This causes the validate() function to bail out if a sensor config is specified. So far the issue when unnoticed as 10bits and 12bits raw format are enumerated, by chance, before processed formats, and once the loop exists because a valid processed format has been found, rawFormat had been initialized already. 8bits formats instead are enumerated, again by chance, after the processed formats, and when the loop exists rawFormat is not initialized, preventing the camera to operate with any 8 bit format. Fix this by walking all supported formats even if the pixel format has been found to ensure rawFormat is initialized when a sensorConfig is specified. Signed-off-by: Jacopo Mondi --- I'm not 100% happy with this as I think the usage of rawFormat and the fact it is populated during the validation of the StreamConfiguration pixelformat is not correct. However, considering this part of the code has been there for a long time, and I'm the first one hitting any error, just make sure we support all sensor bit depths instead of rewriting the function completely. --- --- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.56.0 diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index 20157337022e..013e72d1aed4 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -304,7 +304,12 @@ RkISP1Path::validate(const CameraSensor *sensor, if (cfg->pixelFormat == format) { found = true; - break; + /* + * If a sensorConfig has been specified, continue walking + * all supported formats to find a valid 'rawFormat'. + */ + if (!sensorConfig) + break; } }