[libcamera-devel] [PATCH v5 14/23] libcamera: raspberrypi: Set default configuration size at validation

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Jul 9 21:17:07 CEST 2020


Hi Paul,

(CC'ing Naush)

Thank you for the patch.

On Thu, Jul 09, 2020 at 10:28:26PM +0900, Paul Elder wrote:
> If a native format is not found, a default NV12 format is set. However,
> this does not set a default configuration size, sometimes resulting in a
> 0x0 size. Fix this by setting a default configuration size.
> 
> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
> 
> ---
> New in v5, split from "libcamera: raspberrypi: Fill stride and frameSize
> at config validation"
> ---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index a08ad6a..5f00500 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -500,6 +500,9 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()
>  		if (fmts.find(V4L2PixelFormat::fromPixelFormat(cfgPixFmt, false)) == fmts.end()) {
>  			/* If we cannot find a native format, use a default one. */
>  			cfgPixFmt = formats::NV12;
> +			cfg.size.width = 1920;
> +			cfg.size.height = 1080;
> +

Is this the right fix ? Someone could pass an unsupported pixel format
with a valid size, or the other way around, a valid pixel format with a
null size. It seems to me that you should clamp the size based on the
sensor resolution and the scaler capabilities.

>  			status = Adjusted;
>  		}
>  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list