[libcamera-devel,RFC,7/7] ipa: rkisp1: pass volatile lens controls to IPA
diff mbox series

Message ID 20230202111252.3366729-8-matthias.fend@emfend.at
State New
Headers show
Series
  • add support for more complex optics
Related show

Commit Message

Matthias Fend Feb. 2, 2023, 11:12 a.m. UTC
All v4l2 controls that may change by themselves (volatile) are passed to
the IPA.
An example for this can be the current actual position of the focus lens,
which is needed for an autofocus algorithm.

Signed-off-by: Matthias Fend <matthias.fend@emfend.at>
---
 include/libcamera/ipa/rkisp1.mojom       |  3 ++-
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 ++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

Patch
diff mbox series

diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom
index d33e93df..9ede5fde 100644
--- a/include/libcamera/ipa/rkisp1.mojom
+++ b/include/libcamera/ipa/rkisp1.mojom
@@ -33,7 +33,8 @@  interface IPARkISP1Interface {
 	[async] queueRequest(uint32 frame, libcamera.ControlList reqControls);
 	[async] fillParamsBuffer(uint32 frame, uint32 bufferId);
 	[async] processStatsBuffer(uint32 frame, uint32 bufferId,
-				   libcamera.ControlList sensorControls);
+				   libcamera.ControlList sensorControls,
+				   libcamera.ControlList lensControls);
 };
 
 interface IPARkISP1EventInterface {
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index e4f328cb..6073e5fa 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -1275,9 +1275,10 @@  void PipelineHandlerRkISP1::bufferReady(FrameBuffer *buffer)
 					metadata.timestamp);
 
 		if (isRaw_) {
+			const ControlList lensCtrls;
 			const ControlList &ctrls =
 				data->delayedCtrls_->get(metadata.sequence);
-			data->ipa_->processStatsBuffer(info->frame, 0, ctrls);
+			data->ipa_->processStatsBuffer(info->frame, 0, ctrls, lensCtrls);
 		}
 	} else {
 		if (isRaw_)
@@ -1319,8 +1320,15 @@  void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)
 	if (data->frame_ <= buffer->metadata().sequence)
 		data->frame_ = buffer->metadata().sequence + 1;
 
+	ControlInfoMap emptyInfoMap;
+	ControlList lensControls = ControlList(emptyInfoMap);
+	CameraLens *lens = data->sensor_->focusLens();
+	if (lens)
+		lensControls.merge(lens->getVolatileControls());
+
 	data->ipa_->processStatsBuffer(info->frame, info->statBuffer->cookie(),
-				       data->delayedCtrls_->get(buffer->metadata().sequence));
+				       data->delayedCtrls_->get(buffer->metadata().sequence),
+				       lensControls);
 }
 
 REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1)