From 961a6cf7cac9b788cc285a58ae1b8a480f00b633 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 2 Aug 2022 02:28:44 +0300 Subject: pipeline: rkisp1: Move ControlInfoMap to IPA module Currently the pipeline handler advertises controls handled by the IPA from a ControlInfoMap it manually constructs. This is wrong, as the IPA module is the component that knows what controls it supports. Fix this by moving the ControlInfoMap construction to the IPA module, and pass it to the pipeline handler as a return value from the IPA init() function. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Paul Elder Reviewed-by: Florian Sylvestre --- src/ipa/rkisp1/rkisp1.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'src/ipa/rkisp1/rkisp1.cpp') diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 0ebd69aa..6cf4d169 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -46,7 +46,8 @@ namespace ipa::rkisp1 { class IPARkISP1 : public IPARkISP1Interface, public Module { public: - int init(const IPASettings &settings, unsigned int hwRevision) override; + int init(const IPASettings &settings, unsigned int hwRevision, + ControlInfoMap *ipaControls) override; int start() override; void stop() override {} @@ -89,12 +90,27 @@ private: struct IPAContext context_; }; +namespace { + +/* List of controls handled by the RkISP1 IPA */ +const ControlInfoMap::Map rkisp1Controls{ + { &controls::AeEnable, ControlInfo(false, true) }, + { &controls::Brightness, ControlInfo(-1.0f, 0.993f) }, + { &controls::Contrast, ControlInfo(0.0f, 1.993f) }, + { &controls::Saturation, ControlInfo(0.0f, 1.993f) }, + { &controls::Sharpness, ControlInfo(0.0f, 10.0f, 1.0f) }, + { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }, +}; + +} /* namespace */ + std::string IPARkISP1::logPrefix() const { return "rkisp1"; } -int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision) +int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision, + ControlInfoMap *ipaControls) { /* \todo Add support for other revisions */ switch (hwRevision) { @@ -155,7 +171,15 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision) return -EINVAL; } - return createAlgorithms(context_, (*data)["algorithms"]); + int ret = createAlgorithms(context_, (*data)["algorithms"]); + if (ret) + return ret; + + /* Return the controls handled by the IPA. */ + ControlInfoMap::Map ctrlMap = rkisp1Controls; + *ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls); + + return 0; } int IPARkISP1::start() -- cgit v1.2.1