From patchwork Mon Jun 3 23:16:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1342 Return-Path: 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 AB2E1618F7 for ; Tue, 4 Jun 2019 01:16:50 +0200 (CEST) Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1038A84; Tue, 4 Jun 2019 01:16:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1559603810; bh=53Y8BE362kE9OW52XW2x8AqdWydCsOCRYMJe0Xtihvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vPt1Wj0M0/IQ2bvtbQwib4ZXjYVilcRZMWD4hFn3Dkk4N3qWmwLyMpo0NdzQC1kA6 1EMSc5XtOML9LySew0hJVzRMeNj/w55jM5KO+xAoLn5xMR8AFKNIKMQ9lstJrPb7nW xF+WnCX0VvpwYpMFxiszMPvi8xQB2Ce4sqMZmmmM= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 3 Jun 2019 19:16:32 -0400 Message-Id: <20190603231637.28554-6-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190603231637.28554-1-paul.elder@ideasonboard.com> References: <20190603231637.28554-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 05/10] libcamera: ipa_module: match IPA module with pipeline handler X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2019 23:16:51 -0000 Add a method to IPAModule to check if it matches with a given pipeline handler. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- New patch, but this IPAModule::match method used to be IPAManager::match src/libcamera/include/ipa_module.h | 4 ++++ src/libcamera/ipa_module.cpp | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/libcamera/include/ipa_module.h b/src/libcamera/include/ipa_module.h index 557435c..48ff2b6 100644 --- a/src/libcamera/include/ipa_module.h +++ b/src/libcamera/include/ipa_module.h @@ -13,6 +13,8 @@ #include #include +#include "pipeline_handler.h" + namespace libcamera { class IPAModule @@ -29,6 +31,8 @@ public: std::unique_ptr createInstance(); + bool match(PipelineHandler *pipe) const; + private: struct IPAModuleInfo info_; diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index 91d97ae..c1b04fe 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -18,6 +18,7 @@ #include #include "log.h" +#include "pipeline_handler.h" /** * \file ipa_module.h @@ -417,4 +418,22 @@ std::unique_ptr IPAModule::createInstance() return std::unique_ptr(ipaCreate_()); } +/** + * \brief Match this IPAModule with a PipelineHandler + * \param[in] pipe Pipeline handler to match with + * + * Checks if this IPA module matches the \a pipe pipeline handler. + * Matching is based on the fields of the IPA module info, and the + * corresponding attributes of the pipeline handler, such as pipeline version + * and name. + * + * \return true if the pipeline handler matches the IPA module, false otherwise + */ +bool IPAModule::match(PipelineHandler *pipe) const +{ + return info_.moduleAPIVersion == IPA_MODULE_API_VERSION && + info_.pipelineVersion == pipe->version() && + !strcmp(info_.pipelineName, pipe->name()); +} + } /* namespace libcamera */