[2/2] ipa: ipu3: Retain Camera::controls() after ipa->configure()
diff mbox series

Message ID 20260122-ipa-controls-v1-2-b8c4c345f7ae@ideasonboard.com
State Accepted
Commit ad2d317a0c15ad475844b239128360b605eb6d8f
Headers show
Series
  • ipa: Retain Camera::controls() after ipa->configure()
Related show

Commit Message

Jacopo Mondi Jan. 22, 2026, 5:48 p.m. UTC
Similar to what commit acfd60276763 ("ipa: rkisp1: Fix algorithm controls
vanish after configure") did for the RkISP1 IPA, replace the usage of
unordered_map::merge() at updateControls() time with
unordered_map::insert().

As unordered_map::merge moves items from the source map, it deletes
controls registered at algorithms initialization time in the
ipaContext.ctrlMap. As at configure() time updateControls() is called
again and the list of Camera controls is refreshed, the controls
registered at algorithms initialization time are lost.

Fixes: 87353f2bba28 ("ipa: ipu3: Derive ipu3::algorithms::Agc from AgcMeanLuminance")
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
 src/ipa/ipu3/ipu3.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Barnabás Pőcze Jan. 23, 2026, 12:22 p.m. UTC | #1
2026. 01. 22. 18:48 keltezéssel, Jacopo Mondi írta:
> Similar to what commit acfd60276763 ("ipa: rkisp1: Fix algorithm controls
> vanish after configure") did for the RkISP1 IPA, replace the usage of
> unordered_map::merge() at updateControls() time with
> unordered_map::insert().
> 
> As unordered_map::merge moves items from the source map, it deletes
> controls registered at algorithms initialization time in the
> ipaContext.ctrlMap. As at configure() time updateControls() is called
> again and the list of Camera controls is refreshed, the controls
> registered at algorithms initialization time are lost.
> 
> Fixes: 87353f2bba28 ("ipa: ipu3: Derive ipu3::algorithms::Agc from AgcMeanLuminance")
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> ---

Looks ok to me.

Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>


>   src/ipa/ipu3/ipu3.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> index b926f579a9a3..03d873f2c74f 100644
> --- a/src/ipa/ipu3/ipu3.cpp
> +++ b/src/ipa/ipu3/ipu3.cpp
> @@ -285,7 +285,7 @@ void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo,
>   							       frameDurations[1],
>   							       Span<const int64_t, 2>{ { frameDurations[2], frameDurations[2] } });
>   
> -	controls.merge(context_.ctrlMap);
> +	controls.insert(context_.ctrlMap.begin(), context_.ctrlMap.end());
>   	*ipaControls = ControlInfoMap(std::move(controls), controls::controls);
>   }
>   
>
Kieran Bingham Jan. 23, 2026, 3:26 p.m. UTC | #2
Quoting Jacopo Mondi (2026-01-22 17:48:29)
> Similar to what commit acfd60276763 ("ipa: rkisp1: Fix algorithm controls
> vanish after configure") did for the RkISP1 IPA, replace the usage of
> unordered_map::merge() at updateControls() time with
> unordered_map::insert().
> 
> As unordered_map::merge moves items from the source map, it deletes
> controls registered at algorithms initialization time in the
> ipaContext.ctrlMap. As at configure() time updateControls() is called
> again and the list of Camera controls is refreshed, the controls
> registered at algorithms initialization time are lost.
> 
> Fixes: 87353f2bba28 ("ipa: ipu3: Derive ipu3::algorithms::Agc from AgcMeanLuminance")
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/ipa/ipu3/ipu3.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> index b926f579a9a3..03d873f2c74f 100644
> --- a/src/ipa/ipu3/ipu3.cpp
> +++ b/src/ipa/ipu3/ipu3.cpp
> @@ -285,7 +285,7 @@ void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo,
>                                                                frameDurations[1],
>                                                                Span<const int64_t, 2>{ { frameDurations[2], frameDurations[2] } });
>  
> -       controls.merge(context_.ctrlMap);
> +       controls.insert(context_.ctrlMap.begin(), context_.ctrlMap.end());
>         *ipaControls = ControlInfoMap(std::move(controls), controls::controls);
>  }
>  
> 
> -- 
> 2.52.0
>

Patch
diff mbox series

diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index b926f579a9a3..03d873f2c74f 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -285,7 +285,7 @@  void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo,
 							       frameDurations[1],
 							       Span<const int64_t, 2>{ { frameDurations[2], frameDurations[2] } });
 
-	controls.merge(context_.ctrlMap);
+	controls.insert(context_.ctrlMap.begin(), context_.ctrlMap.end());
 	*ipaControls = ControlInfoMap(std::move(controls), controls::controls);
 }