[libcamera-devel] [PATCH v5 09/12] pipeline: raspberrypi: Validate OptionalStream in queueRequestDevice()

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Jan 20 12:11:32 CET 2023


Quoting Naushir Patuck via libcamera-devel (2023-01-18 08:59:50)
> Add some validation in queueRequestDevice() to ensure that a frame buffer is
> provided in a Request if the MandatoryRequestBuffer flag has not been set in
> the StreamConfiguration for every configured stream.

I think this should be handled in the core. This shouldn't be pipeline
specific. We mustn't have different behaviours in different pipelines.

(That's why it's important we get this right globally)

--
Kieran

 
> Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> ---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 13d0ab4c4968..39f48e0a57fb 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -1153,6 +1153,13 @@ int PipelineHandlerRPi::queueRequestDevice(Camera *camera, Request *request)
>                         stream->setExternalBuffer(buffer);
>                 }
>  
> +               if (!(stream->configuration().hints & StreamConfiguration::Hint::OptionalStream) &&
> +                   !buffer) {
> +                       LOG(RPI, Error) << "No buffer provided for mandatory stream "
> +                                       << stream->name();
> +                       return -EINVAL;
> +               }
> +
>                 /*
>                  * If no buffer is provided by the request for this stream, we
>                  * queue a nullptr to the stream to signify that it must use an
> -- 
> 2.25.1
>


More information about the libcamera-devel mailing list