pipeline: rkisp1: Forward controls passed to start() to the IPA
diff mbox series

Message ID 20261120140913.35315-1-advaitd@mechasystems.com
State New
Headers show
Series
  • pipeline: rkisp1: Forward controls passed to start() to the IPA
Related show

Commit Message

Advait Dhamorikar Nov. 20, 2026, 2:09 p.m. UTC
The rkisp1 pipeline handler applies the controls passed to
Camera::start() to the dewarper, but doesn't forward them to the IPA.
Controls handled by the IPA are thus ignored when set at start time. For
instance, the libcamerasrc GStreamer element sets FrameDurationLimits
from the negotiated caps framerate as a start control, so requesting a
framerate other than the default doesn't change the frame rate.

On an i.MX8MP with an IMX219 sensor, requesting framerate=60/1 through
libcamerasrc results in a 30 fps capture, while setting the same
FrameDurationLimits on the first request with cam results in 60 fps.

Store the start controls and merge them into the controls of the first
request queued to the IPA. Controls explicitly set in that request take
precedence. The application's Request is left unmodified.

Signed-off-by: Advait Dhamorikar <advaitd@mechasystems.com>
---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 25 ++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 39fe0f09..741e4e96 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -119,6 +119,7 @@  public:
 
 	std::unique_ptr<ipa::rkisp1::IPAProxyRkISP1> ipa_;
 
+	ControlList startControls_;
 	ControlInfoMap ipaControls_;
 
 	/*
@@ -1229,7 +1230,7 @@  int PipelineHandlerRkISP1::freeBuffers(Camera *camera)
 	return 0;
 }
 
-int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlList *controls)
+int PipelineHandlerRkISP1::start(Camera *camera, const ControlList *controls)
 {
 	RkISP1CameraData *data = cameraData(camera);
 	utils::ScopeExitActions actions;
@@ -1250,6 +1251,9 @@  int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL
 	actions += [&]() { data->ipa_->stop(); };
 
 	data->frame_ = 0;
+	data->startControls_.clear();
+	if (controls)
+		data->startControls_ = *controls;
 
 	if (!isRaw_) {
 		ret = param_->streamOn();
@@ -1346,7 +1350,24 @@  int PipelineHandlerRkISP1::queueRequestDevice(Camera *camera, Request *request)
 	if (!info)
 		return -ENOENT;
 
-	data->ipa_->queueRequest(data->frame_, request->controls());
+	if (!data->startControls_.empty()) {
+		/*
+		 * Apply the controls passed to Camera::start() with the first
+		 * request. Controls explicitly set in the request take
+		 * precedence. The application's request is left unmodified.
+		 */
+		ControlList controls = request->controls();
+		for (const auto &[id, value] : data->startControls_) {
+			if (!controls.contains(id))
+				controls.set(id, value);
+		}
+		data->startControls_.clear();
+
+		data->ipa_->queueRequest(data->frame_, controls);
+	} else {
+		data->ipa_->queueRequest(data->frame_, request->controls());
+	}
+
 	if (isRaw_) {
 		if (info->mainPathBuffer)
 			data->mainPath_->queueBuffer(info->mainPathBuffer);