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

Message ID 20261026132045.269007-23-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 Oct. 26, 2026, 1:20 p.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>
---
 src/ipa/libipa/agc.cpp | 8 ++++++++
 src/ipa/libipa/agc.h   | 4 ++++
 2 files changed, 12 insertions(+)

Patch
diff mbox series

diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
index 416178177e..90f51ff035 100644
--- a/src/ipa/libipa/agc.cpp
+++ b/src/ipa/libipa/agc.cpp
@@ -568,6 +568,8 @@  int AgcAlgorithm::init(const ValueNode &tuningData, CameraSensorHelper *sensor,
 		if (ret)
 			return ret;
 
+		tuning_.hasExposureStages = !agcMLconfig.exposureModeHelpers.empty();
+
 		fillMissing(agcMLconfig);
 
 		impl_.emplace<AgcMeanLuminance>(std::move(agcMLconfig));
@@ -737,6 +739,12 @@  int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state,
 		state.minFrameDuration = std::clamp(
 			utils::Duration(1.0s / 30),
 			session.minFrameDuration, session.maxFrameDuration);
+
+		if (!tuning_.hasExposureStages) {
+			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..44f5218b0c 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 hasExposureStages = false;
+	} tuning_;
 };
 
 } /* namespace ipa */