From patchwork Sun Jul 11 23:15:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12899 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 8EFCFC3225 for ; Sun, 11 Jul 2021 23:16:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4A1F168535; Mon, 12 Jul 2021 01:16:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="KAmpRc0G"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 00DEE68521 for ; Mon, 12 Jul 2021 01:16:38 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 96500CC for ; Mon, 12 Jul 2021 01:16:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1626045397; bh=7i4HOEzapnvHYF6XQkEnWY+0MyqAHYNtoz1Jtqu3Wg0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KAmpRc0G7uMPq8Dtnb7mxCb25s2LecqpKmQ+sqU/G353ninj6ZVr5J+HK+xvY6C6r CTX2IQrAIgn9hYk5egk33uM88GpqtSDDcj8QFhGwnG/K6LvLY4+Jg6GwyAg617uCd+ AvKjB+Dnhzc6VC3zCGtB/vbbwq7MnAUncFp/KWmw= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 12 Jul 2021 02:15:46 +0300 Message-Id: <20210711231547.19664-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210711231547.19664-1-laurent.pinchart@ideasonboard.com> References: <20210711231547.19664-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/3] libcamera: ipa_manager: Split common code out of createIPA() 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" The createIPA() template function starts with code that doesn't depend on the template parameters. Split it to a non-template function to avoid code duplication in the binary. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder --- include/libcamera/internal/ipa_manager.h | 13 ++++--------- src/libcamera/ipa_manager.cpp | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h index 42201839901b..0687842e5c06 100644 --- a/include/libcamera/internal/ipa_manager.h +++ b/include/libcamera/internal/ipa_manager.h @@ -34,15 +34,7 @@ public: uint32_t minVersion, uint32_t maxVersion) { - IPAModule *m = nullptr; - - for (IPAModule *module : self_->modules_) { - if (module->match(pipe, minVersion, maxVersion)) { - m = module; - break; - } - } - + IPAModule *m = self_->module(pipe, minVersion, maxVersion); if (!m) return nullptr; @@ -62,6 +54,9 @@ private: std::vector &files); unsigned int addDir(const char *libDir, unsigned int maxDepth = 0); + IPAModule *module(PipelineHandler *pipe, uint32_t minVersion, + uint32_t maxVersion); + bool isSignatureValid(IPAModule *ipa) const; std::vector modules_; diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp index b4606c6159e5..9533c8fadea6 100644 --- a/src/libcamera/ipa_manager.cpp +++ b/src/libcamera/ipa_manager.cpp @@ -245,6 +245,23 @@ unsigned int IPAManager::addDir(const char *libDir, unsigned int maxDepth) return count; } +/** + * \brief Retrieve and IPA module that matches a given pipeline handler + * \param[in] pipe The pipeline handler + * \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, + uint32_t maxVersion) +{ + for (IPAModule *module : modules_) { + if (module->match(pipe, minVersion, maxVersion)) + return module; + } + + return nullptr; +} + /** * \fn IPAManager::createIPA() * \brief Create an IPA proxy that matches a given pipeline handler