[libcamera-devel] [PATCH v2 7/8] libcamera: pipeline: ipu3: Ensure no requests are pending at stop()

Jacopo Mondi jacopo at jmondi.org
Sat Mar 13 10:40:27 CET 2021


Hi Kieran

On Fri, Mar 12, 2021 at 05:47:26AM +0000, Kieran Bingham wrote:
> The Pipeline handlers are responsible for making sure that all work
> is completed during the stop call, and all requests and resources
> should be released back to the application.
>
> Add an assertion to guarantee that there are no pending requests
> before returning from ::stop()
>
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
>
> ---
> RFC? Ideally this should be handled by the base pipeline handler so that
> the same guarantee applies to all pipeline handlers. But we don't
> currently call into the base class during stop.

I wonder if this plays a role with my comment on making requests
completed when the Camera is moved to Configured triggering a Fatal.

More generally, how can we guarantee the queue of requests have been
emptied when stop() is called ? I don't think it's that unlikely that
the requests queue is !empty when applications call stop(), isn't it ?
>
>  src/libcamera/pipeline/ipu3/ipu3.cpp | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 7ab3a5bfdccb..c5facaea16dd 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -771,6 +771,14 @@ void PipelineHandlerIPU3::stop(Camera *camera)
>  	if (ret)
>  		LOG(IPU3, Warning) << "Failed to stop camera " << camera->id();
>
> +	/*
> +	 * All requests must have completed before releaseing buffers.
> +	 * \todo: Ensure all pipeline handlers guarantee queuedRequests is emtpy
> +	 * at the end of stop().
> +	 */
> +	if (!data->queuedRequests_.empty())
> +		LOG(IPU3, Fatal) << "There are still requests to complete.";
> +
>  	freeBuffers(camera);
>  }
>
> --
> 2.25.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel


More information about the libcamera-devel mailing list