[libcamera-devel] [PATCH 2/3] libcamera: ipu3: Do not re-queue failed buffers

Kieran Bingham kieran.bingham at ideasonboard.com
Mon Jul 15 09:10:37 CEST 2019


Hi Jacopo,

On 15/07/2019 06:59, Jacopo Mondi wrote:
> When a video device is stopped all the buffers there queued are
> released and their state is set to failure.
> 
> Currently, on buffer completion, failed buffers are blindly re-queued to
> the ImgU input or CIO2 output devices, preventing them to be re-started
> succesfully in future capture sessions.

s/succesfully/successfully/

> 
> Fix that by inspecting the buffers status and skip re-queueing if
> they're reported as failing. For the ImgU output buffers this is not
> required, as failed buffes should be anyhow delivered to applications in

s/buffes/buffers/

> order to report their failure.
> 

Will this patch lead to us 'leaking' buffers if they are failed for some
reason (other than stopping the pipeline) - leading to a complete
pipeline stall?

--
Kieran


> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> ---
>  src/libcamera/pipeline/ipu3/ipu3.cpp | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 5204487684c2..11bf3af66ae6 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -916,6 +916,9 @@ int PipelineHandlerIPU3::registerCameras()
>   */
>  void IPU3CameraData::imguInputBufferReady(Buffer *buffer)
>  {
> +	if (buffer->status() != Buffer::BufferSuccess)
> +		return;
> +
>  	cio2_.output_->queueBuffer(buffer);
>  }
>  
> @@ -946,6 +949,9 @@ void IPU3CameraData::imguOutputBufferReady(Buffer *buffer)
>   */
>  void IPU3CameraData::cio2BufferReady(Buffer *buffer)
>  {
> +	if (buffer->status() != Buffer::BufferSuccess)
> +		return;
> +
>  	imgu_->input_->queueBuffer(buffer);
>  }
>  
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list