[libcamera-devel] [PATCH 07/15] v4l2: v4l2_camera_proxy: Fix v4l2-compliance format tests

Jacopo Mondi jacopo at jmondi.org
Wed Jun 17 16:59:31 CEST 2020


Hi Paul,

On Tue, Jun 16, 2020 at 10:12:36PM +0900, Paul Elder wrote:
> Fix v4l2-compliance format tests, for enum_fmt, try_fmt, and g/s_fmt.
>
> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
> ---
>  src/v4l2/v4l2_camera_proxy.cpp | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
> index a5fa478..fd2785f 100644
> --- a/src/v4l2/v4l2_camera_proxy.cpp
> +++ b/src/v4l2/v4l2_camera_proxy.cpp
> @@ -179,6 +179,9 @@ void V4L2CameraProxy::setFmtFromConfig(StreamConfiguration &streamConfig)
>  			  curV4L2Format_.fmt.pix.width,
>  			  curV4L2Format_.fmt.pix.height);
>  	curV4L2Format_.fmt.pix.colorspace = V4L2_COLORSPACE_SRGB;
> +	curV4L2Format_.fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;
> +	curV4L2Format_.fmt.pix.ycbcr_enc = V4L2_YCBCR_ENC_601;
> +	curV4L2Format_.fmt.pix.quantization = V4L2_QUANTIZATION_LIM_RANGE;

Any specific reason why you chose these encoding and quantization ?
Why not simply use the _DEFAULT ones ?

>  }
>
>  unsigned int V4L2CameraProxy::calculateSizeImage(StreamConfiguration &streamConfig)
> @@ -283,11 +286,15 @@ int V4L2CameraProxy::vidioc_enum_fmt(int fd, struct v4l2_fmtdesc *arg)
>  	    arg->index >= streamConfig_.formats().pixelformats().size())
>  		return -EINVAL;
>
> +	/* \todo Set V4L2_FMT_FLAG_COMPRESSED for compressed formats. */
> +	arg->flags = 0;
>  	/* \todo Add map from format to description. */
> -	utils::strlcpy(reinterpret_cast<char *>(arg->description), "Video Format Description",
> -		       sizeof(arg->description));
> +	utils::strlcpy(reinterpret_cast<char *>(arg->description),
> +		       "Video Format Description", sizeof(arg->description));
>  	arg->pixelformat = drmToV4L2(streamConfig_.formats().pixelformats()[arg->index]);
>
> +	memset(arg->reserved, 0, sizeof(arg->reserved));
> +

If I were to be picky, I would have split this to a separate patch.
At least please expand the commit message to mention what you're
fixing

Thanks
  j

>  	return 0;
>  }
>
> @@ -330,6 +337,9 @@ void V4L2CameraProxy::tryFormat(struct v4l2_format *arg)
>  					      arg->fmt.pix.width,
>  					      arg->fmt.pix.height);
>  	arg->fmt.pix.colorspace   = V4L2_COLORSPACE_SRGB;
> +	arg->fmt.pix.priv         = V4L2_PIX_FMT_PRIV_MAGIC;
> +	arg->fmt.pix.ycbcr_enc    = V4L2_YCBCR_ENC_601;
> +	arg->fmt.pix.quantization = V4L2_QUANTIZATION_LIM_RANGE;
>  }
>
>  int V4L2CameraProxy::vidioc_s_fmt(int fd, struct v4l2_format *arg)
> --
> 2.27.0
>
> _______________________________________________
> 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