From patchwork Wed Oct 15 15:55:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 24687 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 93855BE080 for ; Wed, 15 Oct 2025 15:55:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 087776062A; Wed, 15 Oct 2025 17:55:37 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="dIMJErHm"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D0AF560462 for ; Wed, 15 Oct 2025 17:55:35 +0200 (CEST) Received: from [192.168.1.106] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A79B9EAE; Wed, 15 Oct 2025 17:53:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1760543636; bh=lBO0uo2legv1RFpoVoJNs/0maL1XDu+CGupwbB9YZ8g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=dIMJErHmiFMglnMWPIDDVlcEQokh20ddGpanfGCzdyGFMyCTfsXDoKFbNIZbvgHly KYjk+nnUgIG3kMlDwc/SzWmtigcBmgWNzBpRxO74r+Px3D6vH85Fr6PpohJ4md2zgj nEc52kcslWrHKqgXnWcvZ/9cMxHiAOJEqbN8rrXk= From: Jacopo Mondi 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 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?= , Hans de Goede , Milan Zamazal Cc: Jacopo Mondi , Kieran Bingham X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=7914; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=qlnCgwYcVWfZj6RiMuGlvvd+UXFnC8YG+UkcFe7KCUI=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBo78P02ST9xMMCa5UY2Dpg8myYvArwIKjNHCia4 Mqx6XL1mRKJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaO/D9AAKCRByNAaPFqFW PJ1CD/0YtwXyP2SrvLFzhFPVZfP/NIJnqFv0yYdPSn4ZNx+HZTxhFinWFUBWt4nQctZk8RNCs2p iqgHirwfzlebMoyiZ68UKn1hA9a1FEV3QoKAsfgWbOc0Cpa8ncLv9z2pSXPYuedZb6rvd062tGK ds7sI+C+yMs7sP7ZFVnuuiVjPEalfLcIqp3lOMLBFmFyKiA2/3IFvKUMbfjvhxhDtR2gIFJg69r fAEArCuVB1MEo9oSRQtw+wnZVJxZ6+djnu3Tc/+pU6U9BlaXX+4Z1Ql2E6ntkQxFryGo2ZNzwrD 5M3phvGCJ3Uqq0jtlkocQl1fZeLdL7i+3ocLNuZEHt0rPVvNphEwlYcV0naEHLEJPeu14OH5kq8 2y491aqIXnc7wz+VATzKy1eKBaQ9ChOeppyRWNrAlBNZT5LVjK5k1gAd1ZE0wMAXoQJB6/GX8W0 biKXzz/A17scJWuOJc4NkYHMPfnsRNe1eU0FCfoYhzTqFiB95a7NuOioQzE5TFvdYGYzp69sP8Y zEhoZX8wDoXgrcWw9J8Y2Dz75uDKDGBPrKLXQiIxOCDy/6lCYIk54iBJNnjRgvA6ttfAk5UecGH Zms5R1pPAnD7jOVOCLsJAH03TvyCf4B2175QVB66f7AoD0REjCzeQtbIr1VQXu1CM8BLJg5DJ5w rz+dp1M/Gzw/RuQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B 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: Hans de Goede Currently createIPA() / IPAManager::module() assume that there is a 1:1 relationship between pipeline handlers and IPAs and IPA matching is done based on matching the pipe to ipaModuleInfo.pipelineName[]. One way to allow using a single IPA with multiple pipelines would be to allow the IPA to declare itself compatible with more than one pipeline, turning ipaModuleInfo.pipelineName[] into e.g. a vector. But the way ipaModuleInfo is loaded as an ELF symbol requires it to be a simple flat C-struct. Instead, move the IPA creation procedure to be name-based, introducing an overload to IPAManager::createIPA(pipe, name, minVer, maxVer) that allows to specify the name of the IPA module to match. Pipeline handlers that wants to use their name as matching criteria can continue doing so using the already existing createIPA(pipe, minVer, maxVer) overload. Signed-off-by: Hans de Goede Signed-off-by: Jacopo Mondi Reviewed-by: Hans de Goede Reviewed-by: Kieran Bingham Tested-by: Niklas Söderlund --- include/libcamera/internal/ipa_manager.h | 13 ++++++++++-- include/libcamera/internal/ipa_module.h | 4 ++-- src/libcamera/ipa_manager.cpp | 34 ++++++++++++++++++++++++++------ src/libcamera/ipa_module.cpp | 12 +++++------ 4 files changed, 47 insertions(+), 16 deletions(-) diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h index f8ce780169e617088557888d7c8dae2d3f10ec08..4c01e76f1800120f0baca25bc2e5e251f7cf80b5 100644 --- a/include/libcamera/internal/ipa_manager.h +++ b/include/libcamera/internal/ipa_manager.h @@ -34,12 +34,13 @@ public: template static std::unique_ptr createIPA(PipelineHandler *pipe, + const char *name, uint32_t minVersion, uint32_t maxVersion) { CameraManager *cm = pipe->cameraManager(); IPAManager *self = cm->_d()->ipaManager(); - IPAModule *m = self->module(pipe, minVersion, maxVersion); + IPAModule *m = self->module(name, minVersion, maxVersion); if (!m) return nullptr; @@ -60,6 +61,14 @@ public: return proxy; } + template + static std::unique_ptr createIPA(PipelineHandler *pipe, + uint32_t minVersion, + uint32_t maxVersion) + { + return createIPA(pipe, pipe->name(), minVersion, maxVersion); + } + #if HAVE_IPA_PUBKEY static const PubKey &pubKey() { @@ -72,7 +81,7 @@ private: std::vector &files); unsigned int addDir(const char *libDir, unsigned int maxDepth = 0); - IPAModule *module(PipelineHandler *pipe, uint32_t minVersion, + IPAModule *module(const char *name, uint32_t minVersion, uint32_t maxVersion); bool isSignatureValid(IPAModule *ipa) const; diff --git a/include/libcamera/internal/ipa_module.h b/include/libcamera/internal/ipa_module.h index 15f19492c3a027a0bc4f9572188d13af41fcd450..a0a53764e1394abed3bab92cdde9f33a86441c5f 100644 --- a/include/libcamera/internal/ipa_module.h +++ b/include/libcamera/internal/ipa_module.h @@ -36,8 +36,8 @@ public: IPAInterface *createInterface(); - bool match(PipelineHandler *pipe, - uint32_t minVersion, uint32_t maxVersion) const; + bool match(const char *name, uint32_t minVersion, + uint32_t maxVersion) const; protected: std::string logPrefix() const override; diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp index 35171d097136a6d85b8f518c099f8228f9eacd6f..f62a4ee5fd012d23ce178d59f84c6ab49513376b 100644 --- a/src/libcamera/ipa_manager.cpp +++ b/src/libcamera/ipa_manager.cpp @@ -247,15 +247,15 @@ unsigned int IPAManager::addDir(const char *libDir, unsigned int maxDepth) /** * \brief Retrieve an IPA module that matches a given pipeline handler - * \param[in] pipe The pipeline handler + * \param[in] name The IPA module string identifier * \param[in] minVersion Minimum acceptable version of IPA module * \param[in] maxVersion Maximum acceptable version of IPA module */ -IPAModule *IPAManager::module(PipelineHandler *pipe, uint32_t minVersion, +IPAModule *IPAManager::module(const char *name, uint32_t minVersion, uint32_t maxVersion) { for (const auto &module : modules_) { - if (module->match(pipe, minVersion, maxVersion)) + if (module->match(name, minVersion, maxVersion)) return module.get(); } @@ -263,12 +263,34 @@ IPAModule *IPAManager::module(PipelineHandler *pipe, uint32_t minVersion, } /** - * \fn IPAManager::createIPA() - * \brief Create an IPA proxy that matches a given pipeline handler - * \param[in] pipe The pipeline handler that wants a matching IPA proxy + * \fn IPAManager::createIPA(PipelineHandler *pipe, const char *ipaName, uint32_t minVersion, uint32_t maxVersion) + * \brief Create an IPA proxy that matches the requested name and version + * \param[in] pipe The pipeline handler that wants to create the IPA module + * \param[in] ipaName The IPA module name * \param[in] minVersion Minimum acceptable version of IPA module * \param[in] maxVersion Maximum acceptable version of IPA module * + * Create an IPA module using \a name as the matching identifier. This overload + * allows pipeline handlers to create an IPA module by specifying its name + * instead of relying on the fact that the IPA module matches the pipeline + * handler's one. + * + * \return A newly created IPA proxy, or nullptr if no matching IPA module is + * found or if the IPA proxy fails to initialize + */ + +/** + * \fn IPAManager::createIPA(PipelineHandler *pipe, uint32_t minVersion, uint32_t maxVersion) + * \brief Create an IPA proxy that matches the pipeline handler name and the + * requested version + * \param[in] pipe The pipeline handler that wants to create the IPA module + * \param[in] minVersion Minimum acceptable version of IPA module + * \param[in] maxVersion Maximum acceptable version of IPA module + * + * Create an IPA module using the pipeline handler name as the matching + * identifier. This overload allows pipeline handler to create an IPA module + * whose name matches the pipeline handler one. + * * \return A newly created IPA proxy, or nullptr if no matching IPA module is * found or if the IPA proxy fails to initialize */ diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index e6ea61e4482983a83b4185c4309f2c514ed24fc2..0bd6f14626fe2038072f48b70ca4341b0eb8cef5 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -463,21 +463,21 @@ IPAInterface *IPAModule::createInterface() /** * \brief Verify if the IPA module matches a given pipeline handler - * \param[in] pipe Pipeline handler to match with + * \param[in] name The IPA module name * \param[in] minVersion Minimum acceptable version of IPA module * \param[in] maxVersion Maximum acceptable version of IPA module * - * This function checks if this IPA module matches the \a pipe pipeline handler, + * This function checks if this IPA module matches the requested \a name * and the input version range. * - * \return True if the pipeline handler matches the IPA module, or false otherwise + * \return True if the IPA module matches, or false otherwise */ -bool IPAModule::match(PipelineHandler *pipe, - uint32_t minVersion, uint32_t maxVersion) const +bool IPAModule::match(const char *name, uint32_t minVersion, + uint32_t maxVersion) const { return info_.pipelineVersion >= minVersion && info_.pipelineVersion <= maxVersion && - !strcmp(info_.pipelineName, pipe->name()); + !strcmp(info_.name, name); } std::string IPAModule::logPrefix() const From patchwork Wed Oct 15 15:55:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 24688 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 9A523C3264 for ; Wed, 15 Oct 2025 15:55:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3D62060635; Wed, 15 Oct 2025 17:55:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HMLFvNGe"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 392E360615 for ; Wed, 15 Oct 2025 17:55:36 +0200 (CEST) Received: from [192.168.1.106] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2CDCAEB7; Wed, 15 Oct 2025 17:53:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1760543636; bh=w2NbNhMCrbrx0QAhtTKoNDYW3bN7xb8EkAIrfu5hkTk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HMLFvNGez0QN9/ChOCiL257PhGzBhdxvN0PmdA/3SXhS1A5mji7Ak48FZlgr6S7+B hGgN0Ugb6WoKIFBfK3tffc6V0WXjzq1lS7qkDtZhP5t/FhTrmemk/LUH2dGw2cXkKV wxIZnGcAzbXZzN7ZPI5LATe/ErJrQR900hOpG8w4= From: Jacopo Mondi Date: Wed, 15 Oct 2025 17:55:25 +0200 Subject: [PATCH v3 2/4] ipa: ipa_module: Remove pipelineName MIME-Version: 1.0 Message-Id: <20251015-ipa-match-by-name-v3-2-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?= , Hans de Goede , Milan Zamazal Cc: Jacopo Mondi , =?utf-8?b?QmFybmFiw6Fz?= =?utf-8?q?_P=C5=91cze?= , Kieran Bingham X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6759; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=w2NbNhMCrbrx0QAhtTKoNDYW3bN7xb8EkAIrfu5hkTk=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBo78P0BtFuKdBtrJvpOCrQRNnjZOK5B8zUcyrWi ypU3cvlXKKJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaO/D9AAKCRByNAaPFqFW PDtjD/4nH682h+yuPWok2q/Geokt/4s3HWVchOabs0Y/QmRS0ui9hB8CsuvbkfCHHnFNVNjOwpT GFtB7yqGLSEov9x0B7fCDF0YkN4mACVScAsLbVTGA8q2w1nIq/ejxkxdXzTcuXmNPZqnQyCb6YK 8n/seq9mGhO6zOg7KexhkA0jCNqH+WlE9idl8e220FE1y19XP7sH21xzhvNkt4fPwmAbynR7LN0 MARsepE5NVIjagXAPaZnYCNFz68K16BYbr5Z4/6FKUsRBb9G1EBJOK/P3lJ8oi5eKe3+p5FOXFR lNmN7YRYvlbayBhi+WoEAK99gZlzSH9moTI/bv8CquTYrOeEHUwpO/A3JhbQ5zq1LlWYARSezqS csMOvnp8t1n9dVbiwxGSIerbOkDJaZ3ImuPabks5TknZw98d4xVtnIXM9fCgN2ySZBn+HmO4qeL dI64uc3xMPsVhrnXxwx7VcxtZpE8vYcvQ5htF3H75cjnx8bJtkzYrasSaoHpTGeU5SbFNE/qyaN 3ej+XJkGbwj+QKOSWWhJGxkRUlr3vU9H1vz91qGwykhXMmPhsSf29HcDAGfRcAjhJ1rk4fASlNz bEXb59fcdt8JlrVqHhWVI20WtICks+kSDwWDMuDqvjWTGXBsmaR7TLh1GROvcvr2R1FVnfVLGvh LUJCJOStLO0zv0Q== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B 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" All the IPA modules declare a pipelineName that is identical to their name. As we now support creating IPAs by name (either explicitly provided by the pipeline handlers or by using the pipeline name), the duplicated information in IPAModuleInfo is redundant. Remove it. Signed-off-by: Jacopo Mondi Reviewed-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- include/libcamera/ipa/ipa_module_info.h | 1 - src/ipa/ipu3/ipu3.cpp | 1 - src/ipa/mali-c55/mali-c55.cpp | 1 - src/ipa/rkisp1/rkisp1.cpp | 1 - src/ipa/rpi/pisp/pisp.cpp | 1 - src/ipa/rpi/vc4/vc4.cpp | 1 - src/ipa/simple/soft_simple.cpp | 1 - src/ipa/vimc/vimc.cpp | 1 - src/libcamera/ipa_module.cpp | 15 ++++++--------- test/ipa/ipa_module_test.cpp | 3 --- 10 files changed, 6 insertions(+), 20 deletions(-) diff --git a/include/libcamera/ipa/ipa_module_info.h b/include/libcamera/ipa/ipa_module_info.h index 3507a6d7678a3fd171c9239967d4667381ac3ea6..436ec82d7750d1ab7901499f4c4d88f0a173b563 100644 --- a/include/libcamera/ipa/ipa_module_info.h +++ b/include/libcamera/ipa/ipa_module_info.h @@ -16,7 +16,6 @@ namespace libcamera { struct IPAModuleInfo { int moduleAPIVersion; uint32_t pipelineVersion; - char pipelineName[256]; char name[256]; } __attribute__((packed)); diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 1cae08bf255f6f53a0ebee02ba3aadda5a650ae3..a714024129b688b0579662ac7d6d9c3ffc15b62a 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -672,7 +672,6 @@ const struct IPAModuleInfo ipaModuleInfo = { IPA_MODULE_API_VERSION, 1, "ipu3", - "ipu3", }; /** diff --git a/src/ipa/mali-c55/mali-c55.cpp b/src/ipa/mali-c55/mali-c55.cpp index 7d45e7310aecdae0e47655e6d2e8830e776d74cd..e52e89be7c7e34310ca866bcbea2134833e967db 100644 --- a/src/ipa/mali-c55/mali-c55.cpp +++ b/src/ipa/mali-c55/mali-c55.cpp @@ -387,7 +387,6 @@ const struct IPAModuleInfo ipaModuleInfo = { IPA_MODULE_API_VERSION, 1, "mali-c55", - "mali-c55", }; IPAInterface *ipaCreate() diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index fa22bfc349043002345d275b11a60ac983e329d7..a8e46094bdb9c431eb9143cccfa88e8ae7a3c04f 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -480,7 +480,6 @@ const struct IPAModuleInfo ipaModuleInfo = { IPA_MODULE_API_VERSION, 1, "rkisp1", - "rkisp1", }; IPAInterface *ipaCreate() diff --git a/src/ipa/rpi/pisp/pisp.cpp b/src/ipa/rpi/pisp/pisp.cpp index 01baebcd2bb6e1b2a46466087fa2801edb9ee059..a1c7e186325627566a6a6b7dfed40e5fdd4a2576 100644 --- a/src/ipa/rpi/pisp/pisp.cpp +++ b/src/ipa/rpi/pisp/pisp.cpp @@ -1145,7 +1145,6 @@ const IPAModuleInfo ipaModuleInfo = { IPA_MODULE_API_VERSION, 1, "rpi/pisp", - "rpi/pisp", }; IPAInterface *ipaCreate() diff --git a/src/ipa/rpi/vc4/vc4.cpp b/src/ipa/rpi/vc4/vc4.cpp index b2fec934480487c0c0566d510afd7a72129e441c..dc3455642ec71865d73662e6cd2d42bba61cadb8 100644 --- a/src/ipa/rpi/vc4/vc4.cpp +++ b/src/ipa/rpi/vc4/vc4.cpp @@ -606,7 +606,6 @@ const struct IPAModuleInfo ipaModuleInfo = { IPA_MODULE_API_VERSION, 1, "rpi/vc4", - "rpi/vc4", }; IPAInterface *ipaCreate() diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp index b147aca2e3436cd79586063c4ee23f6698f266bf..9122f1c019ce1bb1c6a4d96e3fda664023391464 100644 --- a/src/ipa/simple/soft_simple.cpp +++ b/src/ipa/simple/soft_simple.cpp @@ -350,7 +350,6 @@ const struct IPAModuleInfo ipaModuleInfo = { IPA_MODULE_API_VERSION, 0, "simple", - "simple", }; IPAInterface *ipaCreate() diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp index a1351a0f45ce4ce6afed3151001eb74b10090c16..822e00aff2033e42254823b07ec396a50f71f182 100644 --- a/src/ipa/vimc/vimc.cpp +++ b/src/ipa/vimc/vimc.cpp @@ -202,7 +202,6 @@ const struct IPAModuleInfo ipaModuleInfo = { IPA_MODULE_API_VERSION, 0, "vimc", - "vimc", }; IPAInterface *ipaCreate() diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index 0bd6f14626fe2038072f48b70ca4341b0eb8cef5..53cea6b187e86f20628d3b51c47097836801b094 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -215,18 +215,15 @@ Span elfLoadSymbol(Span elf, const char *symbol) * \var IPAModuleInfo::pipelineVersion * \brief The pipeline handler version that the IPA module is for * - * \var IPAModuleInfo::pipelineName - * \brief The name of the pipeline handler that the IPA module is for - * - * This name is used to match a pipeline handler with the module. - * * \var IPAModuleInfo::name * \brief The name of the IPA module * - * The name may be used to build file system paths to IPA-specific resources. - * It shall only contain printable characters, and may not contain '*', '?' or - * '\'. For IPA modules included in libcamera, it shall match the directory of - * the IPA module in the source tree. + * This name is used to match a the IPA module. + * + * The name may also be used to build file system paths to IPA-specific + * resources. It shall only contain printable characters, and may not contain + * '*', '?' or '\'. For IPA modules included in libcamera, it shall match the + * directory of the IPA module in the source tree. * * \todo Allow user to choose to isolate open source IPAs */ diff --git a/test/ipa/ipa_module_test.cpp b/test/ipa/ipa_module_test.cpp index 1c97da3242a7d558c52dce6ed3bc9b5f76742944..af71c3285328263da71643da97e7b8c440d9a7ad 100644 --- a/test/ipa/ipa_module_test.cpp +++ b/test/ipa/ipa_module_test.cpp @@ -37,12 +37,10 @@ protected: cerr << "IPA module information mismatch: expected:" << endl << "moduleAPIVersion = " << testInfo.moduleAPIVersion << endl << "pipelineVersion = " << testInfo.pipelineVersion << endl - << "pipelineName = " << testInfo.pipelineName << endl << "name = " << testInfo.name << "got: " << endl << "moduleAPIVersion = " << info.moduleAPIVersion << endl << "pipelineVersion = " << info.pipelineVersion << endl - << "pipelineName = " << info.pipelineName << endl << "name = " << info.name << endl; } @@ -58,7 +56,6 @@ protected: IPA_MODULE_API_VERSION, 0, "vimc", - "vimc", }; count += runTest("src/ipa/vimc/ipa_vimc.so", testInfo); From patchwork Wed Oct 15 15:55:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 24689 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 73D13C3331 for ; Wed, 15 Oct 2025 15:55:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 095136063B; Wed, 15 Oct 2025 17:55:41 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="M8yHQ1Gb"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8116460624 for ; Wed, 15 Oct 2025 17:55:36 +0200 (CEST) Received: from [192.168.1.106] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B48A615D2; Wed, 15 Oct 2025 17:53:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1760543637; bh=jGAAvWLtEuqotFrOTWjXLkPOK99cojdDvNq9i0oF1YQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=M8yHQ1GbGsGBkB0jU7G+8x6NiHgLoAsqhQK0cd+ebQpDa723VC1whZFgMBnW16vA6 vAIUyAM7GldRbWl0IVrOLYt1bcpeVc+Bkhqv+US0Fv4RBgvEd7r+5idle1TWpKQMaQ gO6sJqNZQjK9hiHSy0c1fXF1lK32XLkVVdsOcSew= From: Jacopo Mondi Date: Wed, 15 Oct 2025 17:55:26 +0200 Subject: [PATCH v3 3/4] ipa: meson.build: Remove duplicated variable MIME-Version: 1.0 Message-Id: <20251015-ipa-match-by-name-v3-3-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?= , Hans de Goede , Milan Zamazal Cc: Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=618; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=jGAAvWLtEuqotFrOTWjXLkPOK99cojdDvNq9i0oF1YQ=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBo78P1+7LSJkN5kHs0UJJE0MzVjylfWJuG7AFLJ SZv+S76MxWJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaO/D9QAKCRByNAaPFqFW PO2OEACeKB4Q0aGQUXYke2QulQG0Bxcd7bGXxDlEGSLciRZIY7JJRbrC14lFhS1CqtoaihBl5Om 7c+hoy2A0DqO10XaMbjhRTP7Vpr/d3M5wBT6Jkm1DYfOnBYYJrD34F6/5tRt6PkdxeVug8nZ2TM baJv/75Ux8gtd6fvfmtckD3KSuSfaJJZc5HDj4E0f+atOyC4ercDrC2ptVYg6j1wf6a2gI9AVL7 V5LJRFJ1zb33okdbNq0T8jKoqvEdMdbk9pt5Z06TX3AgqGyPewm/QouZ7ulq2JBfP/YNSmUuNHf eOV5B9Kd5SgZ8MRFa2WO1oOmkHy/4IIcM9+udOmv97YTtg36cFj8kN/HZ3rbC/BVC+X1tnils9e 9+BB935TbJG10EwjbKdOFz9Vt9m1kJ7jzPWbbiSDQmhcIpsIlk6Y7/zLvpohPsNwU4vv2N04+Js ImGJ4p0L2HzLyQPd6/zKiHBkJ6xQOr8bI/XedMvNKv0+f+tVa4iJ+FpgTb45EiKZWQpGlDmBkwo U/n7ZaZozdLBtywJzbezKONzHbx9SWZuh+r9ztmIrZQCfNPGUbdrBAypqrdDh54UhQjRFy45zVK xpJ51eihErZlpsflFNrfhnyCtxzks4MLlNw2FF4TGfZNXNiKPBGSrix8Ts1JIA/CKFqd7P8eOQp W2hjBtuBoYcLNUg== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B 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" The 'ipa_names' variable is declared twice. Remove it. Signed-off-by: Jacopo Mondi --- src/ipa/meson.build | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ipa/meson.build b/src/ipa/meson.build index 68f64b9a6fa39cceae291a9662bd6048d0e59422..eb7846e47888d4056b81e4a68f1903f134e6a662 100644 --- a/src/ipa/meson.build +++ b/src/ipa/meson.build @@ -24,8 +24,6 @@ subdir('libipa') ipa_sign = files('ipa-sign.sh') -ipa_names = [] - ipa_modules = get_option('ipas') # Tests require the vimc IPA, similar to vimc pipline-handler for their From patchwork Wed Oct 15 15:55:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 24690 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 49E2EC3332 for ; Wed, 15 Oct 2025 15:55:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B8FB860624; Wed, 15 Oct 2025 17:55:41 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Fg+6wEUE"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B047560628 for ; Wed, 15 Oct 2025 17:55:36 +0200 (CEST) Received: from [192.168.1.106] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2E51416C5; Wed, 15 Oct 2025 17:53:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1760543637; bh=2Bxs7dUYHz3fobXnR2cEBW56/G43T4o+OpEhmNGQUms=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Fg+6wEUELYRHkCkafcWMvevUAsF1BZCC8CIZxhA3OGggcfo0s2Ixj14EPMmrTy+JE 4l3jESlE7bAT/lBZIxERECNYImfAVE8vgttLtG+Q/xBbvBMpGakIKxvJgbNNS4IKs9 CuTN7RA8n4adiPRfSNpQKlh7RknkzZluoX5OP0Yc= From: Jacopo Mondi Date: Wed, 15 Oct 2025 17:55:27 +0200 Subject: [PATCH v3 4/4] ipa: Allow pipelines to have differently named IPA MIME-Version: 1.0 Message-Id: <20251015-ipa-match-by-name-v3-4-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?= , Hans de Goede , Milan Zamazal Cc: Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3917; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=2Bxs7dUYHz3fobXnR2cEBW56/G43T4o+OpEhmNGQUms=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBo78P1y0mlprifc10GMZnmt/xzRpogWWPA/LZv0 d8fCCACQp+JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaO/D9QAKCRByNAaPFqFW PEcbEACMNQQRBrgGO6ALnciGs3wd8NwykPgrrEaeHG4+LWCP29mlEyZTXC27b5EFfRkRNT5jKM5 Glq95wpWWUAgz9d62RMkvJhzocxkfKCFfXiDXiwU+wWUq6sCUqHf86YPcLStw0fT1agC3/aO/3L fjGgoZOKnr+GYbtOIJxgncE68JDBLU86nFSGxO3RHFQ3cRJlChnKn4+5gvYKf8izUmX08+pXCVc UqpWzTDDnO+wJTl7lYmaaB+sGLb6flmsMLjl9zqrl65HjzgG6c+X4gFJ5B4KxSEnanqwvGKRbg0 m0NtmQJrRnLcNLp7yv4A8GKV+6wahVtHMLlv8UXk2qfV7lfQincpBUdJ3EG4fYXTFK6rZR47uUr b/Ba4vaoaKh7foo7rM4W4VrqNomd9of+Z7P3vzbhqTfH+BDj3hYRqoMAWHUt78D4rAkAyOP99OE TQAHvNB1Db5BUtWWhc5+KvaVIUqAdmHfn7Cl4+/P+WpHHPL2SD+T/GMdWDNlJkO+qmUQR/bEKEJ O2ewNnNtr/wLOtlx26AoSx3w+SdELxQoksgOzM/J1lCJhzrWX7ayXSvY/YkHe19+77DZhlD6NO7 56q8V9ycPN0B/BlcUv4mQW7YkJchMdE2SZLpteXIYTLdxVj4xsZp3mHNyGZQiG7Rug/jKWLJBAw 1us0G889nVSuIyA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B 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" Right now the build system assumes a 1-to-1 matching between a pipeline handler name and an IPA module. This, as also acknowledged by a \todo comment, is quite a rigid requirement and only allows a 1-to-1 matching between pipeline and IPA names. The more platforms libcamera supports, the more it is likely that a pipeline handler could re-use an IPA module. This is particularly relevant for the softISP IPA module which could theoretically be plugged to any pipeline. Likewise, the forthcoming R-Car Gen4 support uses the RkISP1 IPA and at the moment would require building the 'rkisp1' pipeline in to have the IPA module available. When building IPAs, the build system iterates the list of enabled pipeline handlers and for each of them tries to verify if the 'ipas' list contains a corresponding entry for it. The 'ipas' meson options is an array option and, as no default value is specified for it, it contains by default all its possible choices. In this way if no value is specified for the 'ipas' option, compiling the pipeline handlers ['X','Y', 'Z'] will compile the ['X', 'Y', 'Z'] IPAs. If instead the user specifies '-Dipas=X' during the configuration then only IPA module ['X'] will be built, regardless of which pipeline is enabled. Building an IPA module will anyway require to build a corresponding pipeline with the same name. Relax the 1-to-1 'pipeline'-'IPA' naming requirement by introducing a dictionary that associates pipelines with IPA modules. For each enabled pipeline: 1) Make sure an IPA module exists for it 2) Make sure the IPA module is enabled by the 'ipas' option 3) Make sure the IPA is compiled once only This will require every new pipeline to add an entry to the dictionary and specify which IPA module they would like to use. Signed-off-by: Jacopo Mondi --- src/ipa/meson.build | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/ipa/meson.build b/src/ipa/meson.build index eb7846e47888d4056b81e4a68f1903f134e6a662..c583c7efdd35170ab31d92fd8347ecdceaba5a31 100644 --- a/src/ipa/meson.build +++ b/src/ipa/meson.build @@ -24,6 +24,16 @@ subdir('libipa') ipa_sign = files('ipa-sign.sh') +supported_ipas = { + 'ipu3': 'ipu3', + 'mali-c55': 'mali-c55', + 'rkisp1': 'rkisp1', + 'rpi/pisp': 'rpi/pisp', + 'rpi/vc4': 'rpi/vc4', + 'simple': 'simple', + 'vimc': 'vimc' +} + ipa_modules = get_option('ipas') # Tests require the vimc IPA, similar to vimc pipline-handler for their @@ -39,24 +49,34 @@ ipa_names = [] subdirs = [] foreach pipeline : pipelines - # The current implementation expects the IPA module name to match the - # pipeline name. - # \todo Make the IPA naming scheme more flexible. - if not ipa_modules.contains(pipeline) + # Make sure an IPA exists for the pipeline + if not supported_ipas.has_key(pipeline) + continue + endif + + ipa = supported_ipas.get(pipeline) + + # Only build IPAs specified with '-Dipas' + if not ipa_modules.contains(ipa) + continue + endif + + # If enabled already do not add it twice + if enabled_ipa_names.contains(ipa) continue endif - enabled_ipa_names += pipeline + enabled_ipa_names += ipa # Allow multi-level directory structuring for the IPAs if needed. - pipeline = pipeline.split('/')[0] - if pipeline in subdirs + ipa = ipa.split('/')[0] + if ipa in subdirs continue endif - subdirs += pipeline - subdir(pipeline) + subdirs += ipa + subdir(ipa) - # Don't reuse the pipeline variable below, the subdirectory may have + # Don't reuse the ipa variable below, the subdirectory may have # overwritten it. endforeach