1 From 9abab2e8e5cfbeae6e1b33cc3a5ed773e4e31774 Mon Sep 17 00:00:00 2001
2 From: Naushir Patuck <naush@raspberrypi.com>
3 Date: Thu, 16 Nov 2023 14:25:39 +0000
4 Subject: [PATCH] include: uapi: v4l2: Add additional pixel formats for use
7 Add the following formats:
9 - V4L2_PIX_FMT_RGB48/V4L2_PIX_FMT_BGR48
10 48-bit RGB where each colour sample is 16-bits.
12 - V4L2_PIX_FMT_PISP_COMP1_MONO/V4L2_PIX_FMT_PISP_COMP2_MONO
13 16-bit to 8-bit pisp compressed monochrome pixel format.
15 Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
17 drivers/media/v4l2-core/v4l2-ioctl.c | 8 ++++++--
18 include/uapi/linux/videodev2.h | 6 ++++++
19 2 files changed, 12 insertions(+), 2 deletions(-)
21 --- a/drivers/media/v4l2-core/v4l2-ioctl.c
22 +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
23 @@ -1304,6 +1304,8 @@ static void v4l_fill_fmtdesc(struct v4l2
24 case V4L2_PIX_FMT_BGRX32: descr = "32-bit XBGR 8-8-8-8"; break;
25 case V4L2_PIX_FMT_RGBA32: descr = "32-bit RGBA 8-8-8-8"; break;
26 case V4L2_PIX_FMT_RGBX32: descr = "32-bit RGBX 8-8-8-8"; break;
27 + case V4L2_PIX_FMT_BGR48: descr = "48-bit BGR 16-16-16"; break;
28 + case V4L2_PIX_FMT_RGB48: descr = "48-bit RGB 16-16-16"; break;
29 case V4L2_PIX_FMT_GREY: descr = "8-bit Greyscale"; break;
30 case V4L2_PIX_FMT_Y4: descr = "4-bit Greyscale"; break;
31 case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break;
32 @@ -1510,11 +1512,13 @@ static void v4l_fill_fmtdesc(struct v4l2
33 case V4L2_PIX_FMT_PISP_COMP1_RGGB:
34 case V4L2_PIX_FMT_PISP_COMP1_GRBG:
35 case V4L2_PIX_FMT_PISP_COMP1_GBRG:
36 - case V4L2_PIX_FMT_PISP_COMP1_BGGR: descr = "PiSP Bayer Comp 1"; break;
37 + case V4L2_PIX_FMT_PISP_COMP1_BGGR:
38 + case V4L2_PIX_FMT_PISP_COMP1_MONO: descr = "PiSP Bayer Comp 1"; break;
39 case V4L2_PIX_FMT_PISP_COMP2_RGGB:
40 case V4L2_PIX_FMT_PISP_COMP2_GRBG:
41 case V4L2_PIX_FMT_PISP_COMP2_GBRG:
42 - case V4L2_PIX_FMT_PISP_COMP2_BGGR: descr = "PiSP Bayer Comp 2"; break;
43 + case V4L2_PIX_FMT_PISP_COMP2_BGGR:
44 + case V4L2_PIX_FMT_PISP_COMP2_MONO: descr = "PiSP Bayer Comp 2"; break;
46 if (fmt->description[0])
48 --- a/include/uapi/linux/videodev2.h
49 +++ b/include/uapi/linux/videodev2.h
50 @@ -582,6 +582,10 @@ struct v4l2_pix_format {
51 #define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4') /* 32 ARGB-8-8-8-8 */
52 #define V4L2_PIX_FMT_XRGB32 v4l2_fourcc('B', 'X', '2', '4') /* 32 XRGB-8-8-8-8 */
54 +/* RGB formats (6 bytes per pixel) */
55 +#define V4L2_PIX_FMT_BGR48 v4l2_fourcc('B', 'G', 'R', '6') /* 16 BGR-16-16-16 */
56 +#define V4L2_PIX_FMT_RGB48 v4l2_fourcc('R', 'G', 'B', '6') /* 16 RGB-16-16-16 */
59 #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
60 #define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */
61 @@ -799,10 +803,12 @@ struct v4l2_pix_format {
62 #define V4L2_PIX_FMT_PISP_COMP1_GRBG v4l2_fourcc('P', 'C', '1', 'G')
63 #define V4L2_PIX_FMT_PISP_COMP1_GBRG v4l2_fourcc('P', 'C', '1', 'g')
64 #define V4L2_PIX_FMT_PISP_COMP1_BGGR v4l2_fourcc('P', 'C', '1', 'B')
65 +#define V4L2_PIX_FMT_PISP_COMP1_MONO v4l2_fourcc('P', 'C', '1', 'M')
66 #define V4L2_PIX_FMT_PISP_COMP2_RGGB v4l2_fourcc('P', 'C', '2', 'R')
67 #define V4L2_PIX_FMT_PISP_COMP2_GRBG v4l2_fourcc('P', 'C', '2', 'G')
68 #define V4L2_PIX_FMT_PISP_COMP2_GBRG v4l2_fourcc('P', 'C', '2', 'g')
69 #define V4L2_PIX_FMT_PISP_COMP2_BGGR v4l2_fourcc('P', 'C', '2', 'B')
70 +#define V4L2_PIX_FMT_PISP_COMP2_MONO v4l2_fourcc('P', 'C', '2', 'M')
72 /* SDR formats - used only for Software Defined Radio devices */
73 #define V4L2_SDR_FMT_CU8 v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */