[v1,01/33] libcamera: rkisp1: Only connect delayed controls at start/stop
diff mbox series

Message ID 20250930122726.1837524-2-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • Full dewarper support on imx8mp
Related show

Commit Message

Stefan Klug Sept. 30, 2025, 12:26 p.m. UTC
From: Kieran Bingham <kieran.bingham@ideasonboard.com>

The RKISP1 path may potentially have multiple cameras connected through
complex pipelines such as video multiplexors or multiple FPGA paths.

The RKISP1 pipeline handler notifies DelayedControls that a new frame is
commencing by using the frameStart event on the ISP and using that to
signal to DelayedControls that it is time to process the controls for
the next frame.

When more than one camera is connected to an ISP it is important not to
signal events to an inactive Camera.

Move the frameStart signal connection from CreateCamera() to start() and
introduce a corresponding disconnect at stop().

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index ecd13831539f..605a0724615d 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -1097,6 +1097,11 @@  int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL
 	utils::ScopeExitActions actions;
 	int ret;
 
+	isp_->frameStart.connect(data->delayedCtrls_.get(),
+				 &DelayedControls::applyControls);
+
+	actions += [&]() { isp_->frameStart.disconnect(data->delayedCtrls_.get()); };
+
 	/* Allocate buffers for internal pipeline usage. */
 	ret = allocateBuffers(camera);
 	if (ret)
@@ -1168,6 +1173,8 @@  void PipelineHandlerRkISP1::stopDevice(Camera *camera)
 
 	isp_->setFrameStartEnabled(false);
 
+	isp_->frameStart.disconnect(data->delayedCtrls_.get());
+
 	data->ipa_->stop();
 
 	if (hasSelfPath_)
@@ -1354,8 +1361,6 @@  int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)
 	data->delayedCtrls_ =
 		std::make_unique<DelayedControls>(data->sensor_->device(),
 						  params);
-	isp_->frameStart.connect(data->delayedCtrls_.get(),
-				 &DelayedControls::applyControls);
 
 	uint32_t supportedBlocks = kDefaultExtParamsBlocks;