From 9f1c38e2609cd8689aab901402188cd223c223b5 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Wed, 4 Aug 2021 16:47:44 +0100 Subject: ipa: ipu3: Move the ipu3_uapi_params The ipu3_uapi_params are part of the IPA context referenced by the algorithms. Move the structure into the IPAContext directly and adapt existing algorithm implementations. Signed-off-by: Kieran Bingham --- src/ipa/ipu3/ipa_context.h | 2 +- src/ipa/ipu3/ipu3.cpp | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h index 6cf85524..5d717be5 100644 --- a/src/ipa/ipu3/ipa_context.h +++ b/src/ipa/ipu3/ipa_context.h @@ -20,7 +20,7 @@ struct IPAContext { const ipu3_uapi_stats_3a *stats; /* Output Parameters which will be written to the hardware */ - ipu3_uapi_params *params; + ipu3_uapi_params params; }; } /* namespace ipa::ipu3 */ diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index d37cdda7..1d89c28b 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -91,7 +91,6 @@ private: std::list algorithms_; /* Local parameter storage */ - struct ipu3_uapi_params params_; struct ipu3_uapi_grid_config bdsGrid_; struct IPAContext context_; }; @@ -104,12 +103,6 @@ int IPAIPU3::init(const IPASettings &settings) return -ENODEV; } - /* - * This may require better linking, or it could simply be moved into the - * context structure entirely. (Moving it makes more sense) - */ - context_.params = ¶ms_; - initialiseAlgorithms(); return 0; @@ -211,14 +204,19 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo) defVBlank_ = itVBlank->second.def().get(); - params_ = {}; + /* Reset all the hardware settings */ + context_.params = {}; calculateBdsGrid(configInfo.bdsOutputSize); + /* + * Algorithms are responsible for initialising all parameter settings + * at configure time. + */ configureAlgorithms(); awbAlgo_ = std::make_unique(); - awbAlgo_->initialise(params_, configInfo.bdsOutputSize, bdsGrid_); + awbAlgo_->initialise(context_.params, configInfo.bdsOutputSize, bdsGrid_); agcAlgo_ = std::make_unique(); agcAlgo_->initialise(bdsGrid_, sensorInfo_); @@ -296,9 +294,9 @@ void IPAIPU3::processControls([[maybe_unused]] unsigned int frame, void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params) { if (agcAlgo_->updateControls()) - awbAlgo_->updateWbParameters(params_, agcAlgo_->gamma()); + awbAlgo_->updateWbParameters(context_.params, agcAlgo_->gamma()); - *params = params_; + *params = context_.params; IPU3Action op; op.op = ActionParamFilled; -- cgit v1.2.1