{"id":25536,"url":"https://patchwork.libcamera.org/api/patches/25536/?format=json","web_url":"https://patchwork.libcamera.org/patch/25536/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20251212002937.3118-22-bryan.odonoghue@linaro.org>","date":"2025-12-12T00:29:32","name":"[v8,21/26] ipa: libipa: module: Add createSelfEnumeratingAlgorithm","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"38e6507477c1fd045567e6eda1925bf28e82b227","submitter":{"id":175,"url":"https://patchwork.libcamera.org/api/people/175/?format=json","name":"Bryan O'Donoghue","email":"bryan.odonoghue@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/25536/mbox/","series":[{"id":5657,"url":"https://patchwork.libcamera.org/api/series/5657/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5657","date":"2025-12-12T00:29:11","name":"Add GLES 2.0 GPUISP to libcamera","version":8,"mbox":"https://patchwork.libcamera.org/series/5657/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25536/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25536/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5E0B0BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 12 Dec 2025 00:34:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 13C3B61921;\n\tFri, 12 Dec 2025 01:34:30 +0100 (CET)","from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com\n\t[IPv6:2607:f8b0:4864:20::62a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A5C96191A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Dec 2025 01:34:28 +0100 (CET)","by mail-pl1-x62a.google.com with SMTP id\n\td9443c01a7336-29d7b019e0eso8862715ad.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Dec 2025 16:34:28 -0800 (PST)","from inspiron14p-linux (p99250-ipoefx.ipoe.ocn.ne.jp.\n\t[153.246.134.249]) by smtp.gmail.com with ESMTPSA id\n\t41be03b00d2f7-c0c26eb0f6bsm3317282a12.14.2025.12.11.16.34.24\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 11 Dec 2025 16:34:26 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"xBrRAmmE\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1765499667; x=1766104467;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=Ycci6C9edEvwR+DeR6OxjWNs4OeJb37qDGnfoes6rM0=;\n\tb=xBrRAmmEWsKS0SOk0kiEfngpGxlOBxB5EHGFNh0L8c5ECDz5c6A+d31VXDqQH47Xdx\n\thWkdJhnnQl337BSZ+D6RuQvzkkE0JQezKwosQj93hm42HH91VL1EVZrtoqOK+yfwhpVw\n\tpHuVKgpDL3W1j2dygYILxJZ3RKSnDHUReCNRutbm0ciQ5eD3EX+qZER2RPwXi2sV0l3p\n\toM/QYDoeF/Y+A3Vgp1q3b+y0L8ON0/ubMW0/LLjqwt1lPyjtvM7864Tnq3mdkmB1/C3B\n\tD6v3I4FH8o33csl0CPzsp51ico2EJR7rSYi/8z4d/w2IXfdAfVULIQxUBLlX18pTP0Ud\n\tbpqg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1765499667; x=1766104467;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=Ycci6C9edEvwR+DeR6OxjWNs4OeJb37qDGnfoes6rM0=;\n\tb=bgRo8/mhISEELJJdH9lX6yVvb283Of9ElFdy7jR3A9SX1cNexbEHxIkRJ1nAcieyY4\n\tvPg3L1LiqdOAQ30aCh3Ky+/r5wpJcX113nHMWFpqbY+15iAx5H1A6JaqG16u8Fyazbct\n\tpb0nu5/PbTC5OusQR0ZtMD3ID5ZsW/QJF6lipi9bo+8q9c0Ivj4yjNmAPLu51gjFdRjd\n\tuywAAq8lj3jXfQGyVBarJ+aKh3lUBgrSkoeLK+JTIWytMrVE4RSrZ6Y/4MicfPOTKmzy\n\tI1GqHYkjacX/qkYhja9BB5t8IERQ/XZiWrhMiz/yxz9DG3M84/cm4qNKqpsg5M+4QwEG\n\thSPg==","X-Gm-Message-State":"AOJu0YwhASMz3MTn1MJL5TzFW1x3CXwqW5WfEO1PF9/5fr86wGPWLd8C\n\ttytpYZRNMyed0y7l2NzZfxNF9KG5VLk+9DHuSLAsLlYy/L3fer1p7eqgqXfyookUk9bsmn14RHk\n\trg68K","X-Gm-Gg":"AY/fxX7XKTii9fpnawheHFmw65cke8/GvLBL3tUA0a7328qOctsvvHNSIKHtJd6v51Z\n\tH3PxqE1q9MvVEIVTrBi7s3P1lxexAsdQANFW4G15mdM+aHDn0rNsO1fez2MK2XkH5qoVUvrUbO6\n\tP18YelX2VeqTnDMF9YflFhR5SSfHCymfOvBLVBIwlEFgXty7mGZXPx+br2DVI3eB5Ie9s1SZ9gH\n\thJgXRNXJmwxV+oGLcHn0ZxwsVbkLD2LMSmJqNkWsIqttgoY9IZwTFTiRJMPP/VHEfkdQLJUttzJ\n\tcCcTBwUpjikdM5USbLDiiGHvrydXdZeDih0WesY3lVayisL0ccZUSMyhaGk2YJydRgxQaeTA8Gd\n\tSjeO7/Jd8tfg3d1QPConUcB53GdbjuT6LoF6AfBZx8q19MOzZjBUgS0hbIrLWo7f5cEqj6BwUmm\n\tZH342I3UDjULIRRbQbeTKsycq4s3m4dxGivFqJ94M9HB5bR/dUzPRJyiUVszE=","X-Google-Smtp-Source":"AGHT+IHV5VCJNqj3JYE+QpyY+8THgMODQGOIohct7Qg7gtevkrlR94MTuRVkrwofdF1NkhLnAEzSVQ==","X-Received":"by 2002:a05:6a21:e097:b0:35d:8881:e6ce with SMTP id\n\tadf61e73a8af0-369ae1a9b3fmr288711637.26.1765499666503; \n\tThu, 11 Dec 2025 16:34:26 -0800 (PST)","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"pavel@ucw.cz,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>","Subject":"[PATCH v8 21/26] ipa: libipa: module: Add\n\tcreateSelfEnumeratingAlgorithm","Date":"Fri, 12 Dec 2025 00:29:32 +0000","Message-ID":"<20251212002937.3118-22-bryan.odonoghue@linaro.org>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20251212002937.3118-1-bryan.odonoghue@linaro.org>","References":"<20251212002937.3118-1-bryan.odonoghue@linaro.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Create an algorithm without having YAML data input.\n\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n src/ipa/libipa/module.cpp | 34 ++++++++++++++++++++++++++++\n src/ipa/libipa/module.h   | 47 +++++++++++++++++++++++++++++----------\n 2 files changed, 69 insertions(+), 12 deletions(-)","diff":"diff --git a/src/ipa/libipa/module.cpp b/src/ipa/libipa/module.cpp\nindex a95dca696..41235f902 100644\n--- a/src/ipa/libipa/module.cpp\n+++ b/src/ipa/libipa/module.cpp\n@@ -83,6 +83,40 @@ namespace ipa {\n  * \\return The list of instantiated algorithms\n  */\n \n+/**\n+ * \\fn int Module::createSelfEnumeratingAlgorithm(Context &context, const std::string &name)\n+ * \\brief Create and initialise a self-enumerating algorithm by name\n+ *\n+ * This function creates an algorithm instance from the registered algorithm\n+ * factories using only the algorithm name, without requiring YAML configuration\n+ * data.\n+ *\n+ * This is useful for algorithms that don't require external configuration\n+ * parameters and can self-configure or use default values.\n+ *\n+ * \\param[in] context The IPA context to pass to the algorithm's init function\n+ * \\param[in] name The name of the algorithm to instantiate\n+ *\n+ * \\return 0 on success, negative errno value on failure:\n+ *         -EINVAL if the algorithm is not found in the factory registry\n+ *         Other negative values if algorithm initialisation fails\n+ */\n+\n+/**\n+ * \\fn int Module::createAlgorithmCommon(Context &context, const YamlObject &algoData, const std::string &name)\n+ * \\brief Common helper fucntion to allow createSelfEnumeratingAlgorithm and createAlgorithm share code\n+ *\n+ * Worker method which allows sharing of common code in the Yaml and self-initialising algorithm case\n+ *\n+ * \\param[in] context The IPA context to pass to the algorithm's init function\n+ * \\param[in] algoData Yaml object.\n+ * \\param[in] name The name of the algorithm to instantiate\n+ *\n+ * \\return 0 on success, negative errno value on failure:\n+ *         -EINVAL if the algorithm is not found in the factory registry\n+ *         Other negative values if algorithm initialisation fails\n+ */\n+\n /**\n  * \\fn Module::createAlgorithms()\n  * \\brief Create algorithms from YAML configuration data\ndiff --git a/src/ipa/libipa/module.h b/src/ipa/libipa/module.h\nindex c27af7718..5ab6afc18 100644\n--- a/src/ipa/libipa/module.h\n+++ b/src/ipa/libipa/module.h\n@@ -70,22 +70,26 @@ public:\n \t\tfactories().push_back(factory);\n \t}\n \n-private:\n-\tint createAlgorithm(Context &context, const YamlObject &data)\n+\tint createSelfEnumeratingAlgorithm(Context &context, const std::string &name)\n \t{\n-\t\tconst auto &[name, algoData] = *data.asDict().begin();\n+\t\tYamlObject dummy;\n \n-\t\t/*\n-\t\t * Optionally, algorithms can be disabled via the tuning file\n-\t\t * by including enabled: false as a parameter within the\n-\t\t * algorithm tuning data. This is not an error, so we return 0.\n-\t\t */\n-\t\tif (!algoData[\"enabled\"].get<bool>(true)) {\n-\t\t\tLOG(IPAModuleAlgo, Info)\n-\t\t\t\t<< \"Algorithm '\" << name << \"' disabled via tuning file\";\n-\t\t\treturn 0;\n+\t\tstd::unique_ptr<Algorithm<Module>> algo = createAlgorithm(name);\n+\t\tif (!algo) {\n+\t\t\tLOG(IPAModuleAlgo, Error)\n+\t\t\t\t<< \"Algorithm '\" << name << \"' not found\";\n+\t\t\treturn -EINVAL;\n \t\t}\n \n+\t\tcontext.selfInitialising = true;\n+\n+\t\treturn createAlgorithmCommon(context, dummy, name);\n+\t}\n+\n+private:\n+\n+\tint createAlgorithmCommon(Context &context, const YamlObject &algoData, const std::string &name)\n+\t{\n \t\tstd::unique_ptr<Algorithm<Module>> algo = createAlgorithm(name);\n \t\tif (!algo) {\n \t\t\tLOG(IPAModuleAlgo, Error)\n@@ -104,9 +108,28 @@ private:\n \t\t\t<< \"Instantiated algorithm '\" << name << \"'\";\n \n \t\talgorithms_.push_back(std::move(algo));\n+\n \t\treturn 0;\n \t}\n \n+\tint createAlgorithm(Context &context, const YamlObject &data)\n+\t{\n+\t\tconst auto &[name, algoData] = *data.asDict().begin();\n+\n+\t\t/*\n+\t\t * Optionally, algorithms can be disabled via the tuning file\n+\t\t * by including enabled: false as a parameter within the\n+\t\t * algorithm tuning data. This is not an error, so we return 0.\n+\t\t */\n+\t\tif (!algoData[\"enabled\"].get<bool>(true)) {\n+\t\t\tLOG(IPAModuleAlgo, Info)\n+\t\t\t\t<< \"Algorithm '\" << name << \"' disabled via tuning file\";\n+\t\t\treturn 0;\n+\t\t}\n+\n+\t\treturn createAlgorithmCommon(context, algoData, name);\n+\t}\n+\n \tstatic std::unique_ptr<Algorithm<Module>> createAlgorithm(const std::string &name)\n \t{\n \t\tfor (const AlgorithmFactoryBase<Module> *factory : factories()) {\n","prefixes":["v8","21/26"]}