[libcamera-devel] [PATCH] libcamera: ipu3: Get request from information structure instead of buffer

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Feb 8 16:23:40 CET 2021


Hi Niklas,

Thank you for the patch.

On Fri, Feb 05, 2021 at 09:43:03PM +0100, Niklas Söderlund wrote:
> Buffers dequeued from the ImgU may not be associated with a Request as
> they are internal (statistics, parameters and some RAW buffers). Fetch
> the request they are used for from the frame information instead.
> 
> Fixes: 9708f49fecf2f9ee ("libcamera: ipu3: Share parameter and statistic buffers with IPA")
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
>  src/libcamera/pipeline/ipu3/ipu3.cpp | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index c3763507c40a5d53..48f0a81f0634d424 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -1109,14 +1109,14 @@ void IPU3CameraData::queueFrameAction(unsigned int id,
>   */
>  void IPU3CameraData::imguOutputBufferReady(FrameBuffer *buffer)
>  {
> -	Request *request = buffer->request();
> +	IPU3Frames::Info *info = frameInfos_.find(buffer);
> +	if (!info)
> +		return;
> +
> +	Request *request = info->request;
>  
>  	pipe_->completeBuffer(request, buffer);
>  
> -	IPU3Frames::Info *info = frameInfos_.find(buffer);
> -	if (!info)
> -		return;
> -

Do I understand correctly that this change isn't strictly required since
the ImgU output buffers are always part of a request ? Still, it's good
to keep the implementation consistent.

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

>  	request->metadata().set(controls::draft::PipelineDepth, 3);
>  	/* \todo Move the ExposureTime control to the IPA. */
>  	request->metadata().set(controls::ExposureTime, exposureTime_);
> @@ -1146,7 +1146,7 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)
>  	if (!info)
>  		return;
>  
> -	Request *request = buffer->request();
> +	Request *request = info->request;
>  
>  	/* If the buffer is cancelled force a complete of the whole request. */
>  	if (buffer->metadata().status == FrameMetadata::FrameCancelled) {
> @@ -1175,7 +1175,7 @@ void IPU3CameraData::paramBufferReady(FrameBuffer *buffer)
>  
>  	info->paramDequeued = true;
>  	if (frameInfos_.tryComplete(info))
> -		pipe_->completeRequest(buffer->request());
> +		pipe_->completeRequest(info->request);
>  }
>  
>  void IPU3CameraData::statBufferReady(FrameBuffer *buffer)
> @@ -1187,7 +1187,7 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer)
>  	if (buffer->metadata().status == FrameMetadata::FrameCancelled) {
>  		info->metadataProcessed = true;
>  		if (frameInfos_.tryComplete(info))
> -			pipe_->completeRequest(buffer->request());
> +			pipe_->completeRequest(info->request);
>  		return;
>  	}
>  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list