[libcamera-devel] [PATCH v2 4/8] libcamera: camera: Validate requests are completed in Running state

Niklas Söderlund niklas.soderlund at ragnatech.se
Sat Mar 13 00:26:01 CET 2021


Hi Kieran,

On 2021-03-12 05:47:23 +0000, Kieran Bingham wrote:
> All requests must have completed before the Camera has fully stopped.
> 
> Requests completing when the camera is not running represent an internal
> pipeline handler bug.
> 
> Trap this event with a fatal error.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

I like this change too, but sure this must break some of our pipelines?  
Even so they should then be fixed, for this change,

Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>

> ---
>  src/libcamera/camera.cpp | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
> index 84edbb8f494d..19fb9eb415b0 100644
> --- a/src/libcamera/camera.cpp
> +++ b/src/libcamera/camera.cpp
> @@ -1062,11 +1062,11 @@ int Camera::stop()
>  
>  	LOG(Camera, Debug) << "Stopping capture";
>  
> -	d->setState(Private::CameraConfigured);
> -
>  	d->pipe_->invokeMethod(&PipelineHandler::stop, ConnectionTypeBlocking,
>  			       this);
>  
> +	d->setState(Private::CameraConfigured);
> +
>  	return 0;
>  }
>  
> @@ -1079,6 +1079,12 @@ int Camera::stop()
>   */
>  void Camera::requestComplete(Request *request)
>  {
> +	Private *const d = LIBCAMERA_D_PTR();
> +
> +	int ret = d->isAccessAllowed(Private::CameraRunning);
> +	if (ret < 0)
> +		LOG(Camera, Fatal) << "Trying to complete a request when Stopped";
> +
>  	requestCompleted.emit(request);
>  }
>  
> -- 
> 2.25.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list