Re: [RFC PATCH 1/3] media: Add 10, 12, and 16 bit RGB formats

From: Nicolas Dufresne
Date: Fri Jul 07 2023 - 14:34:20 EST


Hi,

Le vendredi 30 juin 2023 à 16:40 +0200, Paweł Anikiel a écrit :
> Add the RGB30U, RGB30L, RGB36U, RGB36L, and RGB48 pixel formats.
>
> Signed-off-by: Paweł Anikiel <pan@xxxxxxxxxxxx>
> ---
> drivers/media/v4l2-core/v4l2-ioctl.c | 5 +++++
> include/uapi/linux/videodev2.h | 5 +++++
> 2 files changed, 10 insertions(+)
>
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index a858acea6547..5ee616704225 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1300,6 +1300,11 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
> case V4L2_PIX_FMT_ARGB2101010: descr = "32-bit ARGB 2-10-10-10"; break;
> case V4L2_PIX_FMT_BGR48_12: descr = "12-bit Depth BGR"; break;
> case V4L2_PIX_FMT_ABGR64_12: descr = "12-bit Depth BGRA"; break;
> + case V4L2_PIX_FMT_RGB30U: descr = "30-bit RXGXBX-10-10-10"; break;
> + case V4L2_PIX_FMT_RGB30L: descr = "30-bit XRXGXB-10-10-10"; break;
> + case V4L2_PIX_FMT_RGB36U: descr = "36-bit RXGXBX-12-12-12"; break;
> + case V4L2_PIX_FMT_RGB36L: descr = "36-bit XRXGXB-12-12-12"; break;
> + case V4L2_PIX_FMT_RGB48: descr = "48-bit RGB-16-16-16"; break;
> case V4L2_PIX_FMT_GREY: descr = "8-bit Greyscale"; break;
> case V4L2_PIX_FMT_Y4: descr = "4-bit Greyscale"; break;
> case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break;
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index aee75eb9e686..3568819eabeb 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -583,6 +583,11 @@ struct v4l2_pix_format {
> /* RGB formats (6 or 8 bytes per pixel) */
> #define V4L2_PIX_FMT_BGR48_12 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */
> #define V4L2_PIX_FMT_ABGR64_12 v4l2_fourcc('B', '4', '1', '2') /* 64 BGRA 12-bit per component */
> +#define V4L2_PIX_FMT_RGB30U v4l2_fourcc('R', '3', '0', 'U') /* 30 RXGXBX-10-10-10 */
> +#define V4L2_PIX_FMT_RGB30L v4l2_fourcc('R', '3', '0', 'L') /* 30 XRXGXB-10-10-10 */
> +#define V4L2_PIX_FMT_RGB36U v4l2_fourcc('R', '3', '6', 'U') /* 36 RXGXBX-12-12-12 */
> +#define V4L2_PIX_FMT_RGB36L v4l2_fourcc('R', '3', '6', 'L') /* 36 XRXGXB-12-12-12 */
> +#define V4L2_PIX_FMT_RGB48 v4l2_fourcc('R', 'G', 'B', '6') /* 48 RGB-16-16-16 */

In a finalize patch, this would also need to be documented in
Documentation/userspace-api/media/v4l/pixfmt-rgb.rst . About this, what does U
and L stands for ? Upper/lower for the padded bit placement ? Though, it looks
like the other way around in the comment, which may underline a Linux DRM style
format documentation.

Nicolas

>
> /* Grey formats */
> #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */