[v3,15/16] pipeline: rkisp1: Fix per-frame-controls in manual mode
diff mbox series

Message ID 20240319120517.362082-16-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • Preparation for per-frame-controls and initial tests
Related show

Commit Message

Stefan Klug March 19, 2024, 12:05 p.m. UTC
If the isp is not regulating, it can forward the request directly to the
pipeline handler which will then be able to feed the delayed controls early
enough.

This solutions is quite simplistic and will need more thoughts as soon as other
algorithms get implemented.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 src/ipa/rkisp1/rkisp1.cpp                | 16 ++++++++++++++--
 src/libcamera/pipeline/rkisp1/rkisp1.cpp |  2 +-
 2 files changed, 15 insertions(+), 3 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 6bc09198..240e11e6 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -322,6 +322,12 @@  void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls)
 			continue;
 		algo->queueRequest(context_, frame, frameContext, controls);
 	}
+
+	/* Fast path, if we are not regulating */
+	if (!frameContext.agc.autoEnabled) {
+		ControlList ctrls = getControls(frame);
+		setSensorControls.emit(frame, ctrls);
+	}
 }
 
 void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)
@@ -370,8 +376,14 @@  void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId
 		algo->process(context_, frame, frameContext, stats, metadata);
 	}
 
-	ControlList ctrls = getControls(frame);
-	setSensorControls.emit(frame, ctrls);
+	/*
+	 * Set controls only when we are actually regulation. Otherwise, the controls
+	 * where already set in queueRequest
+	 */
+	if (frameContext.agc.autoEnabled) {
+		ControlList ctrls = getControls(frame);
+		setSensorControls.emit(frame, ctrls);
+	}
 
 	metadataReady.emit(frame, metadata);
 }
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index abb21968..ab452d8f 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -401,7 +401,7 @@  void RkISP1CameraData::paramFilled(unsigned int frame)
 void RkISP1CameraData::setSensorControls([[maybe_unused]] unsigned int frame,
 					 const ControlList &sensorControls)
 {
-	delayedCtrls_->push(sensorControls);
+	delayedCtrls_->push(sensorControls, frame);
 }
 
 void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &metadata)