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

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

Commit Message

Daniel Scally Nov. 26, 2021, 12:31 a.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>
---
 src/ipa/ipu3/ipu3.cpp | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Laurent Pinchart Nov. 28, 2021, 10:23 p.m. UTC | #1
Hi Daniel,

Thank you for the patch.

On Fri, Nov 26, 2021 at 12:31:17AM +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>
> ---
>  src/ipa/ipu3/ipu3.cpp | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> index 6c76193a..abdcd69d 100644
> --- a/src/ipa/ipu3/ipu3.cpp
> +++ b/src/ipa/ipu3/ipu3.cpp
> @@ -173,6 +173,7 @@ private:
>  	uint32_t gain_;
>  	uint32_t minGain_;
>  	uint32_t maxGain_;
> +	uint32_t focus_;

Do we need this ?

>  
>  	utils::Duration lineDuration_;
>  
> @@ -671,6 +672,9 @@ 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;
> +	op.lensControls.set(V4L2_CID_FOCUS_ABSOLUTE, static_cast<int32_t>(focus_));

I think you need to create a ControlList first, like for the sensor
controls.

> +
>  	queueFrameAction.emit(frame, op);
>  }
>
Daniel Scally Dec. 3, 2021, 12:16 p.m. UTC | #2
Hi Laurent

On 28/11/2021 22:23, Laurent Pinchart wrote:
> Hi Daniel,
>
> Thank you for the patch.
>
> On Fri, Nov 26, 2021 at 12:31:17AM +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>
>> ---
>>  src/ipa/ipu3/ipu3.cpp | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
>> index 6c76193a..abdcd69d 100644
>> --- a/src/ipa/ipu3/ipu3.cpp
>> +++ b/src/ipa/ipu3/ipu3.cpp
>> @@ -173,6 +173,7 @@ private:
>>  	uint32_t gain_;
>>  	uint32_t minGain_;
>>  	uint32_t maxGain_;
>> +	uint32_t focus_;
> Do we need this ?


No more than exposure_ or gain_...I included it mostly for consistency.
It could become a variable in setControls() (it's useful to have there
to shorten the lines), but I think exposure_ and gain_ could too in that
case.


>>  
>>  	utils::Duration lineDuration_;
>>  
>> @@ -671,6 +672,9 @@ 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;
>> +	op.lensControls.set(V4L2_CID_FOCUS_ABSOLUTE, static_cast<int32_t>(focus_));
> I think you need to create a ControlList first, like for the sensor
> controls.


Ack; done now.

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

Patch
diff mbox series

diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index 6c76193a..abdcd69d 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -173,6 +173,7 @@  private:
 	uint32_t gain_;
 	uint32_t minGain_;
 	uint32_t maxGain_;
+	uint32_t focus_;
 
 	utils::Duration lineDuration_;
 
@@ -671,6 +672,9 @@  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;
+	op.lensControls.set(V4L2_CID_FOCUS_ABSOLUTE, static_cast<int32_t>(focus_));
+
 	queueFrameAction.emit(frame, op);
 }