[libcamera-devel] [PATCH v1 9/9] libcamera: pipeline: raspberrypi: Don't handle any actions in stop state

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Jun 29 01:19:34 CEST 2020


The RPI_IPA_ACTION_V4L2_SET_ISP is handled regardless of the pipeline
handler state, but is only generated by the IPA when the pipeline is
running. Don't handle it in the stopped state, which simplifies the
handling of actions.

Additionally, handleState() is a no-op when the state is State::Stopped,
so don't call it in that case.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 .../pipeline/raspberrypi/raspberrypi.cpp      | 25 +++++++------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 137e07379cf5..2a5d27fefe0c 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1190,24 +1190,12 @@ int RPiCameraData::configureIPA()
 void RPiCameraData::queueFrameAction(unsigned int frame, const IPAOperationData &action)
 {
 	/*
-	 * The following actions can be handled when the pipeline handler is in
-	 * a stopped state.
+	 * Actions are only handled when the pipeline handler is not in a
+	 * stopped state.
 	 */
-	switch (action.operation) {
-	case RPI_IPA_ACTION_V4L2_SET_ISP: {
-		ControlList controls = action.controls[0];
-		isp_[Isp::Input].dev()->setControls(&controls);
-		goto done;
-	}
-	}
-
 	if (state_ == State::Stopped)
-		goto done;
+		return;
 
-	/*
-	 * The following actions must not be handled when the pipeline handler
-	 * is in a stopped state.
-	 */
 	switch (action.operation) {
 	case RPI_IPA_ACTION_V4L2_SET_STAGGERED: {
 		const ControlList &controls = action.controls[0];
@@ -1216,6 +1204,12 @@ void RPiCameraData::queueFrameAction(unsigned int frame, const IPAOperationData
 		break;
 	}
 
+	case RPI_IPA_ACTION_V4L2_SET_ISP: {
+		ControlList controls = action.controls[0];
+		isp_[Isp::Input].dev()->setControls(&controls);
+		break;
+	}
+
 	case RPI_IPA_ACTION_STATS_METADATA_COMPLETE: {
 		unsigned int bufferId = action.data[0];
 		FrameBuffer *buffer = isp_[Isp::Stats].getBuffers()->at(bufferId).get();
@@ -1253,7 +1247,6 @@ void RPiCameraData::queueFrameAction(unsigned int frame, const IPAOperationData
 		break;
 	}
 
-done:
 	handleState();
 }
 
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list