From patchwork Tue Jan 27 11:59:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 25973 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 326B9C32E7 for ; Tue, 27 Jan 2026 12:06:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9D83F61FD9; Tue, 27 Jan 2026 13:06:13 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="SNNKOn+6"; dkim-atps=neutral Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 230F461FC5 for ; Tue, 27 Jan 2026 13:06:10 +0100 (CET) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-42fed090e5fso3409316f8f.1 for ; Tue, 27 Jan 2026 04:06:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1769515569; x=1770120369; 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=SNNKOn+6wWtIeTNUcFVKjx/idaFdAH6SbaBTfoqSsxzAobm1ZQcD/DhjytCXX+bVCR l2Sr6xr59NnBJQlAi1xGjssKmmAy6+0wISrQW2SPWgT+QuOCFowcIhnWsf6IypiPA4uS /tXZcZeYhU+yf2Eg+nm3pSOP93W+nbxvimjNsN5OeRXDlCU7WlRfyofCvpr20sSddkyY vcEUwSK0Q7CSO0ZDOrmCI3fPxhVkNXsKOU4NdvEiE+tmwoAR7zFPl+Y/KUWD70JBqUn9 uYgjdbB0vQchgAlzFprKQkCqFMguBaMGVExqOHQTdfBKXUMmRenA1G+fVgajG4zhi7Mw 2oTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769515569; x=1770120369; 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=sXlO99bQ99vOFnfh12gicZjV4RIzoP9Btbz/dU22g7QG61FzAuwM6P5A1XNUWlZe1z j8F7LiBORjizPIIACNzwNltiJP6e3y8SdbJNxLYVmffvNT/Mzk0dpc1mT253tUWuNO4J NBHhC1SKa30Hi2myxxi4zCcGg8zDWbuUV/1k3sx5Hu/JwanW63KsLdWbL7cxSX8WNoPw ZY/bVQi1TzVGPM3xVx+qD9hFRM/E5g/YSBFWDIBGxZgWmKXwLTtl6A6noSoL4eEqXSZl S/9Yqxi0eUlfaW7D3mRvkq9MZlSG1H9m2EBX4qNQFNbpFJVLdKW/eX97oGBLp9tSTFtm QFxw== X-Gm-Message-State: AOJu0YzLjwNy7qXkKGlfxtPRb7U7cTAclrd1dyMzzNdBhjlQSF0OSZXy /PeHR75aCmNbnnUaOAJ0AKbrPnYgZH/7HKPux4YWqYYAHMbZLWoQlPtCfbNSjCsP5cnLr0KhUYT tklOY X-Gm-Gg: AZuq6aJvdWKRBB2TRYAFUnbhGCH+YSNqQsFcZ+kjaoZfu4PQkdFncT6O9EHgzMhuprN BjGruBO86RkHUMWcECz3RHPU48Rd8O7lLNru1is6gniaXYDbM1nZSCung5GyDtJfnodTDi2PJA+ 6whxBWWmVJhRxUb1iw8XAv0oVwhQgQZhVAk6lWhwMtak5sY6wp4m65yfw4miYpbtcgAWAhqU8NZ X6eDFtpBRkmjdEQKqoP0yj16hOc7PvRupCClhj5EHdXKdnKUt5RLIOamXXiZVQLIjdii9zH8o6z 4T7XxkE1kPDTt6Y5jyVUcd33VeRoH/FajJPeTygttbryogiasRcPF5R5U59CniSXJrC+qXxz27U 8Urvc7I2aSwoWM/YmuLUTUc9zvRK5IATv34pMZGKhqrRY/WPPAZ0slQIHahrsorWM6Lwo7Ug1b+ fCJaoW8ED3HCgq9x6chMI96uEyOg8/O4rVTX1USjaz7PsZmFlKAdcDRkUUfM7OcKrBB6QF3+Kx+ GTLWHfmxOYdvin7YovC9VKvcVBXcA== X-Received: by 2002:a05:6000:26ce:b0:435:9325:4702 with SMTP id ffacd0b85a97d-435dd02f6efmr2083502f8f.21.1769515569097; Tue, 27 Jan 2026 04:06:09 -0800 (PST) Received: from davidp-pi5.pitowers.org ([2a00:1098:3142:1f:88ea:c658:5b20:5e46]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435b1c30293sm38221267f8f.19.2026.01.27.04.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 04:06:08 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: Peter Bailey , David Plowman , Naushir Patuck Subject: [PATCH v5 3/4] ipa: rpi: controller: Ignore algorithms that are not enabled Date: Tue, 27 Jan 2026 11:59:58 +0000 Message-ID: <20260127120604.6560-4-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260127120604.6560-1-david.plowman@raspberrypi.com> References: <20260127120604.6560-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)