From patchwork Thu Oct 29 17:35:21 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 28718 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 7F92FC324C for ; Thu, 29 Oct 2026 17:35:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 99980690ED; Thu, 29 Oct 2026 18:35:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="XUTApUJJ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 995FD690A0 for ; Thu, 29 Oct 2026 18:35:29 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:4541:9fd7:2e8b:39e0]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E57284DC; Thu, 29 Oct 2026 18:33:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1793295196; bh=2ezpdunHHLrW8GMhh3kLR6mO/UYmqxD9ThRddan1lPM=; h=From:To:Cc:Subject:Date:From; b=XUTApUJJ2FaB2fZ+YwsgGH//UxtwJBEVj408jFee2igaucGN9w7N/Rf6b5MMjmuxG 5WBtfv/zuK0TJhxoM4uVpjLqMvrcEHFPNXhucndJvG+1K0NNFOQWOr5sjmZSOUKqpc jqLdb3ypupWiV20eW4eOhABlec0f6BVAlzhu6aig= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [RFC PATCH] libcamera: Increment tuning file format version to 2 Date: Thu, 29 Oct 2026 18:35:21 +0100 Message-ID: <20261029173524.1213552-1-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.53.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" Because of commit 974102049a41 ("libcamera: controls: Remove common enum prefix") the format of the tuning files changed in a backwards incompatible way. To make that very transparent to the users, increment the required tuning file version so that a old tuning file results in an error. Apply these checks to ipu3, mali-c55, rkisp1 and softisp. For user reading this due to the error: To migrate from version 1 to version 2, increment the version entry to 2 and drop the prefix from the following entries: - MeteringCentreWeighted - MeteringSpot - MeteringMatrix - ExposureNormal - ExposureShort - ConstraintNormal - ConstraintHighlight - AwbAuto - AwbIncandescent - AwbTungsten - AwbFluorescent - AwbIndoor - AwbDaylight - AwbCloudy Signed-off-by: Stefan Klug --- Hi all, I'm not super happy with this patch (hence the RFC) but at least it loudly warns the users. The problems are: - Again more code duplication. But given that we have no central tuning file loading logic this might be acceptable - It errors out in many cases where the tuning files might actually be compatible. E.g. if the tuning file only use the grey world awb. But checking for that specifically would be way more work - It is only compile tested Feedback welcome. Best regards, Stefan --- src/ipa/ipu3/data/uncalibrated.yaml | 2 +- src/ipa/ipu3/ipu3.cpp | 6 ++++-- src/ipa/mali-c55/data/imx415.yaml | 2 +- src/ipa/mali-c55/data/uncalibrated.yaml | 2 +- src/ipa/mali-c55/mali-c55.cpp | 9 +++++++++ src/ipa/rkisp1/data/imx219.yaml | 2 +- src/ipa/rkisp1/data/imx258.yaml | 2 +- src/ipa/rkisp1/data/mira220.yaml | 2 +- src/ipa/rkisp1/data/ov2685.yaml | 2 +- src/ipa/rkisp1/data/ov4689.yaml | 2 +- src/ipa/rkisp1/data/ov5640.yaml | 2 +- src/ipa/rkisp1/data/ov5695.yaml | 2 +- src/ipa/rkisp1/data/ov8858.yaml | 2 +- src/ipa/rkisp1/rkisp1.cpp | 6 ++++-- src/ipa/softisp/data/uncalibrated.yaml | 2 +- src/ipa/softisp/softisp.cpp | 8 ++++++++ utils/tuning/libtuning/generators/yaml_output.py | 4 ++-- 17 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/ipa/ipu3/data/uncalibrated.yaml b/src/ipa/ipu3/data/uncalibrated.yaml index 415ca4578fab..d17189aa467d 100644 --- a/src/ipa/ipu3/data/uncalibrated.yaml +++ b/src/ipa/ipu3/data/uncalibrated.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 %YAML 1.1 --- -version: 1 +version: 2 algorithms: - Af: - Agc: diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 30d52cfcf9c6..0294e7f92908 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -249,9 +249,11 @@ int IPAIPU3::init(const IPASettings &settings, return -EINVAL; unsigned int version = (*data)["version"].get(0); - if (version != 1) { + if (version != 2) { LOG(IPAIPU3, Error) - << "Invalid tuning file version " << version; + << "The tuning file " << settings.configurationFile + << " is version " << version + << " but version 2 is required"; return -EINVAL; } diff --git a/src/ipa/mali-c55/data/imx415.yaml b/src/ipa/mali-c55/data/imx415.yaml index 126b427af339..3a1e71098297 100644 --- a/src/ipa/mali-c55/data/imx415.yaml +++ b/src/ipa/mali-c55/data/imx415.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 %YAML 1.1 --- -version: 1 +version: 2 algorithms: - Agc: - Awb: diff --git a/src/ipa/mali-c55/data/uncalibrated.yaml b/src/ipa/mali-c55/data/uncalibrated.yaml index ea44c58c9efb..df4060d2f9d0 100644 --- a/src/ipa/mali-c55/data/uncalibrated.yaml +++ b/src/ipa/mali-c55/data/uncalibrated.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 %YAML 1.1 --- -version: 1 +version: 2 algorithms: - Agc: - Awb: diff --git a/src/ipa/mali-c55/mali-c55.cpp b/src/ipa/mali-c55/mali-c55.cpp index 9a2918cf2cf1..22ad10e3bcfa 100644 --- a/src/ipa/mali-c55/mali-c55.cpp +++ b/src/ipa/mali-c55/mali-c55.cpp @@ -114,6 +114,15 @@ int IPAMaliC55::init(const IPASettings &settings, const IPAConfigInfo &ipaConfig if (!data) return -EINVAL; + unsigned int version = (*data)["version"].get(0); + if (version != 2) { + LOG(IPAMaliC55, Error) + << "The tuning file " << settings.configurationFile + << " is version " << version + << " but version 2 is required"; + return -EINVAL; + } + if (!data->contains("algorithms")) { LOG(IPAMaliC55, Error) << "Tuning file doesn't contain any algorithm"; diff --git a/src/ipa/rkisp1/data/imx219.yaml b/src/ipa/rkisp1/data/imx219.yaml index 0d99cb529392..033484a991f4 100644 --- a/src/ipa/rkisp1/data/imx219.yaml +++ b/src/ipa/rkisp1/data/imx219.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 %YAML 1.1 --- -version: 1 +version: 2 algorithms: - Agc: - Awb: diff --git a/src/ipa/rkisp1/data/imx258.yaml b/src/ipa/rkisp1/data/imx258.yaml index 202af36afbee..77eda84f3f03 100644 --- a/src/ipa/rkisp1/data/imx258.yaml +++ b/src/ipa/rkisp1/data/imx258.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 %YAML 1.1 --- -version: 1 +version: 2 algorithms: - Agc: - Awb: diff --git a/src/ipa/rkisp1/data/mira220.yaml b/src/ipa/rkisp1/data/mira220.yaml index 4751d311a84b..dc9798860d38 100644 --- a/src/ipa/rkisp1/data/mira220.yaml +++ b/src/ipa/rkisp1/data/mira220.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 %YAML 1.1 --- -version: 1 +version: 2 algorithms: - Agc: AeMeteringMode: diff --git a/src/ipa/rkisp1/data/ov2685.yaml b/src/ipa/rkisp1/data/ov2685.yaml index fdfc98d35267..a110d4ea811a 100644 --- a/src/ipa/rkisp1/data/ov2685.yaml +++ b/src/ipa/rkisp1/data/ov2685.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 %YAML 1.1 --- -version: 1 +version: 2 algorithms: - Agc: - Awb: diff --git a/src/ipa/rkisp1/data/ov4689.yaml b/src/ipa/rkisp1/data/ov4689.yaml index 609012967e02..2847ed0f8ef4 100644 --- a/src/ipa/rkisp1/data/ov4689.yaml +++ b/src/ipa/rkisp1/data/ov4689.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 %YAML 1.1 --- -version: 1 +version: 2 algorithms: - Agc: - Awb: diff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml index 4b21d412e44e..e5e0538a7071 100644 --- a/src/ipa/rkisp1/data/ov5640.yaml +++ b/src/ipa/rkisp1/data/ov5640.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 %YAML 1.1 --- -version: 1 +version: 2 algorithms: - Agc: - Awb: diff --git a/src/ipa/rkisp1/data/ov5695.yaml b/src/ipa/rkisp1/data/ov5695.yaml index 2e39e3a59b3f..7955463cb417 100644 --- a/src/ipa/rkisp1/data/ov5695.yaml +++ b/src/ipa/rkisp1/data/ov5695.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 %YAML 1.1 --- -version: 1 +version: 2 algorithms: - Agc: - Awb: diff --git a/src/ipa/rkisp1/data/ov8858.yaml b/src/ipa/rkisp1/data/ov8858.yaml index f297b0e0e8d2..0401d420102f 100644 --- a/src/ipa/rkisp1/data/ov8858.yaml +++ b/src/ipa/rkisp1/data/ov8858.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 %YAML 1.1 --- -version: 1 +version: 2 algorithms: - Agc: - Awb: diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 79ab7338c140..bc200c603361 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -181,9 +181,11 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision, return -EINVAL; unsigned int version = (*data)["version"].get(0); - if (version != 1) { + if (version != 2) { LOG(IPARkISP1, Error) - << "Invalid tuning file version " << version; + << "The tuning file " << settings.configurationFile + << " is version " << version + << " but version 2 is required"; return -EINVAL; } diff --git a/src/ipa/softisp/data/uncalibrated.yaml b/src/ipa/softisp/data/uncalibrated.yaml index fc90ca526eab..f7a8144f12af 100644 --- a/src/ipa/softisp/data/uncalibrated.yaml +++ b/src/ipa/softisp/data/uncalibrated.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 %YAML 1.1 --- -version: 1 +version: 2 algorithms: - BlackLevel: - Awb: diff --git a/src/ipa/softisp/softisp.cpp b/src/ipa/softisp/softisp.cpp index 00249a300430..1b7de1ed5f64 100644 --- a/src/ipa/softisp/softisp.cpp +++ b/src/ipa/softisp/softisp.cpp @@ -129,6 +129,14 @@ int IPASoftIsp::init(const IPASettings &settings, unsigned int version = (*data)["version"].get(0); LOG(IPASoftIsp, Debug) << "Tuning file version " << version; + if (version != 2) { + LOG(IPASoftIsp, Error) + << "The tuning file " << settings.configurationFile + << " is version " << version + << " but version 2 is required"; + return -EINVAL; + } + if (!data->contains("algorithms")) { LOG(IPASoftIsp, Error) << "Tuning file doesn't contain algorithms"; return -EINVAL; diff --git a/utils/tuning/libtuning/generators/yaml_output.py b/utils/tuning/libtuning/generators/yaml_output.py index c490081d7de7..2da122e5ec17 100644 --- a/utils/tuning/libtuning/generators/yaml_output.py +++ b/utils/tuning/libtuning/generators/yaml_output.py @@ -99,10 +99,10 @@ class YamlOutput(Generator): out_lines = [ '%YAML 1.1', '---', - 'version: 1', + 'version: 2', # No need to condition this, as libtuning already guarantees that # we have at least one module. Even if the module has no output, - # its prescence is meaningful. + # its presence is meaningful. 'algorithms:' ]