From patchwork Wed Apr 8 11:56:03 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: 26503 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 2856DBDCBD for ; Wed, 8 Apr 2026 11:56:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DA21262E05; Wed, 8 Apr 2026 13:56:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.b="ZOXGJUKc"; dkim=pass (2048-bit key; unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="OVYxJS2n"; 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 7396362CE6 for ; Wed, 8 Apr 2026 13:56:14 +0200 (CEST) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 638B3JbF1314439 for ; Wed, 8 Apr 2026 11:56:12 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= ZeFap/o+BzZok25lJzZc2bbQ1DHpfD2gW77I8yesimo=; b=ZOXGJUKcarFF+oZX wykiGGD09/0CATmbPr6GZFS4/4dHkZ6dAIHsB4YVy1rjWYg8BYlRm977CPtNtpuj GJTl7jcoezsZ1H+nwKGQqAKo3G6bEmNpdB9rhvZ5ju3OBcy5DwhgOfIZa0psmEmp jREiC9vtmJRLqHgbTuIxtw/+ZoVEOgLzJ9Ls8N8pSV2+KGmHYHWd16mK6224JBpS /FmfCEPoWlmQ8F6+UIzeiXgyyTFd2AhN8OgEsodxo9tAqVWVEfFF2LpNVThg/+dV jrY9I+R7lRoMfUyocaPvH8iz4GhNlOAWsAtJXlmjra6ljlHbMkEgB6IgeTq3J+Oy pAc/hA== 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 4dd8d6k1ud-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 08 Apr 2026 11:56:12 +0000 (GMT) Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-50b4661881eso76311621cf.0 for ; Wed, 08 Apr 2026 04:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1775649371; x=1776254171; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZeFap/o+BzZok25lJzZc2bbQ1DHpfD2gW77I8yesimo=; b=OVYxJS2nqNi0xtT9MZYgf2ldKHt/sNLf4CtR7zMvFzyv0aFwQFjjejP28KRwwZK1v6 ec/t8yTVzSbD9iceJN23wLZAXDCyHclpvetoG175yCh//VsTgdgMwLY/7Y+SluAZ5s7R 60DaOHxOnWkCiLyq0ZsSHZqRZRnCyr3LAUsu4kWOGk8/gDX8twh6pYQnQK+CTrNduoa1 JANhOMF8WKUtI092GtwuTVZpGU+2rgi7DZiaGH652zCMmbY/hPLaKuWykDEPun/pjb3a XVrdg3ux3YZZ5iP08/YP4qT2A/hS4M67o8VXV0UmckIVPVn9+52PBOgPS2fxH9QBjGGG 9WfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775649371; x=1776254171; h=content-transfer-encoding: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; bh=ZeFap/o+BzZok25lJzZc2bbQ1DHpfD2gW77I8yesimo=; b=cB8Xno2BlFbK4l4Qt8vfYxrEDQT1P2BcSI0qWJ4q7d3P52NexsTPNdm9TTuJdVDozm f3cyQyswxsHxPZWSw+mKotnsSZkC4Ltw6ueofFumqVIl31jCFHClqboMnlpv9Vv+SihI V9tigWpgi03o/przi6oW42JskTRVc7xOK6Jswcq2hkCIxpVV0mYqktJidKLagHpk2bEy aCN2cK8mMR8tejIjm8UyNXKo9Ai68EJ+NtgFdrSEdVYv4ot9ZFikiasiWrs2peXgMStb 3nAW6JpdOULJ2+D57XyuyY9tkxKQ+8ISIY8JiRLR5BT/Ay/4ABfvh+6johVohQ89fDPf nS2A== X-Gm-Message-State: AOJu0YwmU0JK16Sh5JKpenUaljBaVylIFnGGZoV9GOnLcsmha/rKc0C8 Wz0DZPzZp/sQhqo8Cvu8lSIeyeBoNeatbcUVaSJN5okbcrinKWpRA79hZsldAd374zCRn0/dK1l 9eNm6o7xUrJQPsEe2wtFshX4Pb4fvhLZOgFihqOJaPBKAyUvwAhT31ozIdlGsLHhBWI9AtsSQ1h FGZ+Bl5s2M X-Gm-Gg: AeBDies0+MPgFVOYRdwaLBTGe+qslVw7Z/CotUjKgFsbrJQGD7DfF4GWU1SeskGFnxy mlZoLm+cfOlF83rPrj/yB6oxD0dDeuss+fPtwVi2aI35i4hC64fVJ+94SUsrwIUtjGpz5fbt62l RPGN8hWOFhdEJOlPFly6eo/HuaOReRUe9Kt9I7k+xZTeHolgN/Nja9/ffiqFg2yoSQHqwYvtFfS 2gDv9q6MAGwOFAsVyBvjs9tmt7Z0/APwZfSMT7USUsO6J0Z7wfRM3Pt8nG6O3a1hMp+JO5Renb9 ur+jraVbebCfBZ9xk7RjA0OyFoSA4Z1MZCByy23cluVbCrVvrnLYyLEVL51TmDb3zSrmXZmCcBH GKDWBZG812trMIud92VZmcPn94lpnoM4EreeAHULh4O1zOxY3cn7CzIlMBHHC0Ptb6f8Icyo7dR kVdvWc1TZqESPSqdPdvkuuFSw17dn6AGog X-Received: by 2002:ac8:7d11:0:b0:50d:65ec:a071 with SMTP id d75a77b69052e-50d65eca37cmr293008111cf.5.1775649371085; Wed, 08 Apr 2026 04:56:11 -0700 (PDT) X-Received: by 2002:ac8:7d11:0:b0:50d:65ec:a071 with SMTP id d75a77b69052e-50d65eca37cmr293007661cf.5.1775649370587; Wed, 08 Apr 2026 04:56:10 -0700 (PDT) Received: from t14s (2001-1c00-0c32-7800-07d4-cca3-ec08-7ac7.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:7d4:cca3:ec08:7ac7]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b9c3cec6c1csm639102066b.39.2026.04.08.04.56.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Apr 2026 04:56:09 -0700 (PDT) From: Hans de Goede To: libcamera-devel@lists.libcamera.org Cc: Loic Poulain , Hans de Goede , Jacopo Mondi , Kieran Bingham , =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH v4 1/4] libcamera: ipa_manager: Create IPA by name Date: Wed, 8 Apr 2026 13:56:03 +0200 Message-ID: <20260408115606.12417-2-johannes.goede@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260408115606.12417-1-johannes.goede@oss.qualcomm.com> References: <20260408115606.12417-1-johannes.goede@oss.qualcomm.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 2sijeyNDIAqrBOpweLPofam0ihl77cUo X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDA4MDExMCBTYWx0ZWRfX8bipDw8B3HZe JFxT7PXoFfehnT9Z71kv36wxTGiUxdMyErd/9qkAgrbhCn1lzN5UxZzNpD9E2Nh46tPyJKvVXd3 AOdSZVJUHwMQ9dUIIznEKZOzjZAeqj9OVZAhhHuGjR38txC3SeCPo27K+46IYSt7lgwirj3Yvrw Ehf3rJ0W5/ccV7879slqHuR/+bomN3/8qcW2aifjTa3OKTUTWS2Qmadp1kZq2QLcx3wCiZ8Fiuv 309uFwjAKPs/WeYPuBJ3o4OB2K8NHSo/EU9C92I4VjaA6KNRdiymDSjMfwq0UGBdv91wRnLUfN2 rAC9R5O3p/CwLuMOZAZEGJIh/t2YZ9N+HFUohnEq+NBnPyYcQebrg6SqSzSfNXRqMOPKfG1Sdjl LgUNUoj20f21VTtQWOV6n59vmVuVexpbs7TUVe4Hv6yeVzQIh1XE1lT76SMoinkmohJT6gWI5iH 9zKOtk0onpvR6QxcDKg== X-Authority-Analysis: v=2.4 cv=GN041ONK c=1 sm=1 tr=0 ts=69d6425c cx=c_pps a=JbAStetqSzwMeJznSMzCyw==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=P1BnusSwAAAA:8 a=EUspDBNiAAAA:8 a=TsfB_WN0WhEKZ-rE8qoA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=uxP6HrT_eTzRwkO_Te1X:22 a=D0XLA9XvdZm18NrgonBM:22 X-Proofpoint-GUID: 2sijeyNDIAqrBOpweLPofam0ihl77cUo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293, Aquarius:18.0.1143, Hydra:6.1.51, FMLib:17.12.100.49 definitions=2026-04-08_03,2026-04-08_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 phishscore=0 suspectscore=0 clxscore=1015 spamscore=0 adultscore=0 bulkscore=0 impostorscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604080110 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 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: Jacopo Mondi Reviewed-by: Kieran Bingham Tested-by: Niklas Söderlund Signed-off-by: Hans de Goede --- 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 f8ce78016..4c01e76f1 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 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/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp index 35171d097..f62a4ee5f 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 e6ea61e44..0bd6f1462 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