From 42c9b4bad40b462ef267b477e136202f02071137 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Mon, 3 Jun 2019 13:20:23 -0400 Subject: libcamera: ipa_module: match IPA module with pipeline handler 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 --- src/libcamera/include/ipa_module.h | 5 +++++ src/libcamera/ipa_module.cpp | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/libcamera/include/ipa_module.h b/src/libcamera/include/ipa_module.h index 7ac5cad5..fec42371 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 5490f9b6..2663b9ef 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 @@ -391,4 +392,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 */ -- cgit v1.2.1