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

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

Commit Message

Daniel Scally Dec. 3, 2021, 10:42 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 v2:

	- Created a ControlList to hold the lensCtrls (Laurent)

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

Comments

Laurent Pinchart Dec. 4, 2021, 12:27 a.m. UTC | #1
Hi Daniel,

Thank you for the patch.

On Fri, Dec 03, 2021 at 10:42:30PM +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 v2:
> 
> 	- Created a ControlList to hold the lensCtrls (Laurent)
> 
>  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 3828650d..5c57797d 100644
> --- a/src/ipa/ipu3/ipu3.cpp
> +++ b/src/ipa/ipu3/ipu3.cpp
> @@ -174,6 +174,7 @@ private:
>  	uint32_t gain_;
>  	uint32_t minGain_;
>  	uint32_t maxGain_;
> +	uint32_t focus_;

I don't think you need to store focus_ here, as it's only used locally
in setControls().

>  
>  	utils::Duration lineDuration_;
>  
> @@ -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);
>  }
>
Daniel Scally Dec. 4, 2021, 9:41 p.m. UTC | #2
Hi Laurent

On 04/12/2021 00:27, Laurent Pinchart wrote:
> Hi Daniel,
> 
> Thank you for the patch.
> 
> On Fri, Dec 03, 2021 at 10:42:30PM +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 v2:
>>
>> 	- Created a ControlList to hold the lensCtrls (Laurent)
>>
>>  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 3828650d..5c57797d 100644
>> --- a/src/ipa/ipu3/ipu3.cpp
>> +++ b/src/ipa/ipu3/ipu3.cpp
>> @@ -174,6 +174,7 @@ private:
>>  	uint32_t gain_;
>>  	uint32_t minGain_;
>>  	uint32_t maxGain_;
>> +	uint32_t focus_;
> 
> I don't think you need to store focus_ here, as it's only used locally
> in setControls().

Righto - will do it in the v3
> 
>>  
>>  	utils::Duration lineDuration_;
>>  
>> @@ -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);
>>  }
>>  
>

Patch
diff mbox series

diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index 3828650d..5c57797d 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -174,6 +174,7 @@  private:
 	uint32_t gain_;
 	uint32_t minGain_;
 	uint32_t maxGain_;
+	uint32_t focus_;
 
 	utils::Duration lineDuration_;
 
@@ -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);
 }