From patchwork Tue Dec 16 16:40:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 25570 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 C5A73C3274 for ; Tue, 16 Dec 2025 16:45:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DA94761A23; Tue, 16 Dec 2025 17:45:01 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="UCeNMICH"; dkim-atps=neutral Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AE44161A27 for ; Tue, 16 Dec 2025 17:44:59 +0100 (CET) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-42e33956e76so2267932f8f.3 for ; Tue, 16 Dec 2025 08:44:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1765903499; x=1766508299; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rHmpk8rHk/IlsYU76ryoqPKQ/4NYcVsL5LSqEDs/vLU=; b=UCeNMICHCLHJyrBw3CvzXDcn5kFpTz+mvwjXF6ek30H6naXaseWqSt/InWlV4twq7y whRqzCpDRzprj8QRmDqjFRRyQ1BM6KxpIX/qjy9WB9+TL/RsWtcsL9T26givTkAiWvmc 3W/ln2oxs+mBhwmIuyz2a2h3wwUhZ24ttCy5mHbKy5F6NYuuW4YGJI51XH+IWVh1T5IN +/9k+uzDK61wHVtZ7WL6Jo2F9I/uoL6FPsggbxEdP8Dn6YMyFv2U0K2WEHD2BXvoqlu8 iXLFue0BYDhNi15pL9FJV9+M0D3SIsWSAlSqXzZA1EHzXYHYBE9FOpNZmeJt1TndxO8z sbQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765903499; x=1766508299; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rHmpk8rHk/IlsYU76ryoqPKQ/4NYcVsL5LSqEDs/vLU=; b=CZ+Xm+B+xv3TIQvdKJMgNc/9ZcqbNXD76OoD1jOKRUNdBP3tzBFMu0NXPWEDNsOLna LHh48YE3ujWdEgQPOYgDqEG/xSJVXQTRJmuXP8J61reWYBDhFlXJ0ER/kQQfg7slYlBU SEPFy71h5goi2Pn8Kc2Jz4EqlEYPYHpB2AorN7I1CAN6QInk7AshKPk7Df2nbmPiKMgm KY7HiE/aqmXIMHgQhSn82uL6/sQXjnjio6UUN4kXwYgtZsFe8r2AZ8JS1zDSZuQ61TPw WtjLu1S+dq8Lihgk4mfL0a2ccv/F1Jnfi5oepq81zGoDcg9Y17X825tEUEHyHVidpkWq ZyNQ== X-Gm-Message-State: AOJu0YyX++a6nz58/0qgXNYKlItQKPOtYyoGZNgMH7r5//43crltVhtd 2fwb6SexkcauZg9bxp2umw8UKNaODppEoO0izCuBtbsiY48j6t9Zp8lcK9BnsnkWufI0k+/2sqX 2BDMh X-Gm-Gg: AY/fxX7m7ccqUfpCvRpQ5jFtUjt1h0fA8lZgbq9REaUX8Lh9pcbxTN4zJp/6+IxgyxN tzwvmV5IeQz5miLsyZalJeYzLVnDicdg1RUhHo6v9h5AYeUBsKEPDBApE3JHO4ELQuYBEDfUfB+ 4nShEO48jSTYB55zBTlPqHMUdgx3EGGnieOizPtFZB1xsjGZzRIzdluan//pvb07BpKMESY9Vcj UkwT+zlL1Sm1gyxe+owA2aJ9FZoEWjXi1vfWaAP4oZWMsbbafxroewkm80aCqRDzoenBxoHyN8+ 9DbFKGoG3X+kqyDV0eSvmmYDlIfVrDpW6+h6o/964e6JvyLr2nCiml2ziYeF4C477KWiHj5hSXE NMsHWEacUQT6y10iOHRhIykoyeCaVL0pdWZ/FocoRzwpqhwQeFfBwxeA5ESY+931Rsf2eywIU2N Ib3xasrdWJGM9p+xUvCKLreL0E0xIJABtSLAqGwH79u0DJ9Di8he7iMWSmHbhCGoehzqm4H287E lhPTxfKm/Q7cMxbQ9cXowqXbv0nUg== X-Google-Smtp-Source: AGHT+IHL2PR9VlDqz3d2k3DZMoF5AokydArinNH+yaSlR+W0szgANL2LuFCPaArXXZzQDFM1jhDNAA== X-Received: by 2002:a05:6000:2405:b0:430:f23f:4bbe with SMTP id ffacd0b85a97d-430f23f4e20mr14051928f8f.24.1765903498859; Tue, 16 Dec 2025 08:44:58 -0800 (PST) Received: from davidp-pi5.pitowers.org ([2a00:1098:3142:1f:88ea:c658:5b20:5e46]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4310ada856bsm26826f8f.3.2025.12.16.08.44.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Dec 2025 08:44:57 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: Peter Bailey , David Plowman , Naushir Patuck Subject: [PATCH v4 3/4] ipa: rpi: controller: Ignore algorithms that are not enabled Date: Tue, 16 Dec 2025 16:40:43 +0000 Message-ID: <20251216164451.13055-4-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251216164451.13055-1-david.plowman@raspberrypi.com> References: <20251216164451.13055-1-david.plowman@raspberrypi.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" From: Peter Bailey Algorithms may now contain an "enabled" field which can be set to false to disable it and prevent it from being loaded. If not present, algorithms are treated as enabled by default for backwards compatability. We additionally prevent duplicate versions of the same algorithm type (such as AWB) from loading, and flag an error. This will prevent undefined behaviour if (for example) two distinct AWB algorithms are trying to run simultaneously. Signed-off-by: Peter Bailey Reviewed-by: David Plowman Reviewed-by: Naushir Patuck --- src/ipa/rpi/controller/controller.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/ipa/rpi/controller/controller.cpp b/src/ipa/rpi/controller/controller.cpp index df45dcd3..88de6f36 100644 --- a/src/ipa/rpi/controller/controller.cpp +++ b/src/ipa/rpi/controller/controller.cpp @@ -145,6 +145,14 @@ int Controller::read(char const *filename) int Controller::createAlgorithm(const std::string &name, const YamlObject ¶ms) { + /* Any algorithm may be disabled by setting "enabled" to false. */ + bool enabled = params["enabled"].get(true); + LOG(RPiController, Debug) + << "Algorithm " << name << ": " + << (enabled ? "enabled" : "disabled"); + if (!enabled) + return 0; + auto it = getAlgorithms().find(name); if (it == getAlgorithms().end()) { LOG(RPiController, Warning) @@ -152,6 +160,16 @@ int Controller::createAlgorithm(const std::string &name, const YamlObject ¶m return 0; } + /* Do not allow duplicate versions of algorithms (e.g. AWB) to run. */ + size_t pos = name.find_last_of('.'); + std::string const &algoType = + pos == std::string::npos ? name : name.substr(pos + 1); + if (getAlgorithm(algoType)) { + LOG(RPiController, Error) + << "Algorithm type '" << algoType << "' already exists"; + return -1; + } + Algorithm *algo = (*it->second)(this); int ret = algo->read(params); if (ret)