{"id":24687,"url":"https://patchwork.libcamera.org/api/1.1/patches/24687/?format=json","web_url":"https://patchwork.libcamera.org/patch/24687/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20251015-ipa-match-by-name-v3-1-11f9c774c7fc@ideasonboard.com>","date":"2025-10-15T15:55:24","name":"[v3,1/4] libcamera: ipa_manager: Create IPA by name","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"ec0fc5cc2e78f750eb21d29d91cd8db3d7266d73","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/1.1/people/143/?format=json","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24687/mbox/","series":[{"id":5505,"url":"https://patchwork.libcamera.org/api/1.1/series/5505/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5505","date":"2025-10-15T15:55:23","name":"ipa: Allow IPA creation by name","version":3,"mbox":"https://patchwork.libcamera.org/series/5505/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24687/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24687/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 93855BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Oct 2025 15:55:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 087776062A;\n\tWed, 15 Oct 2025 17:55:37 +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 D0AF560462\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Oct 2025 17:55:35 +0200 (CEST)","from [192.168.1.106] (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A79B9EAE;\n\tWed, 15 Oct 2025 17:53:55 +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=\"dIMJErHm\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1760543636;\n\tbh=lBO0uo2legv1RFpoVoJNs/0maL1XDu+CGupwbB9YZ8g=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=dIMJErHmiFMglnMWPIDDVlcEQokh20ddGpanfGCzdyGFMyCTfsXDoKFbNIZbvgHly\n\tKYjk+nnUgIG3kMlDwc/SzWmtigcBmgWNzBpRxO74r+Px3D6vH85Fr6PpohJ4md2zgj\n\tnEc52kcslWrHKqgXnWcvZ/9cMxHiAOJEqbN8rrXk=","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Date":"Wed, 15 Oct 2025 17:55:24 +0200","Subject":"[PATCH v3 1/4] libcamera: ipa_manager: Create IPA by name","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"8bit","Message-Id":"<20251015-ipa-match-by-name-v3-1-11f9c774c7fc@ideasonboard.com>","References":"<20251015-ipa-match-by-name-v3-0-11f9c774c7fc@ideasonboard.com>","In-Reply-To":"<20251015-ipa-match-by-name-v3-0-11f9c774c7fc@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\n\t<hansg@kernel.org>, Milan Zamazal <mzamazal@redhat.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tKieran Bingham <kieran.bingham@ideasonboard.com>","X-Mailer":"b4 0.14.2","X-Developer-Signature":"v=1; a=openpgp-sha256; l=7914;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=qlnCgwYcVWfZj6RiMuGlvvd+UXFnC8YG+UkcFe7KCUI=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBo78P02ST9xMMCa5UY2Dpg8myYvArwIKjNHCia4\n\tMqx6XL1mRKJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaO/D9AAKCRByNAaPFqFW\n\tPJ1CD/0YtwXyP2SrvLFzhFPVZfP/NIJnqFv0yYdPSn4ZNx+HZTxhFinWFUBWt4nQctZk8RNCs2p\n\tiqgHirwfzlebMoyiZ68UKn1hA9a1FEV3QoKAsfgWbOc0Cpa8ncLv9z2pSXPYuedZb6rvd062tGK\n\tds7sI+C+yMs7sP7ZFVnuuiVjPEalfLcIqp3lOMLBFmFyKiA2/3IFvKUMbfjvhxhDtR2gIFJg69r\n\tfAEArCuVB1MEo9oSRQtw+wnZVJxZ6+djnu3Tc/+pU6U9BlaXX+4Z1Ql2E6ntkQxFryGo2ZNzwrD\n\t5M3phvGCJ3Uqq0jtlkocQl1fZeLdL7i+3ocLNuZEHt0rPVvNphEwlYcV0naEHLEJPeu14OH5kq8\n\t2y491aqIXnc7wz+VATzKy1eKBaQ9ChOeppyRWNrAlBNZT5LVjK5k1gAd1ZE0wMAXoQJB6/GX8W0\n\tbiKXzz/A17scJWuOJc4NkYHMPfnsRNe1eU0FCfoYhzTqFiB95a7NuOioQzE5TFvdYGYzp69sP8Y\n\tzEhoZX8wDoXgrcWw9J8Y2Dz75uDKDGBPrKLXQiIxOCDy/6lCYIk54iBJNnjRgvA6ttfAk5UecGH\n\tZms5R1pPAnD7jOVOCLsJAH03TvyCf4B2175QVB66f7AoD0REjCzeQtbIr1VQXu1CM8BLJg5DJ5w\n\trz+dp1M/Gzw/RuQ==","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 <hansg@kernel.org>\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 <hansg@kernel.org>\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Hans de Goede <hansg@kernel.org>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nTested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>\n---\n include/libcamera/internal/ipa_manager.h | 13 ++++++++++--\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, 47 insertions(+), 16 deletions(-)","diff":"diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h\nindex f8ce780169e617088557888d7c8dae2d3f10ec08..4c01e76f1800120f0baca25bc2e5e251f7cf80b5 100644\n--- a/include/libcamera/internal/ipa_manager.h\n+++ b/include/libcamera/internal/ipa_manager.h\n@@ -34,12 +34,13 @@ 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 \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 +61,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 +81,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":["v3","1/4"]}