From patchwork Sun Nov 3 15:22:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 21805 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 A8ED1C330F for ; Sun, 3 Nov 2024 15:22:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B6BED653DA; Sun, 3 Nov 2024 16:22:28 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="APG8+Ppc"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DB1E1653CE for ; Sun, 3 Nov 2024 16:22:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730647344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/Ul2CwIQIe43/jHLyl3IL1ObmGF7/eBkuudzNWI5GcI=; b=APG8+PpcsQjyQOWhW1XPWGURac0NaBOd3OuRD8aGFCkcYv9yj6s2lSTmMzUzVFGQP93Cgi ZEzo3yNusEY5gldZfzn0jXBFuQTsLO9A4J8Wn2MsQvEuJ6SWqIxFM4AvZz4ZHGuhWIn0lI ofc4zs1Y0jCHfKTK9saw+JUEYX2TKVM= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-185-kLRJeyN8NVG6Bb91802sKQ-1; Sun, 03 Nov 2024 10:22:23 -0500 X-MC-Unique: kLRJeyN8NVG6Bb91802sKQ-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 59F661956089 for ; Sun, 3 Nov 2024 15:22:22 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.77]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0CDC11956086; Sun, 3 Nov 2024 15:22:20 +0000 (UTC) From: Hans de Goede To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Maxime Ripard , Hans de Goede Subject: [PATCH 7/8] libcamera: ipa_manager: createIPA: Allow passing an IPA name to match Date: Sun, 3 Nov 2024 16:22:04 +0100 Message-ID: <20241103152205.29219-8-hdegoede@redhat.com> In-Reply-To: <20241103152205.29219-1-hdegoede@redhat.com> References: <20241103152205.29219-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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" Parts of the software ISP and the ipa_soft_simple.so IPA may be useful for more then 1 pipeline handler. Currently createIPA() / IPAManager::module() assume that there is a 1:1 relationship between pipeline handlers and IPAs and IPA matching is done based on pipe->name(). Add an optional ipaName argument to createIPA() which when set overrides pipe->name(), allowing pipeline handlers to request a different IPA. Signed-off-by: Hans de Goede --- include/libcamera/internal/ipa_manager.h | 11 ++++++++--- include/libcamera/internal/ipa_module.h | 2 +- src/libcamera/ipa_manager.cpp | 7 ++++--- src/libcamera/ipa_module.cpp | 6 +++--- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h index 16dede0c..1bbb0011 100644 --- a/include/libcamera/internal/ipa_manager.h +++ b/include/libcamera/internal/ipa_manager.h @@ -33,11 +33,16 @@ public: template static std::unique_ptr createIPA(PipelineHandler *pipe, uint32_t minVersion, - uint32_t maxVersion) + uint32_t maxVersion, + const char *ipaName = NULL) { CameraManager *cm = pipe->cameraManager(); IPAManager *self = cm->_d()->ipaManager(); - IPAModule *m = self->module(pipe, minVersion, maxVersion); + + if (!ipaName) + ipaName = pipe->name(); + + IPAModule *m = self->module(ipaName, minVersion, maxVersion); if (!m) return nullptr; @@ -62,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 *pipelineName, 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 7c49d3f3..f732b0b0 100644 --- a/include/libcamera/internal/ipa_module.h +++ b/include/libcamera/internal/ipa_module.h @@ -36,7 +36,7 @@ public: IPAInterface *createInterface(); - bool match(PipelineHandler *pipe, + bool match(const char *pipelineName, uint32_t minVersion, uint32_t maxVersion) const; protected: diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp index cfc24d38..a5427ef3 100644 --- a/src/libcamera/ipa_manager.cpp +++ b/src/libcamera/ipa_manager.cpp @@ -243,15 +243,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] pipelineName The pipeline handler name * \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 *pipelineName, uint32_t minVersion, uint32_t maxVersion) { for (IPAModule *module : modules_) { - if (module->match(pipe, minVersion, maxVersion)) + if (module->match(pipelineName, minVersion, maxVersion)) return module; } @@ -264,6 +264,7 @@ IPAModule *IPAManager::module(PipelineHandler *pipe, uint32_t minVersion, * \param[in] pipe The pipeline handler that wants a matching IPA proxy * \param[in] minVersion Minimum acceptable version of IPA module * \param[in] maxVersion Maximum acceptable version of IPA module + * \param[in] ipaName overrides pipe->name() for IPA module matching if set * * \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 9ca74be6..7392e356 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -463,7 +463,7 @@ IPAInterface *IPAModule::createInterface() /** * \brief Verify if the IPA module matches a given pipeline handler - * \param[in] pipe Pipeline handler to match with + * \param[in] pipelineName Pipeline handler name to match with * \param[in] minVersion Minimum acceptable version of IPA module * \param[in] maxVersion Maximum acceptable version of IPA module * @@ -472,12 +472,12 @@ IPAInterface *IPAModule::createInterface() * * \return True if the pipeline handler matches the IPA module, or false otherwise */ -bool IPAModule::match(PipelineHandler *pipe, +bool IPAModule::match(const char *pipelineName, uint32_t minVersion, uint32_t maxVersion) const { return info_.pipelineVersion >= minVersion && info_.pipelineVersion <= maxVersion && - !strcmp(info_.pipelineName, pipe->name()); + !strcmp(info_.pipelineName, pipelineName); } std::string IPAModule::logPrefix() const