[v2,11/12] pipeline: rkisp1: Fix per-frame-controls in manual mode
diff mbox series

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

Commit Message

Stefan Klug March 13, 2024, 12:12 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 71db2ae7..8780abc9 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -321,6 +321,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)
@@ -369,8 +375,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 586b46d6..3e061b52 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_->pushForFrame(frame, sensorControls);
 }
 
 void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &metadata)