From b9b53845fe0cb69bbff85a261bb263ee72262043 Mon Sep 17 00:00:00 2001 From: Naushir Patuck Date: Tue, 6 Jan 2026 09:37:30 +0000 Subject: [PATCH] v4l2: v4l2_camera_proxy: Fix for getting default FrameDurationLimits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default values for controls::FrameDurationLimits is now an array but the v4l2 proxy is fetching it as a scalar value, causing a runtime error. Fix this by templating the getter with the correct Span type. This fix also requires the RPi initial default value for FrameDurationLimits to be specified as a Span. As a drive-by, remove the hard-coded 33ms min and 120ms max frame duration values in the initial defaults, and use the defaultMinFrameDuration and defaultMaxFrameDuration const values. This change is inconsequential to runtime operation as these always get overridden on the first camera configure call. Fixes: 4e9be7d11b9df ("ipa: ipu3, mali-c55, rkisp1, rpi: Fix reporting non-scalar controls") Closes: https://github.com/raspberrypi/libcamera/issues/321 Signed-off-by: Naushir Patuck Reviewed-by: Barnabás Pőcze Reviewed-by: Paul Elder Reviewed-by: David Plowman Signed-off-by: Barnabás Pőcze --- src/ipa/rpi/common/ipa_base.cpp | 6 ++++-- src/v4l2/v4l2_camera_proxy.cpp | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index 14aba450..32269498 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -84,8 +84,10 @@ const ControlInfoMap::Map ipaControls{ { &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) }, { &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }, { &controls::FrameDurationLimits, - ControlInfo(INT64_C(33333), INT64_C(120000), - static_cast(defaultMinFrameDuration.get())) }, + ControlInfo(static_cast(defaultMinFrameDuration.get()), + static_cast(defaultMaxFrameDuration.get()), + Span{ { static_cast(defaultMinFrameDuration.get()), + static_cast(defaultMinFrameDuration.get()) } }) }, { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }, { &controls::rpi::StatsOutputEnable, ControlInfo(false, true, false) }, }; diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 559ffc61..03cd4810 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -200,9 +200,9 @@ void V4L2CameraProxy::setFmtFromConfig(const StreamConfiguration &streamConfig) const auto &it = controls.find(&controls::FrameDurationLimits); if (it != controls.end()) { - const int64_t duration = it->second.def().get(); + Span duration = it->second.def().get>(); - v4l2TimePerFrame_.numerator = duration; + v4l2TimePerFrame_.numerator = duration[0]; v4l2TimePerFrame_.denominator = 1000000; } else { /*