From patchwork Tue Jan 13 00:08:08 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 25756 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 3E3BBC32C1 for ; Tue, 13 Jan 2026 00:09:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D68DC62016; Tue, 13 Jan 2026 01:09:29 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="qxmDYvT6"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7DAC26201E for ; Tue, 13 Jan 2026 01:09:28 +0100 (CET) Received: from pendragon.ideasonboard.com (81-175-209-152.bb.dnainternet.fi [81.175.209.152]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id CF60C50A for ; Tue, 13 Jan 2026 01:09:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1768262942; bh=W3sHbbdsGvkaqkKeqXqBvjANtmmt7NHoaPtTLcdrprU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qxmDYvT6IG1zyLHgDPm4ZjHTIwNEQQOiQh7kO91JfWjs1q8/AuYykglCjDhfeCvWJ j15FoJoT4756Il5eMBr2P+lrmlxMno5N8FO4wda63ddHKu3FF/YuCKe1g4wwfgLpRk IY/wpjD311C2nuM/X+xfqCdJzLMGZmVekus6SPWI= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 36/36] pipeline: simple: Turn devices configuration option into dictionary Date: Tue, 13 Jan 2026 02:08:08 +0200 Message-ID: <20260113000808.15395-37-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20260113000808.15395-1-laurent.pinchart@ideasonboard.com> References: <20260113000808.15395-1-laurent.pinchart@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" The pipelines.simple.devices configuration option contains a list of devices, each of them being a dictionary with a "driver" element that acts as a unique key to index the list. Turn it into a YAML dictionary to ensure uniqueness of the key, and simplify access in the pipeline handler. Signed-off-by: Laurent Pinchart --- This simplification will preclude indexing the list of devices with a compound key. For instance, if we were to extend the simple pipeline handler to match not only on a driver name but on a (driver, driver version) pair, the current configuration file structure would allow expressing this with pipelines: simple: devices: - driver: mxc-isi driver_version: 1 software_isp: true - driver: mxc-isi driver_version: 2 software_isp: false The new structure would conceptually allow us to write pipelines: simple: devices: ? driver: mxc-isi driver_version: 1 : software_isp: true ? driver: mxc-isi driver_version: 2 : software_isp: false For those not familiar with the explicit syntax for mappings, this would translate to the following Python data if dict objects were hashable in Python: { 'pipelines': { 'simple': { 'devices': { { 'driver': 'mxc-isi', 'driver_version': 1 }: { 'software_isp': True, }, { 'driver': 'mxc-isi', 'driver_version': 2 }: { 'software_isp': False, }, }, }, }, } Yes, YAML can use complex data as keys in mappings. I would really not want to have to support that in libcamera though. Opinions will be appreciated. --- Documentation/runtime_configuration.rst | 6 +++--- src/libcamera/pipeline/simple/simple.cpp | 20 +++++++++----------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Documentation/runtime_configuration.rst b/Documentation/runtime_configuration.rst index 19c2309ac94f..a904b09a1d35 100644 --- a/Documentation/runtime_configuration.rst +++ b/Documentation/runtime_configuration.rst @@ -44,7 +44,7 @@ file structure: pipelines: simple: devices: - - driver: # driver name, e.g. `mxc-isi` + # driver name, e.g. `mxc-isi`: software_isp: # true/false software_isp: copy_input_buffer: # true/false @@ -77,7 +77,7 @@ Configuration file example pipelines: simple: devices: - - driver: mxc-isi + mxc-isi: software_isp: true software_isp: copy_input_buffer: false @@ -139,7 +139,7 @@ LIBCAMERA__TUNING_FILE Example value: ``/usr/local/share/libcamera/ipa/rpi/vc4/custom_sensor.json`` -pipelines.simple.devices.driver, pipelines.simple.devices.software_isp +pipelines.simple.devices..software_isp Override whether software ISP is enabled for the given driver. Example `driver` value: ``mxc-isi`` diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 0ae9e081f01a..c949f3a69d16 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1879,18 +1879,16 @@ bool SimplePipelineHandler::matchDevice(std::shared_ptr media, } swIspEnabled_ = info.swIspEnabled; + const GlobalConfiguration &configuration = cameraManager()->_d()->configuration(); - for (GlobalConfiguration::Option entry : - configuration.configuration()["pipelines"]["simple"]["devices"] - .asList()) { - auto name = entry["driver"].get(); - if (name == info.driver) { - swIspEnabled_ = entry["software_isp"].get().value_or(swIspEnabled_); - LOG(SimplePipeline, Debug) - << "Configuration file overrides software ISP for " - << info.driver << " to " << swIspEnabled_; - break; - } + GlobalConfiguration::Option &cfg = + configuration.configuration()["pipelines"]["simple"]["devices"][info.driver]; + + if (cfg) { + swIspEnabled_ = cfg["software_isp"].get().value_or(swIspEnabled_); + LOG(SimplePipeline, Debug) + << "Configuration file overrides software ISP for " + << info.driver << " to " << swIspEnabled_; } /* Locate the sensors. */