[libcamera-devel,v3,9/9] ipa: ipu3: Send lens controls to pipeline handler
diff mbox series

Message ID 20211207224512.753979-10-djrscally@gmail.com
State Superseded
Headers show
Series
  • Enumerate CameraLens by following sensor's ancillary links
Related show

Commit Message

Daniel Scally Dec. 7, 2021, 10:45 p.m. UTC
Pick up the focus value from the AF algorithm and send lens controls
along in the frame context.

Signed-off-by: Daniel Scally <djrscally@gmail.com>
---
Changes in v3:

	- Replaced the new focus_ member with a local variable.

 src/ipa/ipu3/ipu3.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Laurent Pinchart Dec. 8, 2021, 8:39 a.m. UTC | #1
Hi Dan,

Thank you for the patch.

On Tue, Dec 07, 2021 at 10:45:12PM +0000, Daniel Scally wrote:
> Pick up the focus value from the AF algorithm and send lens controls
> along in the frame context.
> 
> Signed-off-by: Daniel Scally <djrscally@gmail.com>
> ---
> Changes in v3:
> 
> 	- Replaced the new focus_ member with a local variable.
> 
>  src/ipa/ipu3/ipu3.cpp | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> index fe2bc3af..9303b33a 100644
> --- a/src/ipa/ipu3/ipu3.cpp
> +++ b/src/ipa/ipu3/ipu3.cpp
> @@ -663,6 +663,7 @@ void IPAIPU3::parseStatistics(unsigned int frame,
>   */
>  void IPAIPU3::setControls(unsigned int frame)
>  {
> +	uint32_t focus;
>  	IPU3Action op;
>  	op.op = ActionSetSensorControls;
>  
> @@ -674,6 +675,12 @@ void IPAIPU3::setControls(unsigned int frame)
>  	ctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain_));
>  	op.sensorControls = ctrls;
>  
> +	focus = context_.frameContext.af.focus;

	uint32_t focus = context_.frameContext.af.focus;

No need to declare all variables at the beginning of the function in
C++.

> +
> +	ControlList lensCtrls(lensCtrls_);
> +	lensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, static_cast<int32_t>(focus));
> +	op.lensControls = lensCtrls;

Or possibly even

	ControlList lensCtrls(lensCtrls_);
	lensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE,
		      static_cast<int32_t>(context_.frameContext.af.focus));
	op.lensControls = lensCtrls;

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +
>  	queueFrameAction.emit(frame, op);
>  }
>

Patch
diff mbox series

diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index fe2bc3af..9303b33a 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -663,6 +663,7 @@  void IPAIPU3::parseStatistics(unsigned int frame,
  */
 void IPAIPU3::setControls(unsigned int frame)
 {
+	uint32_t focus;
 	IPU3Action op;
 	op.op = ActionSetSensorControls;
 
@@ -674,6 +675,12 @@  void IPAIPU3::setControls(unsigned int frame)
 	ctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain_));
 	op.sensorControls = ctrls;
 
+	focus = context_.frameContext.af.focus;
+
+	ControlList lensCtrls(lensCtrls_);
+	lensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, static_cast<int32_t>(focus));
+	op.lensControls = lensCtrls;
+
 	queueFrameAction.emit(frame, op);
 }