From patchwork Wed Jun 5 00:53:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1354 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 32B9D64723 for ; Wed, 5 Jun 2019 02:53:32 +0200 (CEST) Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 57CA62D1; Wed, 5 Jun 2019 02:53:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1559696011; bh=d5RStYmQgp2dyUwQv6sD0WwJcVGkJn/hWKI80THwihQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L4YE9CUieAeggNSWmBW7Mpqnx7VkFnNooaDUEBvz8gNv6zEreF5XIcVnFhtiLlB9J sH+o4nL3zfDvSmgv4t+jgXdDg6ZkhXX1x5DlBV2Rx2oUM/4hw5z+VIC2jQa7vvccfM oECHAJ7mkcMwiP3wBgilZ4a2NHqyZwpllL1fFR5k= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Tue, 4 Jun 2019 20:53:12 -0400 Message-Id: <20190605005316.4835-7-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190605005316.4835-1-paul.elder@ideasonboard.com> References: <20190605005316.4835-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 06/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: Wed, 05 Jun 2019 00:53:32 -0000 Add a method to IPAModule to check if it matches with a given pipeline handler and pipeline version range. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- Changes in v3: - match() now takes a version range from the caller to match against, instead of getting a version number from the pipeline handler input v2: New patch, but this IPAModule::match method used to be IPAManager::match src/libcamera/include/ipa_module.h | 5 +++++ src/libcamera/ipa_module.cpp | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/libcamera/include/ipa_module.h b/src/libcamera/include/ipa_module.h index 7ac5cad..fec4237 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,9 @@ public: std::unique_ptr createInstance(); + bool match(PipelineHandler *pipe, + uint32_t minVersion, uint32_t maxVersion) const; + private: struct IPAModuleInfo info_; diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index 8ec4e5a..09e96b4 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 @@ -389,4 +390,23 @@ std::unique_ptr IPAModule::createInstance() return std::unique_ptr(ipaCreate_()); } +/** + * \brief Verify if the IPA module maches a given pipeline handler + * \param[in] pipe Pipeline handler to match with + * \param[in] minVersion Minimum acceptable version of IPA module + * \param[in] maxVersion Maximum acceptable version of IPA module + * + * This method checks if this IPA module matches the \a pipe pipeline handler, + * and the input version range. + * + * \return True if the pipeline handler matches the IPA module, or false otherwise + */ +bool IPAModule::match(PipelineHandler *pipe, + uint32_t minVersion, uint32_t maxVersion) const +{ + return info_.pipelineVersion >= minVersion && + info_.pipelineVersion <= maxVersion && + !strcmp(info_.pipelineName, pipe->name()); +} + } /* namespace libcamera */