{"id":21805,"url":"https://patchwork.libcamera.org/api/1.1/patches/21805/?format=json","web_url":"https://patchwork.libcamera.org/patch/21805/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20241103152205.29219-8-hdegoede@redhat.com>","date":"2024-11-03T15:22:04","name":"[7/8] libcamera: ipa_manager: createIPA: Allow passing an IPA name to match","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"bf82feda4e1c66b0d20729f6a10a783424de53de","submitter":{"id":102,"url":"https://patchwork.libcamera.org/api/1.1/people/102/?format=json","name":"Hans de Goede","email":"hdegoede@redhat.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21805/mbox/","series":[{"id":4764,"url":"https://patchwork.libcamera.org/api/1.1/series/4764/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4764","date":"2024-11-03T15:21:57","name":"libcamera: Add swstats_cpu::processFrame() and atomisp pipeline handler","version":1,"mbox":"https://patchwork.libcamera.org/series/4764/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21805/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21805/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id A8ED1C330F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun,  3 Nov 2024 15:22:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B6BED653DA;\n\tSun,  3 Nov 2024 16:22:28 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DB1E1653CE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  3 Nov 2024 16:22:25 +0100 (CET)","from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n\t(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-185-kLRJeyN8NVG6Bb91802sKQ-1;\n\tSun, 03 Nov 2024 10:22:23 -0500","from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.15])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS\n\tid 59F661956089 for <libcamera-devel@lists.libcamera.org>;\n\tSun,  3 Nov 2024 15:22:22 +0000 (UTC)","from shalem.redhat.com (unknown [10.39.192.77])\n\tby mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id 0CDC11956086; Sun,  3 Nov 2024 15:22:20 +0000 (UTC)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"APG8+Ppc\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1730647344;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=/Ul2CwIQIe43/jHLyl3IL1ObmGF7/eBkuudzNWI5GcI=;\n\tb=APG8+PpcsQjyQOWhW1XPWGURac0NaBOd3OuRD8aGFCkcYv9yj6s2lSTmMzUzVFGQP93Cgi\n\tZEzo3yNusEY5gldZfzn0jXBFuQTsLO9A4J8Wn2MsQvEuJ6SWqIxFM4AvZz4ZHGuhWIn0lI\n\tofc4zs1Y0jCHfKTK9saw+JUEYX2TKVM=","X-MC-Unique":"kLRJeyN8NVG6Bb91802sKQ-1","From":"Hans de Goede <hdegoede@redhat.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Milan Zamazal <mzamazal@redhat.com>, Maxime Ripard <mripard@redhat.com>, \n\tHans de Goede <hdegoede@redhat.com>","Subject":"[PATCH 7/8] libcamera: ipa_manager: createIPA: Allow passing an IPA\n\tname 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","Content-Transfer-Encoding":"8bit","Content-Type":"text/plain; charset=\"US-ASCII\"; x-default=true","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Parts of the software ISP and the ipa_soft_simple.so IPA may be useful for\nmore then 1 pipeline handler.\n\nCurrently createIPA() / IPAManager::module() assume that there is a 1:1\nrelationship between pipeline handlers and IPAs and IPA matching is done\nbased on pipe->name().\n\nAdd an optional ipaName argument to createIPA() which when set overrides\npipe->name(), allowing pipeline handlers to request a different IPA.\n\nSigned-off-by: Hans de Goede <hdegoede@redhat.com>\n---\n include/libcamera/internal/ipa_manager.h | 11 ++++++++---\n include/libcamera/internal/ipa_module.h  |  2 +-\n src/libcamera/ipa_manager.cpp            |  7 ++++---\n src/libcamera/ipa_module.cpp             |  6 +++---\n 4 files changed, 16 insertions(+), 10 deletions(-)","diff":"diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h\nindex 16dede0c..1bbb0011 100644\n--- a/include/libcamera/internal/ipa_manager.h\n+++ b/include/libcamera/internal/ipa_manager.h\n@@ -33,11 +33,16 @@ public:\n \ttemplate<typename T>\n \tstatic std::unique_ptr<T> createIPA(PipelineHandler *pipe,\n \t\t\t\t\t    uint32_t minVersion,\n-\t\t\t\t\t    uint32_t maxVersion)\n+\t\t\t\t\t    uint32_t maxVersion,\n+\t\t\t\t\t    const char *ipaName = NULL)\n \t{\n \t\tCameraManager *cm = pipe->cameraManager();\n \t\tIPAManager *self = cm->_d()->ipaManager();\n-\t\tIPAModule *m = self->module(pipe, minVersion, maxVersion);\n+\n+\t\tif (!ipaName)\n+\t\t\tipaName = pipe->name();\n+\n+\t\tIPAModule *m = self->module(ipaName, minVersion, maxVersion);\n \t\tif (!m)\n \t\t\treturn nullptr;\n \n@@ -62,7 +67,7 @@ private:\n \t\t      std::vector<std::string> &files);\n \tunsigned int addDir(const char *libDir, unsigned int maxDepth = 0);\n \n-\tIPAModule *module(PipelineHandler *pipe, uint32_t minVersion,\n+\tIPAModule *module(const char *pipelineName, uint32_t minVersion,\n \t\t\t  uint32_t maxVersion);\n \n \tbool isSignatureValid(IPAModule *ipa) const;\ndiff --git a/include/libcamera/internal/ipa_module.h b/include/libcamera/internal/ipa_module.h\nindex 7c49d3f3..f732b0b0 100644\n--- a/include/libcamera/internal/ipa_module.h\n+++ b/include/libcamera/internal/ipa_module.h\n@@ -36,7 +36,7 @@ public:\n \n \tIPAInterface *createInterface();\n \n-\tbool match(PipelineHandler *pipe,\n+\tbool match(const char *pipelineName,\n \t\t   uint32_t minVersion, uint32_t maxVersion) const;\n \n protected:\ndiff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\nindex cfc24d38..a5427ef3 100644\n--- a/src/libcamera/ipa_manager.cpp\n+++ b/src/libcamera/ipa_manager.cpp\n@@ -243,15 +243,15 @@ unsigned int IPAManager::addDir(const char *libDir, unsigned int maxDepth)\n \n /**\n  * \\brief Retrieve an IPA module that matches a given pipeline handler\n- * \\param[in] pipe The pipeline handler\n+ * \\param[in] pipelineName The pipeline handler name\n  * \\param[in] minVersion Minimum acceptable version of IPA module\n  * \\param[in] maxVersion Maximum acceptable version of IPA module\n  */\n-IPAModule *IPAManager::module(PipelineHandler *pipe, uint32_t minVersion,\n+IPAModule *IPAManager::module(const char *pipelineName, uint32_t minVersion,\n \t\t\t      uint32_t maxVersion)\n {\n \tfor (IPAModule *module : modules_) {\n-\t\tif (module->match(pipe, minVersion, maxVersion))\n+\t\tif (module->match(pipelineName, minVersion, maxVersion))\n \t\t\treturn module;\n \t}\n \n@@ -264,6 +264,7 @@ IPAModule *IPAManager::module(PipelineHandler *pipe, uint32_t minVersion,\n  * \\param[in] pipe The pipeline handler that wants a matching IPA proxy\n  * \\param[in] minVersion Minimum acceptable version of IPA module\n  * \\param[in] maxVersion Maximum acceptable version of IPA module\n+ * \\param[in] ipaName overrides pipe->name() for IPA module matching if set\n  *\n  * \\return A newly created IPA proxy, or nullptr if no matching IPA module is\n  * found or if the IPA proxy fails to initialize\ndiff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp\nindex 9ca74be6..7392e356 100644\n--- a/src/libcamera/ipa_module.cpp\n+++ b/src/libcamera/ipa_module.cpp\n@@ -463,7 +463,7 @@ IPAInterface *IPAModule::createInterface()\n \n /**\n  * \\brief Verify if the IPA module matches a given pipeline handler\n- * \\param[in] pipe Pipeline handler to match with\n+ * \\param[in] pipelineName Pipeline handler name to match with\n  * \\param[in] minVersion Minimum acceptable version of IPA module\n  * \\param[in] maxVersion Maximum acceptable version of IPA module\n  *\n@@ -472,12 +472,12 @@ IPAInterface *IPAModule::createInterface()\n  *\n  * \\return True if the pipeline handler matches the IPA module, or false otherwise\n  */\n-bool IPAModule::match(PipelineHandler *pipe,\n+bool IPAModule::match(const char *pipelineName,\n \t\t      uint32_t minVersion, uint32_t maxVersion) const\n {\n \treturn info_.pipelineVersion >= minVersion &&\n \t       info_.pipelineVersion <= maxVersion &&\n-\t       !strcmp(info_.pipelineName, pipe->name());\n+\t       !strcmp(info_.pipelineName, pipelineName);\n }\n \n std::string IPAModule::logPrefix() const\n","prefixes":["7/8"]}