From patchwork Tue Aug 18 14:05:41 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 27838 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 C2CF2C330A for ; Tue, 18 Aug 2026 14:06:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DE331682FD; Tue, 18 Aug 2026 16:05:58 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.b="LtaeHo/W"; dkim=pass (2048-bit key; unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="EE2SmXft"; dkim-atps=neutral Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4DF8A682E5 for ; Tue, 18 Aug 2026 16:05:55 +0200 (CEST) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67IE0flW1502685 for ; Tue, 18 Aug 2026 14:05:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 24nfE4GwOcj/gvwLd45tQlQRNDX907S5oisIPl37Yck=; b=LtaeHo/WgZRD+zjg 6zhCX4GZfDr/sezXTCfcK0/EfLXd29jD8k53HsCL0p/9yEbrql5MBT3rBCTltruo id4lAQpziBCBqdHJyUblq2wjkkj53O9Vb+A9PCBeQfcd8ysvSup4kth5sTPR0sdd vjLLcLwbR30k/cC/rHKR4Pw1Sb1+GO2BiAEmAaxRzpd3UJvLf9fvu5i9aPCsS/DW c2gnUK0WRsHMP/uhSfZHj7VrwjmvDBB8HWROw7iJNyXZrgCi+76y5rCMAiRxXSuK KDk1HSNvmi9sdqDHvvnzNYgZsMGhfI+Dixc4XSVOKCm0AmhukRovUlY7O8S32PBL uLaQwg== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4g4prn0kax-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 18 Aug 2026 14:05:53 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-92ec3146553so70739885a.1 for ; Tue, 18 Aug 2026 07:05:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1787061952; x=1787666752; darn=lists.libcamera.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=24nfE4GwOcj/gvwLd45tQlQRNDX907S5oisIPl37Yck=; b=EE2SmXftGViGtdxiMr9v4ENntWBhrFpB9ydJtt30/0MelPDKlpVNXEjx5onJsWg21w 8pv1WmblstR6CwydNf3f7uk8GNZtBGT4i62z2/CSPJk+F9wDhTHgtWntAQYQ/8f7e4wA zAzsZRe9tZIFHqIRR14Xh/B4H/0YJBobeb3BIpPNxAAuAmLPYHJnZjYF1J8YUkKblfRh mi4WFB+0bzGndP8J95VTSrJdHQe9kYcYIvpsSzvevC3f5C+4ADv+VXo03eaYgtGd6774 HlWCJKSTALN8bJJt/78FyTGuQoNqT6JW2aPsmLeTAh9Es5wAbov7sAAwbSRrhNhcThSL J3Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787061952; x=1787666752; h=content-transfer-encoding:content-type: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 :content-type; bh=24nfE4GwOcj/gvwLd45tQlQRNDX907S5oisIPl37Yck=; b=Jf9BlRCTHaiiIqctwRxZIiCuzHNvd84tq/XyHh6u+nCuaPMHYDu8OTSq5OB73iDw5g RnwkqBOzqTfxBwTOGPICVWOqwdthqauOl02zIaVB+4af8Yxn6ygZNHw0fpBFTzcsrr38 PY8yh6uV1Ws+gWHiDJEewq+tpRqHAnjK5/7vyXG5GESxCNYB1bsg1tV+eoTjnJe7gQ6X CAg6waZytFmeiNLQJJfyDxZ3mOVAmOkfZGBAgPLCLSSykn57Mm1VhskbIqaqRzYoBI12 5Y6GaxX8FoiMWej+GBpH90z8+B6MO/lXJRpt2Xtz6IvesBB8OyTlHM8q72MQOR5+IRg2 ZDcQ== X-Gm-Message-State: AOJu0YzrvyGD8IWIKNWJAk2xBo1iOO51wBvNkv/HhEpsNmNEZViyj2fu OPzBJ7w/BKsZr/00XNNPoJwu5hK31zrIMSgD8SbAVL31V0eRTC57hpvFlRncYjtKT/eefDyYq+Q cS8HjZ3LFPraRgR5w4gqzBtcD6e9CP1bpSGzAp0qutbQGE0QSlGrW1NwXS6PBIQtdOP2d98TPUQ Cu4uUuwGsU X-Gm-Gg: AR+sD13rNW2qZLcLNPDCE5RsKneIx27CMuhbtKjZDobxCXW8y+SoVibK0xh6qHqnPXT OcuBYIuqqQsuc79zSJXyZ2HwQerHotktoNnqasyyjiI1a5+T47KRN4E2NagWyCSActKOlRTnLl2 G682Cu1hSAGPGQETTJsW0ARVQRMzkCYg8TWk3j2Y6UWGiG61PUqQSPJOcJ6VgTBU39tWCCF85Cn zUCjIjnrRFu0gJEaZqJwYEAJOxZgqpEA+bpN5ttXtt8fHxZurO26+nXO01BJ+cq3oB6MkL3Ie0h VGQfhrNX7szYr5aog0JEu9DZU+82wR93lQkHGHTwoEkEYTisNWK3b67/RvTSWxuGcsi2cJl5eUR u+ygHv3abXVS8Ul3KepFLWXhmYWzWXzioK7OuIDzRmvebwSYGsMFCRbKF7cTg8wdIgH/WfQQmMf 2CCElXHjRIKuVyT94= X-Received: by 2002:a05:620a:a191:10b0:92e:f3ca:2eaf with SMTP id af79cd13be357-936d2011e7dmr2683153585a.11.1787061952304; Tue, 18 Aug 2026 07:05:52 -0700 (PDT) X-Received: by 2002:a05:620a:a191:10b0:92e:f3ca:2eaf with SMTP id af79cd13be357-936d2011e7dmr2683136685a.11.1787061951506; Tue, 18 Aug 2026 07:05:51 -0700 (PDT) Received: from shalem (2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:5bfa:a036:83f0:f9ec]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6a3d85a30b7sm1874967a12.30.2026.08.18.07.05.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2026 07:05:50 -0700 (PDT) From: Hans de Goede To: libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi , =?utf-8?q?Niklas_S=C3=B6?= =?utf-8?q?derlund?= , Loic Poulain , Hans de Goede , Kieran Bingham Subject: [PATCH v9 1/8] libcamera: Create IPA by name Date: Tue, 18 Aug 2026 16:05:41 +0200 Message-ID: <20260818140548.179663-2-johannes.goede@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260818140548.179663-1-johannes.goede@oss.qualcomm.com> References: <20260818140548.179663-1-johannes.goede@oss.qualcomm.com> MIME-Version: 1.0 X-Proofpoint-Spam-Info: AW1haW4tMjYwODE4MDEwMyBTYWx0ZWRfX/mJxtsPgP+oO mCE7wzCbow5Nlkr7QHEAF09hy28GsOAvTqliVZVvSO7N3b3Idp1y6DXVLGOrnonwIsMgip27QwB ZD975lRVGhxLIWHtaXgLEz0OsK1Xo0U= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODE4MDEwMyBTYWx0ZWRfX3Bq3PIcm+TZy ZkMfEAJGHiTIhdzitMV526Q3DTP9xUJk6jQs/xS2hXOyQl4YBtfK6MDXox4RlzqUKBbU7nmjw7O o55VLxt0afY2Zm8IdhkFD6Zjo7CElIA/sq13ZtMS9JNtZooImN2QMP57j+fOnM7k0YXNR88U1FZ ALRyVBN0di0rGsAeU/QjAzVCoA9XbFwcHIRRxm8eedQviyv4EzU2xozROvtthfTeu2zBmPEyzBk 2QXGwegFSpxQBBDqoT/rpIiEkM3wbtdxx/ErhVCX53o9ouhytKce58rvyi95eOgg4cTPMjB3dom PYPPnUA6VBbNPEDq4XpGjbAPmHShfiEx1NMmdyfcBbrIA0i2wk6TESU7pPtIy7v1RgFkcS5Vlz8 VZNHSMJvGizapeVO8fYpMho2ShRcTietEWfuRXEYSrrU80Si5nGj9IBkUhKeDYg4he8OZMoDskt vpFonhsWgkK0ePye+hQ== X-Proofpoint-ORIG-GUID: dTWVIraF5VvNz_Mf_dU_Bceo_7Xfvpf2 X-Authority-Analysis: v=2.4 cv=HNrz0Itv c=1 sm=1 tr=0 ts=6a8466c1 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=P1BnusSwAAAA:8 a=EUspDBNiAAAA:8 a=UNDMa8c6wnfCkPawyUwA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=bTQJ7kPSJx9SKPbeHEYW:22 a=D0XLA9XvdZm18NrgonBM:22 X-Proofpoint-GUID: dTWVIraF5VvNz_Mf_dU_Bceo_7Xfvpf2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293, Aquarius:18.0.1176, Hydra:6.1.134, FMLib:17.12.100.49 definitions=2026-08-18_02,2026-08-18_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 adultscore=0 malwarescore=0 phishscore=0 spamscore=0 bulkscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608180103 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" 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 a PipelineHandler::createIPA(name, minVer, maxVer) overload 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 PipelineHandler::createIPA(minVer, maxVer) overload. Reviewed-by: Kieran Bingham Tested-by: Niklas Söderlund Signed-off-by: Jacopo Mondi Signed-off-by: Hans de Goede Reviewed-by: Barnabás Pőcze --- Changes in v9: - Remove no longer needed PipelineHandler forward decl. from ipa_manager.h - Remove no longer needed pipeline_handler.h include from ipa_manager.cpp, ipa_module.[cpp|h] Changes in v5: - Rebase on top of db998e618aaa ("libcamera: pipeline_handler: Add createIPA() function") which moved the createIPA() wrapper for pipeline-handlers into the PipelineHandler class Changes in v4: - Rebase, change author to Hans' new email address Changes in v1 from Hans' original patch: - Slightly different approach addressing the review comments on Hans' v1 by creating an overload for PipelineHandler::createIPA() that allows pipelines to specify the IPA module name. --- include/libcamera/internal/ipa_manager.h | 7 +++--- include/libcamera/internal/ipa_module.h | 6 ++--- include/libcamera/internal/pipeline_handler.h | 9 ++++++- src/libcamera/ipa_manager.cpp | 9 +++---- src/libcamera/ipa_module.cpp | 16 ++++++------ src/libcamera/pipeline_handler.cpp | 25 +++++++++++++++++-- test/ipa/ipa_interface_test.cpp | 2 +- 7 files changed, 48 insertions(+), 26 deletions(-) diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h index aaa3ca37c..23c262b14 100644 --- a/include/libcamera/internal/ipa_manager.h +++ b/include/libcamera/internal/ipa_manager.h @@ -25,7 +25,6 @@ LOG_DECLARE_CATEGORY(IPAManager) class CameraManager; class GlobalConfiguration; class IPAModule; -class PipelineHandler; class IPAManager { @@ -34,10 +33,10 @@ public: ~IPAManager(); template - std::unique_ptr createIPA(PipelineHandler *pipe, uint32_t minVersion, + std::unique_ptr createIPA(const char *name, uint32_t minVersion, uint32_t maxVersion) { - IPAModule *m = module(pipe, minVersion, maxVersion); + IPAModule *m = module(name, minVersion, maxVersion); if (!m) return nullptr; @@ -68,7 +67,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 15f19492c..a4cfe864c 100644 --- a/include/libcamera/internal/ipa_module.h +++ b/include/libcamera/internal/ipa_module.h @@ -16,8 +16,6 @@ #include #include -#include "libcamera/internal/pipeline_handler.h" - namespace libcamera { class IPAModule : public Loggable @@ -36,8 +34,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/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h index 6922ce18e..b60c07b13 100644 --- a/include/libcamera/internal/pipeline_handler.h +++ b/include/libcamera/internal/pipeline_handler.h @@ -76,7 +76,14 @@ public: std::unique_ptr createIPA(uint32_t minVersion, uint32_t maxVersion) { IPAManager *ipaManager = manager_->_d()->ipaManager(); - return ipaManager->createIPA(this, minVersion, maxVersion); + return ipaManager->createIPA(name_, minVersion, maxVersion); + } + + template + std::unique_ptr createIPA(const char *ipaName, uint32_t minVersion, uint32_t maxVersion) + { + IPAManager *ipaManager = manager_->_d()->ipaManager(); + return ipaManager->createIPA(ipaName, minVersion, maxVersion); } protected: diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp index 41918e4c2..845a09f10 100644 --- a/src/libcamera/ipa_manager.cpp +++ b/src/libcamera/ipa_manager.cpp @@ -21,7 +21,6 @@ #include "libcamera/internal/global_configuration.h" #include "libcamera/internal/ipa_module.h" #include "libcamera/internal/ipa_proxy.h" -#include "libcamera/internal/pipeline_handler.h" /** * \file ipa_manager.h @@ -248,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(); } @@ -266,7 +265,7 @@ 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 + * \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 * diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index e6ea61e44..b7d770444 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -24,8 +24,6 @@ #include #include -#include "libcamera/internal/pipeline_handler.h" - /** * \file ipa_module.h * \brief Image Processing Algorithm module @@ -462,22 +460,22 @@ IPAInterface *IPAModule::createInterface() } /** - * \brief Verify if the IPA module matches a given pipeline handler - * \param[in] pipe Pipeline handler to match with + * \brief Verify if the IPA module matches a given name + * \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 diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index e7145c1d4..25fc11989 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -836,11 +836,32 @@ void PipelineHandler::disconnect() */ /** - * \fn PipelineHandler::createIPA() - * \brief Create an IPA proxy that matches this pipeline handler + * \fn PipelineHandler::createIPA(const char *ipaName, uint32_t minVersion, uint32_t maxVersion) + * \brief Create an IPA proxy that matches the requested name and version + * \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 ipaName 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 PipelineHandler::createIPA(uint32_t minVersion, uint32_t maxVersion) + * \brief Create an IPA proxy that matches the pipeline handler name and the + * requested version + * \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/test/ipa/ipa_interface_test.cpp b/test/ipa/ipa_interface_test.cpp index 271c4e2c9..0b01a396e 100644 --- a/test/ipa/ipa_interface_test.cpp +++ b/test/ipa/ipa_interface_test.cpp @@ -99,7 +99,7 @@ protected: EventDispatcher *dispatcher = thread()->eventDispatcher(); Timer timer; - ipa_ = ipaManager_->createIPA(pipe_.get(), 0, 0); + ipa_ = ipaManager_->createIPA(pipe_->name(), 0, 0); if (!ipa_) { cerr << "Failed to create VIMC IPA interface" << endl; return TestFail;