From patchwork Tue Jan 27 17:13:18 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 25981 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 D28E5C32E7 for ; Tue, 27 Jan 2026 17:15:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 103BA61FD5; Tue, 27 Jan 2026 18:15:20 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="nqmr3FwO"; dkim-atps=neutral Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C130361FBF for ; Tue, 27 Jan 2026 18:15:14 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4801d98cf39so45292845e9.1 for ; Tue, 27 Jan 2026 09:15:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1769534114; x=1770138914; 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=nqmr3FwOVkPhcyNo5qpum0sO/G4IolVFW5jdfZQhJEu3BB0ZISJXdyo3zQZr3LNvjK 35yD3Epua2hf7OzTG+WmPlOEvoDoH/q8EDyQL2t6HcBgEov1ec1kKJAFa4j9OAAYk5ta 04SbCuIhuHw002iV5CNLUdhENcrM112wBOiKGgWYeZkQQ8Y4Ynv2C0ubJO+7UmOV1t9r 2jlfWurtdX9Tp9xmsNWLTOqsKc2z/ZzGxzSKjTQ6bs/XyK8NUYCtf43W1D8QV0wfaUgE BGX8rGdG9jG9uu8eVg+2PZcTa81cwy+ONjlVgLYQLiz7MjgciRHa4gtkflyQopivMFsB +Pcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769534114; x=1770138914; 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=FXK+EY/atcc2+auHXUM5citE4asv6dtWO5O394dGLIdgCRZvAMCWCjrIp3jsTJ0zwc /uWRHE2NKaSiM/YGCyCAmXAm8UuJ7gAtmkhDJBJstyFNPpXNgVamHM1EshwczLIuWZlT ql30im6zFrG5niKYblnUNln0cDZMNvUCf2fDjUUFN+nwLceSMr3Vvyjvjd1yWIkERUS/ IqRcflNs4AoH1yGerX0Nt0D3EYQPp8IZ+G3t0WReDnzYar5hvTxzsg0oxMhgcbYq5rJq h0mGYOHsbDUKenZmaLaAy+GdXF/6nnptjyTRiQ+I0vFbVCjobVRP/lIaI0apmn1grhYS 4THA== X-Gm-Message-State: AOJu0YxvckKUkwsvV2vvVLHdcM5ZdyzWU+Ds0IT6FQxSXsyUd1WnK8/+ qPuXMYYNcY9PFLDStyzyGz6JpIBclHwQTEL/TEFCvTUIntxmcUa6srkQx2Cn/PXTiCdNZIW0oAZ ys3P3 X-Gm-Gg: AZuq6aJgNvwxGh+3Zl2Il4YKYjlPsYpIfljjC8bODzGTn3j4Wcu1b3bcz5CGkLeQwQC r0KB31OissSpJdvSWlmt1lf7vRghK7xabdnD5h4EaxrGvaX3OBv8QR4xlDdQktYPlpnvsDB2eCL Yhyr82iBPrg+knYsMp1XTAegpFWSlOs6DbWcb1hN+s8TlOA28Fc2/BWkHuXUUo1ictnmxK8VfBt 7Tu4oinaxNeFJy6kUpJ4iXYW92J/niB51lg8pet9Uuxbx3Q8iL+3VXC2L+XNl+9l5e2i0uGF5wh 3WBgbLKVEyVtDSc/fDvvNgL+wZYmuIcn90muHSfw0iwd4yUcO6HO5x6PaHoXHkKr0AgZcQCa4rt NWwWXgxrVlQgBuWoiYYRYnqbMj2I5PlCuIJjCnTaAN/gQWLWKWDKglBazaktIfN2/tyak9w9heF kJqMUtm4rsfuPXTZeuHKf9TDfNNrgRDWpsAe8zgwYYN3m/Q6QsXrmfZeRK8LJlMCVJjhmq7lXPW kjKYEkEwyIPMfwZcMPW17wkGPw82A== X-Received: by 2002:a05:600c:8b16:b0:480:1a9a:e571 with SMTP id 5b1f17b1804b1-48069c8c109mr28174895e9.22.1769534113730; Tue, 27 Jan 2026 09:15:13 -0800 (PST) Received: from davidp-pi5.pitowers.org ([2a00:1098:3142:1f:88ea:c658:5b20:5e46]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4806cddffe9sm12267865e9.4.2026.01.27.09.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 09:15:12 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: Peter Bailey , David Plowman , Naushir Patuck Subject: [PATCH v6 3/4] ipa: rpi: controller: Ignore algorithms that are not enabled Date: Tue, 27 Jan 2026 17:13:18 +0000 Message-ID: <20260127171506.17480-4-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260127171506.17480-1-david.plowman@raspberrypi.com> References: <20260127171506.17480-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)