From patchwork Wed Aug 12 18:50:48 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: 27765 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 42271C3264 for ; Wed, 12 Aug 2026 18:51:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DD092682CF; Wed, 12 Aug 2026 20:51:05 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.b="BIvRMIdu"; dkim=pass (2048-bit key; unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="V+5Ks9GC"; dkim-atps=neutral Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id ADDE7682BC for ; Wed, 12 Aug 2026 20:51:03 +0200 (CEST) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67CI8sGd3338088 for ; Wed, 12 Aug 2026 18:51:02 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= LpVaJ8XyDdY3Z4NU4YyIFIuQGALht3poswTPE/FwpFY=; b=BIvRMIdu/l27KsXu g+nMGmhY6dDxtgVZfjoPFfQI5YRD7l72FWtHYRxc63wNFK4m4odi4pMjonZMvLFa TezyTPs8MqPpmOFwzbQEa/TRP0DCSi1GQHDqg60ThwJb6Wc+3z+qEXeR0o0NnEKm s4muwc139DVPxMzX+Xy7aXywX+fpfPnvRuiFfDNlj11IAQs+N+xJ5eFplbMArmYF Rg0z8xOW1d5ncTRW3RxDNgYxQz6x88SD98EYneMu3BuWyX9INZIbEn4fNCEVUbVT nbQpqgB8lky4q+ccXlkmOk3V94m79u/QZ7tCfrdoeP2NO67LekbHRFi2nuI9tOOD qTv7UQ== Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4g0hfw3q1w-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 12 Aug 2026 18:51:02 +0000 (GMT) Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-5174a23afcbso17782921cf.3 for ; Wed, 12 Aug 2026 11:51:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1786560662; x=1787165462; 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=LpVaJ8XyDdY3Z4NU4YyIFIuQGALht3poswTPE/FwpFY=; b=V+5Ks9GC8GOc3jpPmxDmqCzxT8I8D+YMpAnHRLztAAwVhIw8+vTZ/us5x9xt8ztz1p RB+D21CQOZQL+pQ5NmDWnooSLOjMm0+rva/m/WqW/uBE9qb5lHhk0z62Mydtha9/ZkhC FLa+o0hOUA8nC1X9f7ZTYM/B7xgUCalPuJFGlZBYLutu/zxqprDGdhK2TAU7WxYVuVKF 4sbvbdgX0w4Gu84eSHgHrH2xq0JJBsfv14mDQSS2mHtQNmwskA9Dc2TnUsvvDtnyr3Ru AABXoJf5pbnDsd3ML6Alhz3S9eIhlml3qsxm2pR6+A3UoE4K/5UNk1jMDKfInWV7LKtV rlYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786560662; x=1787165462; 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=LpVaJ8XyDdY3Z4NU4YyIFIuQGALht3poswTPE/FwpFY=; b=E3za7xZxoezdWBV6oT6MEjMkq/OSZmV4s9NZ8WqPxvwCey1hiLQHabbgk2WJLBZk4J FYrKrgiORcxWv1ufJ08oMMHrnex9VU3Z0QhNq/dgZ6AxFzlIml78lr4motIM9KJVJsQJ LkQC45OobDTgfzMNznaF1uedql15gZPStoVdLbJKRnMayxUXl0Cw7BFeRaa55NhRtVuc crvQ5rDb7SHo3fMWrdSBXGfTT57oCE28lQwaDAuvxqn7ndy1TSNePyWRepOmz73N6N8O UfFUedQwNlPfubnGoO3kPp4JdjOZFhf1WN4IG4MDhgYgiUyPIJr90xbo+xSSQyFNkC+s gFQw== X-Gm-Message-State: AOJu0Yx5LCDKEaM4GAc1P04w2+REPLCrkzBUb/7J4jLgXeZK3kHB3DYN 6RmiInt/I+eS7O6wJYHbdn3PK2SMWGaEFi0gkIJHd9ZBzc4azhUgye7B4QmekQg/trLBrt0H21V 8hlZnFL9Zim78bEDTDBkXukWKtdkS4cuscNb+/Hj0Luj90wcNGdK6d3O0xcy9WCtIRJwITbOA/j PaVXpoaKNw X-Gm-Gg: AR+sD11p7rEZx4eH5ARQbPZDmv2o3qyvmO5h/N4i96qQ63VzJy9P/8PlTKJPSahotLN X/ahuU70bbR6APHPt/Wsg5nMRAAbPB67LlNDRfYDLtpMqIyFbGK57myqMRGiGwvNbnE2/WMR4X1 cDo3wMFFVRBz1UOHZD3jVzORBoEVtjRMBkdJaUrehCILxkvt7zsNokxiR8RIWKGXD6xg70+ujUA Xr7HLXOFLQnfXCyBiaJ7RsgOLThu0+wkC/HxRDBm60aKhYr+NS0e8zdihlFFHRBDR9sPhh8xj8r lzzcL7hC/GoFs/FuN4sw6gDRj2L9fDP8alArYZok8A+gBUbHBSROAUFaShbfpYuvxgM1JX+Ou/+ 7CHToW2pj/5pxQDBhpfByDe8xdh04oAjiiMqnbSN/WR2c9J1lPg8/TYaHkp1AtJLwYgcOzP5Aa+ zT3wD/n8icAFgsoBY= X-Received: by 2002:a05:622a:1925:b0:51c:164b:b241 with SMTP id d75a77b69052e-52d73c4f679mr3642901cf.13.1786560661541; Wed, 12 Aug 2026 11:51:01 -0700 (PDT) X-Received: by 2002:a05:622a:1925:b0:51c:164b:b241 with SMTP id d75a77b69052e-52d73c4f679mr3642311cf.13.1786560660985; Wed, 12 Aug 2026 11:51:00 -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-6a37f8cd810sm47977a12.26.2026.08.12.11.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2026 11:50:59 -0700 (PDT) From: Hans de Goede To: libcamera-devel@lists.libcamera.org Cc: Loic Poulain , Hans de Goede , Kieran Bingham , =?utf-8?q?Niklas_S=C3=B6derlund?= , Jacopo Mondi Subject: [PATCH v7 1/8] libcamera: Create IPA by name Date: Wed, 12 Aug 2026 20:50:48 +0200 Message-ID: <20260812185055.289021-2-johannes.goede@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260812185055.289021-1-johannes.goede@oss.qualcomm.com> References: <20260812185055.289021-1-johannes.goede@oss.qualcomm.com> MIME-Version: 1.0 X-Proofpoint-Spam-Info: AW1haW4tMjYwODEyMDE1MSBTYWx0ZWRfX++lHAG6mkJVz ITKSqkOKCD0E0NAq+Pu+y29H5KRgOsP1WiEoBt/mS0TY6qdt/zflWO2c/h5n/tuJq4VayCpgcVI hVj1RAUFUBap7If0eaSmc1kuDkuBHrI= X-Proofpoint-GUID: KNfHnaG8zZH2oIz0aM1WnPqTSb-h89pV X-Authority-Analysis: v=2.4 cv=fpDsol4f c=1 sm=1 tr=0 ts=6a7cc096 cx=c_pps a=JbAStetqSzwMeJznSMzCyw==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=P1BnusSwAAAA:8 a=EUspDBNiAAAA:8 a=rl81jYYfPRFGC34jM1YA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=uxP6HrT_eTzRwkO_Te1X:22 a=D0XLA9XvdZm18NrgonBM:22 X-Proofpoint-ORIG-GUID: KNfHnaG8zZH2oIz0aM1WnPqTSb-h89pV X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODEyMDE1MSBTYWx0ZWRfX5Ehd7m5QHPCa KrXFAYm739eQcG/Hu1hTEHw40Re796bGT2P0N4ygIdciv0s73IgQYqdv8VXEWd2SblBcti+QRdR FqbkeYtEafYcnlBJ0X4dcAojZEfVPAwBdMXXmEd6ZE8hpU2mn9k+1YkHk+GaflIuT53puY+EYqK lwNHvEZh/cZbJ/dXulOHKGkUxSHPFZ9K/eK89o+Rnhd/BWktr34MdSDb0+QVTeoIiwvVjoGcMuA OZJaZo9wUBhFa9KYHaq+F8OKWjnPUFUVrPCzseKQq1cERYrhgL+QmgnsumRZhoeXvXoEY68pojz oFgb+DhKq75N0bLOQBEM5N3q/h89yqtHcZpnUT6gZZBVBgQixkHp41DKf3YUI9b+qQGgk89lLky rfp/TxLu5fCt9eTXuQpRrgKZ/TVMx6k35i+n1ikouJhVhiYiqEtzmjka+AWRPtbBOCRIJcaqTu2 2urC/HzqjOCxeA4kRLg== 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-12_05,2026-08-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 spamscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 malwarescore=0 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608120151 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 --- 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 | 6 ++--- include/libcamera/internal/ipa_module.h | 4 +-- include/libcamera/internal/pipeline_handler.h | 9 ++++++- src/libcamera/ipa_manager.cpp | 8 +++--- src/libcamera/ipa_module.cpp | 14 +++++------ src/libcamera/pipeline_handler.cpp | 25 +++++++++++++++++-- test/ipa/ipa_interface_test.cpp | 2 +- 7 files changed, 48 insertions(+), 20 deletions(-) diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h index aaa3ca37c..7ab193112 100644 --- a/include/libcamera/internal/ipa_manager.h +++ b/include/libcamera/internal/ipa_manager.h @@ -34,10 +34,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 +68,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..a0a53764e 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/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..b709a024e 100644 --- a/src/libcamera/ipa_manager.cpp +++ b/src/libcamera/ipa_manager.cpp @@ -248,15 +248,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 +266,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..c89887954 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -462,22 +462,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;