[v6,23/24] ipa: libipa: agc: Do not run slower than 15fps by default
diff mbox series

Message ID 20261102101610.877390-24-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • ipa: libipa: agc: Take exposure margin into account
Related show

Commit Message

Barnabás Pőcze Nov. 2, 2026, 10:16 a.m. UTC
If the tuning file defines no exposure modes, then the "Maximize" mode will
be implicitly instantiated and used. But in this case, do not let the camera
run slower than 15fps, by default, unless the user explicitly requests it
using `FrameDurationLimits`.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
 src/ipa/libipa/agc.cpp | 12 ++++++++++++
 src/ipa/libipa/agc.h   |  4 ++++
 2 files changed, 16 insertions(+)

Patch
diff mbox series

diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
index d7c1faedd9..bd0143dbba 100644
--- a/src/ipa/libipa/agc.cpp
+++ b/src/ipa/libipa/agc.cpp
@@ -615,6 +615,8 @@  int AgcAlgorithm::init(const ValueNode &tuningData, CameraSensorHelper *sensor,
 		if (ret)
 			return ret;
 
+		tuning_.hasExposureModes = !agcConfig.exposureModeHelpers.empty();
+
 		addFallbacks(agcConfig);
 
 		impl_.emplace<AgcMeanLuminance>(std::move(agcConfig));
@@ -784,6 +786,16 @@  int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state,
 		state.minFrameDuration = std::clamp(
 			utils::Duration(1.0s / 30),
 			session.minFrameDuration, session.maxFrameDuration);
+
+		if (!tuning_.hasExposureModes) {
+			/*
+			 * By default do not run slower than 15fps
+			 * if no exposure modes are defined.
+			 */
+			state.maxFrameDuration = std::clamp(
+				utils::Duration(1.0s / 15),
+				state.minFrameDuration, session.maxFrameDuration);
+		}
 	}
 
 	/* \todo Move this to the `Camera` class. */
diff --git a/src/ipa/libipa/agc.h b/src/ipa/libipa/agc.h
index 3ca36aea64..d8057720d0 100644
--- a/src/ipa/libipa/agc.h
+++ b/src/ipa/libipa/agc.h
@@ -163,6 +163,10 @@  private:
 
 	std::variant<AgcMSV, AgcMeanLuminance> impl_;
 	CameraSensorHelper *sensor_ = nullptr;
+
+	struct {
+		bool hasExposureModes = false;
+	} tuning_;
 };
 
 } /* namespace ipa */