Patch Detail
Show a patch.
GET /api/patches/24555/?format=api
{ "id": 24555, "url": "https://patchwork.libcamera.org/api/patches/24555/?format=api", "web_url": "https://patchwork.libcamera.org/patch/24555/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20251003-ipa-match-by-name-v1-1-07b796729412@ideasonboard.com>", "date": "2025-10-03T09:27:29", "name": "[1/2] libcamera: ipa_manager: Create IPA by name", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "05648102569226d4447806e4041dcdeb2343c954", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/24555/mbox/", "series": [ { "id": 5476, "url": "https://patchwork.libcamera.org/api/series/5476/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5476", "date": "2025-10-03T09:27:28", "name": "ipa: Allow IPA creation by name", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5476/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/24555/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/24555/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 DEF4EC324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 3 Oct 2025 09:27:46 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C4F556B5F9;\n\tFri, 3 Oct 2025 11:27:43 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3A17B6B5AA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 3 Oct 2025 11:27:40 +0200 (CEST)", "from [192.168.1.102] (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1C0A7192C;\n\tFri, 3 Oct 2025 11:26:09 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"rpY9fhP3\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759483569;\n\tbh=Tio1HnJsOEkAzB7FOLUBX3fYB+IYgd/qhN+aRkvb1VA=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=rpY9fhP3D50QXCYvFNTpK9K2578+y85TZC+oA2R1nBtaZX6Yx9d3Cr90gRybXxkih\n\tI8kohY3H7z9r39hyCvm7mAQL5ColcFfO9Lj/2fO/vHAljIoYDkPkl9IWxL09QKzFjI\n\tVBRQor/Z1+jc5k14Pbm9R1LE2wgXjQugZkxvGczk=", "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Date": "Fri, 03 Oct 2025 11:27:29 +0200", "Subject": "[PATCH 1/2] libcamera: ipa_manager: Create IPA by name", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20251003-ipa-match-by-name-v1-1-07b796729412@ideasonboard.com>", "References": "<20251003-ipa-match-by-name-v1-0-07b796729412@ideasonboard.com>", "In-Reply-To": "<20251003-ipa-match-by-name-v1-0-07b796729412@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org, =?utf-8?q?Niklas_S=C3=B6derlund?=\n\t<niklas.soderlund+renesas@ragnatech.se>, Hans de Goede <hansg@kernel.org>", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tHans de Goede <hdegoede@redhat.com>", "X-Mailer": "b4 0.14.2", "X-Developer-Signature": "v=1; a=openpgp-sha256; l=7741;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=Mo63Cm+l8CW7VIPGbO2wATJIGFnPTW3jWDf7gAs6yBY=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBo35cKTMt+/OA1AgpT7Gw8Za7lpiqOGsxlMfPyG\n\t6lcQQOnBaOJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaN+XCgAKCRByNAaPFqFW\n\tPPkjD/4mICSpFOWIu2VRXIuRGYP0I4vGkmJQ0OmoLBHeIqhNdXe1Pv/BXlIQoPPQeV4xTMPd/4r\n\tI5BkvmXN/ozQ/NumVHLvARGHpmdSuggzZHaql4dYk9eLN4ektcB/LEf8zHaMGu2vfYxsW/7Hu1M\n\tZInTekdizhrx4fwGcikI2E+2fVvpjXm3r25YzQUE6S7y8AeHcESk4OSxBA1W+Kgc2UaHhy4Ui7a\n\tgJWIIQRVjvuR3qMzwPAS+RQwTRgeZ+XJ6fdVWe9s6BbIKZFliv+vGz59XTZnlIpXxo9q2FBdP9c\n\tbmlxSdUl+onYa/XgN85YVCQA5EoRplhIRCoo9YiSmFhfPtJatF3nchjkgF7fdXicpLVpCH3Ueex\n\t+wbcZs49DimMKB8cicaU5sFVy66wQUDwYQMiUrxPeL7f0gdVmXiwWwGUCk5PD+MZfVLJ67rtBBQ\n\tIZsWJhl0ZK/Yd485BAWAeIAfks3uNKi4RpPXKo18ROgeDoWSUE+Rss5qD89724mEVKXG0tDf2pp\n\tuQZEh4iEgb9Pob5qZ1wDrM80riFjxV7f5yYrC48Xj1DG67iNkKN09b8I1byAlVjUzvbjwXc1htF\n\tqw8b/JOK4xxoOPBorJTl1hUnWwkdY+G8fDZ5G41HNFU9yEhnO7nvTfwnYe/loHTUSUPzdEuRck0\n\tYCnhLSGHWVwB/ig==", "X-Developer-Key": "i=jacopo.mondi@ideasonboard.com; a=openpgp;\n\tfpr=72392EDC88144A65C701EA9BA5826A2587AD026B", "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": "From: Hans de Goede <hdegoede@redhat.com>\n\nCurrently createIPA() / IPAManager::module() assume that there is a 1:1\nrelationship between pipeline handlers and IPAs and IPA matching is done\nbased on matching the pipe to ipaModuleInfo.pipelineName[].\n\nOne way to allow using a single IPA with multiple pipelines would be to\nallow the IPA to declare itself compatible with more than one pipeline,\nturning ipaModuleInfo.pipelineName[] into e.g. a vector. But the way\nipaModuleInfo is loaded as an ELF symbol requires it to be a simple flat\nC-struct.\n\nInstead, move the IPA creation procedure to be name-based, introducing\nan overload to IPAManager::createIPA(pipe, name, minVer, maxVer) that\nallows to specify the name of the IPA module to match. Pipeline handlers\nthat wants to use their name as matching criteria can continue doing so\nusing the already existing createIPA(pipe, minVer, maxVer) overload.\n\nSigned-off-by: Hans de Goede <hdegoede@redhat.com>\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n include/libcamera/internal/ipa_manager.h | 14 +++++++++++--\n include/libcamera/internal/ipa_module.h | 4 ++--\n src/libcamera/ipa_manager.cpp | 34 ++++++++++++++++++++++++++------\n src/libcamera/ipa_module.cpp | 12 +++++------\n 4 files changed, 48 insertions(+), 16 deletions(-)", "diff": "diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h\nindex f8ce780169e617088557888d7c8dae2d3f10ec08..8bc8680be0a4a6db0cdb57c1a9400c23efecda0c 100644\n--- a/include/libcamera/internal/ipa_manager.h\n+++ b/include/libcamera/internal/ipa_manager.h\n@@ -34,12 +34,14 @@ public:\n \n \ttemplate<typename T>\n \tstatic std::unique_ptr<T> createIPA(PipelineHandler *pipe,\n+\t\t\t\t\t const char *name,\n \t\t\t\t\t uint32_t minVersion,\n \t\t\t\t\t uint32_t maxVersion)\n+\n \t{\n \t\tCameraManager *cm = pipe->cameraManager();\n \t\tIPAManager *self = cm->_d()->ipaManager();\n-\t\tIPAModule *m = self->module(pipe, minVersion, maxVersion);\n+\t\tIPAModule *m = self->module(name, minVersion, maxVersion);\n \t\tif (!m)\n \t\t\treturn nullptr;\n \n@@ -60,6 +62,14 @@ public:\n \t\treturn proxy;\n \t}\n \n+\ttemplate<typename T>\n+\tstatic std::unique_ptr<T> createIPA(PipelineHandler *pipe,\n+\t\t\t\t\t uint32_t minVersion,\n+\t\t\t\t\t uint32_t maxVersion)\n+\t{\n+\t\treturn createIPA<T>(pipe, pipe->name(), minVersion, maxVersion);\n+\t}\n+\n #if HAVE_IPA_PUBKEY\n \tstatic const PubKey &pubKey()\n \t{\n@@ -72,7 +82,7 @@ private:\n \t\t std::vector<std::string> &files);\n \tunsigned int addDir(const char *libDir, unsigned int maxDepth = 0);\n \n-\tIPAModule *module(PipelineHandler *pipe, uint32_t minVersion,\n+\tIPAModule *module(const char *name, uint32_t minVersion,\n \t\t\t uint32_t maxVersion);\n \n \tbool isSignatureValid(IPAModule *ipa) const;\ndiff --git a/include/libcamera/internal/ipa_module.h b/include/libcamera/internal/ipa_module.h\nindex 15f19492c3a027a0bc4f9572188d13af41fcd450..a0a53764e1394abed3bab92cdde9f33a86441c5f 100644\n--- a/include/libcamera/internal/ipa_module.h\n+++ b/include/libcamera/internal/ipa_module.h\n@@ -36,8 +36,8 @@ public:\n \n \tIPAInterface *createInterface();\n \n-\tbool match(PipelineHandler *pipe,\n-\t\t uint32_t minVersion, uint32_t maxVersion) const;\n+\tbool match(const char *name, uint32_t minVersion,\n+\t\t uint32_t maxVersion) const;\n \n protected:\n \tstd::string logPrefix() const override;\ndiff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\nindex 35171d097136a6d85b8f518c099f8228f9eacd6f..f62a4ee5fd012d23ce178d59f84c6ab49513376b 100644\n--- a/src/libcamera/ipa_manager.cpp\n+++ b/src/libcamera/ipa_manager.cpp\n@@ -247,15 +247,15 @@ unsigned int IPAManager::addDir(const char *libDir, unsigned int maxDepth)\n \n /**\n * \\brief Retrieve an IPA module that matches a given pipeline handler\n- * \\param[in] pipe The pipeline handler\n+ * \\param[in] name The IPA module string identifier\n * \\param[in] minVersion Minimum acceptable version of IPA module\n * \\param[in] maxVersion Maximum acceptable version of IPA module\n */\n-IPAModule *IPAManager::module(PipelineHandler *pipe, uint32_t minVersion,\n+IPAModule *IPAManager::module(const char *name, uint32_t minVersion,\n \t\t\t uint32_t maxVersion)\n {\n \tfor (const auto &module : modules_) {\n-\t\tif (module->match(pipe, minVersion, maxVersion))\n+\t\tif (module->match(name, minVersion, maxVersion))\n \t\t\treturn module.get();\n \t}\n \n@@ -263,12 +263,34 @@ IPAModule *IPAManager::module(PipelineHandler *pipe, uint32_t minVersion,\n }\n \n /**\n- * \\fn IPAManager::createIPA()\n- * \\brief Create an IPA proxy that matches a given pipeline handler\n- * \\param[in] pipe The pipeline handler that wants a matching IPA proxy\n+ * \\fn IPAManager::createIPA(PipelineHandler *pipe, const char *ipaName, uint32_t minVersion, uint32_t maxVersion)\n+ * \\brief Create an IPA proxy that matches the requested name and version\n+ * \\param[in] pipe The pipeline handler that wants to create the IPA module\n+ * \\param[in] ipaName The IPA module name\n * \\param[in] minVersion Minimum acceptable version of IPA module\n * \\param[in] maxVersion Maximum acceptable version of IPA module\n *\n+ * Create an IPA module using \\a name as the matching identifier. This overload\n+ * allows pipeline handlers to create an IPA module by specifying its name\n+ * instead of relying on the fact that the IPA module matches the pipeline\n+ * handler's one.\n+ *\n+ * \\return A newly created IPA proxy, or nullptr if no matching IPA module is\n+ * found or if the IPA proxy fails to initialize\n+ */\n+\n+/**\n+ * \\fn IPAManager::createIPA(PipelineHandler *pipe, uint32_t minVersion, uint32_t maxVersion)\n+ * \\brief Create an IPA proxy that matches the pipeline handler name and the\n+ * requested version\n+ * \\param[in] pipe The pipeline handler that wants to create the IPA module\n+ * \\param[in] minVersion Minimum acceptable version of IPA module\n+ * \\param[in] maxVersion Maximum acceptable version of IPA module\n+ *\n+ * Create an IPA module using the pipeline handler name as the matching\n+ * identifier. This overload allows pipeline handler to create an IPA module\n+ * whose name matches the pipeline handler one.\n+ *\n * \\return A newly created IPA proxy, or nullptr if no matching IPA module is\n * found or if the IPA proxy fails to initialize\n */\ndiff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp\nindex e6ea61e4482983a83b4185c4309f2c514ed24fc2..0bd6f14626fe2038072f48b70ca4341b0eb8cef5 100644\n--- a/src/libcamera/ipa_module.cpp\n+++ b/src/libcamera/ipa_module.cpp\n@@ -463,21 +463,21 @@ IPAInterface *IPAModule::createInterface()\n \n /**\n * \\brief Verify if the IPA module matches a given pipeline handler\n- * \\param[in] pipe Pipeline handler to match with\n+ * \\param[in] name The IPA module name\n * \\param[in] minVersion Minimum acceptable version of IPA module\n * \\param[in] maxVersion Maximum acceptable version of IPA module\n *\n- * This function checks if this IPA module matches the \\a pipe pipeline handler,\n+ * This function checks if this IPA module matches the requested \\a name\n * and the input version range.\n *\n- * \\return True if the pipeline handler matches the IPA module, or false otherwise\n+ * \\return True if the IPA module matches, or false otherwise\n */\n-bool IPAModule::match(PipelineHandler *pipe,\n-\t\t uint32_t minVersion, uint32_t maxVersion) const\n+bool IPAModule::match(const char *name, uint32_t minVersion,\n+\t\t uint32_t maxVersion) const\n {\n \treturn info_.pipelineVersion >= minVersion &&\n \t info_.pipelineVersion <= maxVersion &&\n-\t !strcmp(info_.pipelineName, pipe->name());\n+\t !strcmp(info_.name, name);\n }\n \n std::string IPAModule::logPrefix() const\n", "prefixes": [ "1/2" ] }