[RFC,v3,18/19] ipa: libipa: exposure_mode_helper: Add getter for max exp time
diff mbox series

Message ID 20261019184526.252977-19-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. 19, 2026, 6:45 p.m. UTC
Add a getter that can be used to retrieve the maximum "static"
exposure time (i.e. established by configuration, not by runtime
`setLimits()` calls).

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 src/ipa/libipa/exposure_mode_helper.cpp | 21 +++++++++++++++++++++
 src/ipa/libipa/exposure_mode_helper.h   |  2 ++
 2 files changed, 23 insertions(+)

Patch
diff mbox series

diff --git a/src/ipa/libipa/exposure_mode_helper.cpp b/src/ipa/libipa/exposure_mode_helper.cpp
index 13dce50c48..6345a47c54 100644
--- a/src/ipa/libipa/exposure_mode_helper.cpp
+++ b/src/ipa/libipa/exposure_mode_helper.cpp
@@ -10,6 +10,7 @@ 
 #include <variant>
 
 #include <libcamera/base/log.h>
+#include <libcamera/base/utils.h>
 
 /**
  * \file exposure_mode_helper.h
@@ -382,6 +383,26 @@  ExposureModeHelper::splitExposure(utils::Duration exposure, std::span<const Stag
 		 exposure / (exposureTime * gain * quantGain) };
 }
 
+/**
+ * \brief Retrieve the maximum stage exposure time
+ *
+ * \return The largest configured stage exposure time,
+ *         or a default constructed Duration object
+ *         if not stages are configured
+ */
+utils::Duration
+ExposureModeHelper::maxStageExposureTime() const
+{
+	return std::visit(utils::overloaded {
+		[](const auto &) {
+			return utils::Duration{};
+		},
+		[](const std::vector<Stage> &stages) {
+			return stages.back().exposureTime;
+		},
+	}, mode_);
+}
+
 } /* namespace ipa */
 
 } /* namespace libcamera */
diff --git a/src/ipa/libipa/exposure_mode_helper.h b/src/ipa/libipa/exposure_mode_helper.h
index a6cfb83880..ce140192b5 100644
--- a/src/ipa/libipa/exposure_mode_helper.h
+++ b/src/ipa/libipa/exposure_mode_helper.h
@@ -50,6 +50,8 @@  public:
 
 	[[nodiscard]] Result splitExposure(utils::Duration exposure) const;
 
+	[[nodiscard]] utils::Duration maxStageExposureTime() const;
+
 private:
 	utils::Duration clampExposureTime(utils::Duration exposureTime,
 					  double *quantizationGain = nullptr) const;