* [PATCH v2 1/3] media: uapi: videodev2: Add 20-bit Bayer formats
2026-11-15 19:10 [PATCH v2 0/3] media: uapi: videodev2: Add 20-, 24- and 28-bit bayer pixel formats Niklas Söderlund
@ 2026-11-15 19:10 ` Niklas Söderlund
2026-11-16 10:06 ` Jacopo Mondi
2026-11-15 19:10 ` [PATCH v2 2/3] media: uapi: videodev2: Add 24-bit " Niklas Söderlund
2026-11-15 19:10 ` [PATCH v2 3/3] media: uapi: videodev2: Add 28-bit " Niklas Söderlund
2 siblings, 1 reply; 5+ messages in thread
From: Niklas Söderlund @ 2026-11-15 19:10 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Jacopo Mondi
Cc: linux-media, linux-kernel, linux-renesas-soc, Niklas Söderlund
Add 20-bit Bayer formats and documentation.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
* Changes since v1
- Use same table format example as for other Bayer formats.
- Add format to v4l2_format_info()
---
.../userspace-api/media/v4l/pixfmt-bayer.rst | 1 +
.../userspace-api/media/v4l/pixfmt-srggb20.rst | 103 +++++++++++++++++++++
drivers/media/v4l2-core/v4l2-common.c | 1 +
drivers/media/v4l2-core/v4l2-ioctl.c | 4 +
include/uapi/linux/videodev2.h | 4 +
5 files changed, 113 insertions(+)
diff --git a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
index 8b4e413177f5..b93e66d6a27e 100644
--- a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
+++ b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
@@ -33,3 +33,4 @@ orders. See also `the Wikipedia article on Bayer filter
pixfmt-srggb14
pixfmt-srggb14p
pixfmt-srggb16
+ pixfmt-srggb20
diff --git a/Documentation/userspace-api/media/v4l/pixfmt-srggb20.rst b/Documentation/userspace-api/media/v4l/pixfmt-srggb20.rst
new file mode 100644
index 000000000000..915700a5af93
--- /dev/null
+++ b/Documentation/userspace-api/media/v4l/pixfmt-srggb20.rst
@@ -0,0 +1,103 @@
+.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
+
+.. _V4L2-PIX-FMT-SRGGB20:
+.. _v4l2-pix-fmt-sbggr20:
+.. _v4l2-pix-fmt-sgbrg20:
+.. _v4l2-pix-fmt-sgrbg20:
+
+***************************************************************************************************************************
+V4L2_PIX_FMT_SBGGR20 ('BG20'), V4L2_PIX_FMT_SGBRG20 ('GB20'), V4L2_PIX_FMT_SGRBG20 ('GR20'), V4L2_PIX_FMT_SRGGB20 ('RG20'),
+***************************************************************************************************************************
+
+
+====================
+20-bit Bayer formats
+====================
+
+
+Description
+===========
+
+These four pixel formats are raw sRGB / Bayer formats with 20 bits per
+sample. Each sample is stored in a 32-bit word. Each n-pixel row contains
+n/2 green samples and n/2 blue or red samples, with alternating red and blue
+rows. Bytes are stored in memory in little endian order. They are
+conventionally described as GRGR... BGBG..., RGRG... GBGB..., etc. Below is
+an example of a small V4L2_PIX_FMT_SBGGR20 image:
+
+**Byte Order.**
+Each cell is one byte.
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+
+ * - start + 0:
+ - B\ :sub:`00`
+ - B\ :sub:`00`
+ - B\ :sub:`00`
+ - B\ :sub:`00`
+ - G\ :sub:`01`
+ - G\ :sub:`01`
+ - G\ :sub:`01`
+ - G\ :sub:`01`
+ - B\ :sub:`02`
+ - B\ :sub:`02`
+ - B\ :sub:`02`
+ - B\ :sub:`02`
+ - G\ :sub:`03`
+ - G\ :sub:`03`
+ - G\ :sub:`03`
+ - G\ :sub:`03`
+ * - start + 16:
+ - G\ :sub:`10`
+ - G\ :sub:`10`
+ - G\ :sub:`10`
+ - G\ :sub:`10`
+ - R\ :sub:`11`
+ - R\ :sub:`11`
+ - R\ :sub:`11`
+ - R\ :sub:`11`
+ - G\ :sub:`12`
+ - G\ :sub:`12`
+ - G\ :sub:`12`
+ - G\ :sub:`12`
+ - R\ :sub:`13`
+ - R\ :sub:`13`
+ - R\ :sub:`13`
+ - R\ :sub:`13`
+ * - start + 32:
+ - B\ :sub:`20`
+ - B\ :sub:`20`
+ - B\ :sub:`20`
+ - B\ :sub:`20`
+ - G\ :sub:`21`
+ - G\ :sub:`21`
+ - G\ :sub:`21`
+ - G\ :sub:`21`
+ - B\ :sub:`22`
+ - B\ :sub:`22`
+ - B\ :sub:`22`
+ - B\ :sub:`22`
+ - G\ :sub:`23`
+ - G\ :sub:`23`
+ - G\ :sub:`23`
+ - G\ :sub:`23`
+ * - start + 48:
+ - G\ :sub:`30`
+ - G\ :sub:`30`
+ - G\ :sub:`30`
+ - G\ :sub:`30`
+ - R\ :sub:`31`
+ - R\ :sub:`31`
+ - R\ :sub:`31`
+ - R\ :sub:`31`
+ - G\ :sub:`32`
+ - G\ :sub:`32`
+ - G\ :sub:`32`
+ - G\ :sub:`32`
+ - R\ :sub:`33`
+ - R\ :sub:`33`
+ - R\ :sub:`33`
+ - R\ :sub:`33`
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
index 11ab684024c5..009721cd2527 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -402,6 +402,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
{ .format = V4L2_PIX_FMT_SGBRG16, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
{ .format = V4L2_PIX_FMT_SGRBG16, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
{ .format = V4L2_PIX_FMT_SRGGB16, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
+ { .format = V4L2_PIX_FMT_SRGGB20, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
/* Renesas Camera Data Receiver Unit formats, bayer order agnostic */
{ .format = V4L2_PIX_FMT_RAW_CRU10, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .bpp_div = { 6, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 17ba1ae70735..14cb94591ea8 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1434,6 +1434,10 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_SGBRG16: descr = "16-bit Bayer GBGB/RGRG"; break;
case V4L2_PIX_FMT_SGRBG16: descr = "16-bit Bayer GRGR/BGBG"; break;
case V4L2_PIX_FMT_SRGGB16: descr = "16-bit Bayer RGRG/GBGB"; break;
+ case V4L2_PIX_FMT_SBGGR20: descr = "20-bit Bayer BGBG/GRGR"; break;
+ case V4L2_PIX_FMT_SGBRG20: descr = "20-bit Bayer GBGB/RGRG"; break;
+ case V4L2_PIX_FMT_SGRBG20: descr = "20-bit Bayer GRGR/BGBG"; break;
+ case V4L2_PIX_FMT_SRGGB20: descr = "20-bit Bayer RGRG/GBGB"; break;
case V4L2_PIX_FMT_RAW_CRU20: descr = "14-bit Raw CRU Packed"; break;
case V4L2_PIX_FMT_SN9C20X_I420: descr = "GSPCA SN9C20X I420"; break;
case V4L2_PIX_FMT_SPCA501: descr = "GSPCA SPCA501"; break;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 5373dba640fa..85a32dee4e21 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -744,6 +744,10 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_SGBRG16 v4l2_fourcc('G', 'B', '1', '6') /* 16 GBGB.. RGRG.. */
#define V4L2_PIX_FMT_SGRBG16 v4l2_fourcc('G', 'R', '1', '6') /* 16 GRGR.. BGBG.. */
#define V4L2_PIX_FMT_SRGGB16 v4l2_fourcc('R', 'G', '1', '6') /* 16 RGRG.. GBGB.. */
+#define V4L2_PIX_FMT_SBGGR20 v4l2_fourcc('B', 'G', '2', '0') /* 20 BGBG.. GRGR.. */
+#define V4L2_PIX_FMT_SGBRG20 v4l2_fourcc('G', 'B', '2', '0') /* 20 GBGB.. RGRG.. */
+#define V4L2_PIX_FMT_SGRBG20 v4l2_fourcc('G', 'R', '2', '0') /* 20 GRGR.. BGBG.. */
+#define V4L2_PIX_FMT_SRGGB20 v4l2_fourcc('R', 'G', '2', '0') /* 20 RGRG.. GBGB.. */
/* HSV formats */
#define V4L2_PIX_FMT_HSV24 v4l2_fourcc('H', 'S', 'V', '3')
--
2.56.1
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2 1/3] media: uapi: videodev2: Add 20-bit Bayer formats
2026-11-15 19:10 ` [PATCH v2 1/3] media: uapi: videodev2: Add 20-bit Bayer formats Niklas Söderlund
@ 2026-11-16 10:06 ` Jacopo Mondi
0 siblings, 0 replies; 5+ messages in thread
From: Jacopo Mondi @ 2026-11-16 10:06 UTC (permalink / raw)
To: Niklas Söderlund
Cc: Mauro Carvalho Chehab, Jacopo Mondi, linux-media, linux-kernel,
linux-renesas-soc
Hi Niklas,
thanks for the update
On Sun, Nov 15, 2026 at 08:10:05PM +0100, Niklas Söderlund wrote:
> Add 20-bit Bayer formats and documentation.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
> * Changes since v1
> - Use same table format example as for other Bayer formats.
> - Add format to v4l2_format_info()
> ---
> .../userspace-api/media/v4l/pixfmt-bayer.rst | 1 +
> .../userspace-api/media/v4l/pixfmt-srggb20.rst | 103 +++++++++++++++++++++
> drivers/media/v4l2-core/v4l2-common.c | 1 +
> drivers/media/v4l2-core/v4l2-ioctl.c | 4 +
> include/uapi/linux/videodev2.h | 4 +
> 5 files changed, 113 insertions(+)
>
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> index 8b4e413177f5..b93e66d6a27e 100644
> --- a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> @@ -33,3 +33,4 @@ orders. See also `the Wikipedia article on Bayer filter
> pixfmt-srggb14
> pixfmt-srggb14p
> pixfmt-srggb16
> + pixfmt-srggb20
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-srggb20.rst b/Documentation/userspace-api/media/v4l/pixfmt-srggb20.rst
> new file mode 100644
> index 000000000000..915700a5af93
> --- /dev/null
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-srggb20.rst
> @@ -0,0 +1,103 @@
> +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
> +.. c:namespace:: V4L
> +
> +.. _V4L2-PIX-FMT-SRGGB20:
> +.. _v4l2-pix-fmt-sbggr20:
> +.. _v4l2-pix-fmt-sgbrg20:
> +.. _v4l2-pix-fmt-sgrbg20:
> +
> +***************************************************************************************************************************
> +V4L2_PIX_FMT_SBGGR20 ('BG20'), V4L2_PIX_FMT_SGBRG20 ('GB20'), V4L2_PIX_FMT_SGRBG20 ('GR20'), V4L2_PIX_FMT_SRGGB20 ('RG20'),
> +***************************************************************************************************************************
> +
> +
> +====================
> +20-bit Bayer formats
> +====================
> +
> +
> +Description
> +===========
> +
> +These four pixel formats are raw sRGB / Bayer formats with 20 bits per
> +sample. Each sample is stored in a 32-bit word. Each n-pixel row contains
I see the description of the other formats mentioning where the
padding bits are located inside the word. In example (from
pixfmt-srggb12)
Each colour component is stored in a 16-bit word, with 4 unused
high bits filled with zeros.
Should we specify the same?
These four pixel formats are raw sRGB / Bayer formats with 20 bits per
sample. Each sample is stored in a 32-bit word witht the 12 unused high
bits filled with zeros. Each n-pixel row contains
And now
> +n/2 green samples and n/2 blue or red samples, with alternating red and blue
> +rows. Bytes are stored in memory in little endian order. They are
> +conventionally described as GRGR... BGBG..., RGRG... GBGB..., etc. Below is
> +an example of a small V4L2_PIX_FMT_SBGGR20 image:
> +
> +**Byte Order.**
> +Each cell is one byte.
Here as well:
**Byte Order.**
Each cell is one byte, the 12 most significant bits in the high bytes are
0.
And now I wonder, could a 20 bits format be stored in a 24 bits word ?
I'm not sure if that's a use case, but I guess we'll need new
pixelcodes for that.
> +
> +.. flat-table::
> + :header-rows: 0
> + :stub-columns: 0
> +
> + * - start + 0:
> + - B\ :sub:`00`
> + - B\ :sub:`00`
> + - B\ :sub:`00`
> + - B\ :sub:`00`
> + - G\ :sub:`01`
> + - G\ :sub:`01`
> + - G\ :sub:`01`
> + - G\ :sub:`01`
> + - B\ :sub:`02`
> + - B\ :sub:`02`
> + - B\ :sub:`02`
> + - B\ :sub:`02`
> + - G\ :sub:`03`
> + - G\ :sub:`03`
> + - G\ :sub:`03`
> + - G\ :sub:`03`
> + * - start + 16:
> + - G\ :sub:`10`
> + - G\ :sub:`10`
> + - G\ :sub:`10`
> + - G\ :sub:`10`
> + - R\ :sub:`11`
> + - R\ :sub:`11`
> + - R\ :sub:`11`
> + - R\ :sub:`11`
> + - G\ :sub:`12`
> + - G\ :sub:`12`
> + - G\ :sub:`12`
> + - G\ :sub:`12`
> + - R\ :sub:`13`
> + - R\ :sub:`13`
> + - R\ :sub:`13`
> + - R\ :sub:`13`
> + * - start + 32:
> + - B\ :sub:`20`
> + - B\ :sub:`20`
> + - B\ :sub:`20`
> + - B\ :sub:`20`
> + - G\ :sub:`21`
> + - G\ :sub:`21`
> + - G\ :sub:`21`
> + - G\ :sub:`21`
> + - B\ :sub:`22`
> + - B\ :sub:`22`
> + - B\ :sub:`22`
> + - B\ :sub:`22`
> + - G\ :sub:`23`
> + - G\ :sub:`23`
> + - G\ :sub:`23`
> + - G\ :sub:`23`
> + * - start + 48:
> + - G\ :sub:`30`
> + - G\ :sub:`30`
> + - G\ :sub:`30`
> + - G\ :sub:`30`
> + - R\ :sub:`31`
> + - R\ :sub:`31`
> + - R\ :sub:`31`
> + - R\ :sub:`31`
> + - G\ :sub:`32`
> + - G\ :sub:`32`
> + - G\ :sub:`32`
> + - G\ :sub:`32`
> + - R\ :sub:`33`
> + - R\ :sub:`33`
> + - R\ :sub:`33`
> + - R\ :sub:`33`
> diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
> index 11ab684024c5..009721cd2527 100644
> --- a/drivers/media/v4l2-core/v4l2-common.c
> +++ b/drivers/media/v4l2-core/v4l2-common.c
> @@ -402,6 +402,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
> { .format = V4L2_PIX_FMT_SGBRG16, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
> { .format = V4L2_PIX_FMT_SGRBG16, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
> { .format = V4L2_PIX_FMT_SRGGB16, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
> + { .format = V4L2_PIX_FMT_SRGGB20, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
What about the other permutations ?
The same comments apply to the other patches in the series.
Thanks
j
>
> /* Renesas Camera Data Receiver Unit formats, bayer order agnostic */
> { .format = V4L2_PIX_FMT_RAW_CRU10, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .bpp_div = { 6, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index 17ba1ae70735..14cb94591ea8 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1434,6 +1434,10 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
> case V4L2_PIX_FMT_SGBRG16: descr = "16-bit Bayer GBGB/RGRG"; break;
> case V4L2_PIX_FMT_SGRBG16: descr = "16-bit Bayer GRGR/BGBG"; break;
> case V4L2_PIX_FMT_SRGGB16: descr = "16-bit Bayer RGRG/GBGB"; break;
> + case V4L2_PIX_FMT_SBGGR20: descr = "20-bit Bayer BGBG/GRGR"; break;
> + case V4L2_PIX_FMT_SGBRG20: descr = "20-bit Bayer GBGB/RGRG"; break;
> + case V4L2_PIX_FMT_SGRBG20: descr = "20-bit Bayer GRGR/BGBG"; break;
> + case V4L2_PIX_FMT_SRGGB20: descr = "20-bit Bayer RGRG/GBGB"; break;
> case V4L2_PIX_FMT_RAW_CRU20: descr = "14-bit Raw CRU Packed"; break;
> case V4L2_PIX_FMT_SN9C20X_I420: descr = "GSPCA SN9C20X I420"; break;
> case V4L2_PIX_FMT_SPCA501: descr = "GSPCA SPCA501"; break;
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index 5373dba640fa..85a32dee4e21 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -744,6 +744,10 @@ struct v4l2_pix_format {
> #define V4L2_PIX_FMT_SGBRG16 v4l2_fourcc('G', 'B', '1', '6') /* 16 GBGB.. RGRG.. */
> #define V4L2_PIX_FMT_SGRBG16 v4l2_fourcc('G', 'R', '1', '6') /* 16 GRGR.. BGBG.. */
> #define V4L2_PIX_FMT_SRGGB16 v4l2_fourcc('R', 'G', '1', '6') /* 16 RGRG.. GBGB.. */
> +#define V4L2_PIX_FMT_SBGGR20 v4l2_fourcc('B', 'G', '2', '0') /* 20 BGBG.. GRGR.. */
> +#define V4L2_PIX_FMT_SGBRG20 v4l2_fourcc('G', 'B', '2', '0') /* 20 GBGB.. RGRG.. */
> +#define V4L2_PIX_FMT_SGRBG20 v4l2_fourcc('G', 'R', '2', '0') /* 20 GRGR.. BGBG.. */
> +#define V4L2_PIX_FMT_SRGGB20 v4l2_fourcc('R', 'G', '2', '0') /* 20 RGRG.. GBGB.. */
>
> /* HSV formats */
> #define V4L2_PIX_FMT_HSV24 v4l2_fourcc('H', 'S', 'V', '3')
>
> --
> 2.56.1
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/3] media: uapi: videodev2: Add 24-bit Bayer formats
2026-11-15 19:10 [PATCH v2 0/3] media: uapi: videodev2: Add 20-, 24- and 28-bit bayer pixel formats Niklas Söderlund
2026-11-15 19:10 ` [PATCH v2 1/3] media: uapi: videodev2: Add 20-bit Bayer formats Niklas Söderlund
@ 2026-11-15 19:10 ` Niklas Söderlund
2026-11-15 19:10 ` [PATCH v2 3/3] media: uapi: videodev2: Add 28-bit " Niklas Söderlund
2 siblings, 0 replies; 5+ messages in thread
From: Niklas Söderlund @ 2026-11-15 19:10 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Jacopo Mondi
Cc: linux-media, linux-kernel, linux-renesas-soc, Niklas Söderlund
Add 24-bit Bayer formats and documentation.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
* Changes since v1
- Use same table format example as for other Bayer formats.
- Add format to v4l2_format_info()
---
.../userspace-api/media/v4l/pixfmt-bayer.rst | 1 +
.../userspace-api/media/v4l/pixfmt-srggb24.rst | 103 +++++++++++++++++++++
drivers/media/v4l2-core/v4l2-common.c | 1 +
drivers/media/v4l2-core/v4l2-ioctl.c | 4 +
include/uapi/linux/videodev2.h | 4 +
5 files changed, 113 insertions(+)
diff --git a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
index b93e66d6a27e..9d76def66648 100644
--- a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
+++ b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
@@ -34,3 +34,4 @@ orders. See also `the Wikipedia article on Bayer filter
pixfmt-srggb14p
pixfmt-srggb16
pixfmt-srggb20
+ pixfmt-srggb24
diff --git a/Documentation/userspace-api/media/v4l/pixfmt-srggb24.rst b/Documentation/userspace-api/media/v4l/pixfmt-srggb24.rst
new file mode 100644
index 000000000000..7f397dd4a8aa
--- /dev/null
+++ b/Documentation/userspace-api/media/v4l/pixfmt-srggb24.rst
@@ -0,0 +1,103 @@
+.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
+
+.. _V4L2-PIX-FMT-SRGGB24:
+.. _v4l2-pix-fmt-sbggr24:
+.. _v4l2-pix-fmt-sgbrg24:
+.. _v4l2-pix-fmt-sgrbg24:
+
+***************************************************************************************************************************
+V4L2_PIX_FMT_SBGGR24 ('BG24'), V4L2_PIX_FMT_SGBRG24 ('GB24'), V4L2_PIX_FMT_SGRBG24 ('GR24'), V4L2_PIX_FMT_SRGGB24 ('RG24'),
+***************************************************************************************************************************
+
+
+====================
+24-bit Bayer formats
+====================
+
+
+Description
+===========
+
+These four pixel formats are raw sRGB / Bayer formats with 24 bits per
+sample. Each sample is stored in a 32-bit word. Each n-pixel row contains
+n/2 green samples and n/2 blue or red samples, with alternating red and blue
+rows. Bytes are stored in memory in little endian order. They are
+conventionally described as GRGR... BGBG..., RGRG... GBGB..., etc. Below is
+an example of a small V4L2_PIX_FMT_SBGGR24 image:
+
+**Byte Order.**
+Each cell is one byte.
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+
+ * - start + 0:
+ - B\ :sub:`00`
+ - B\ :sub:`00`
+ - B\ :sub:`00`
+ - B\ :sub:`00`
+ - G\ :sub:`01`
+ - G\ :sub:`01`
+ - G\ :sub:`01`
+ - G\ :sub:`01`
+ - B\ :sub:`02`
+ - B\ :sub:`02`
+ - B\ :sub:`02`
+ - B\ :sub:`02`
+ - G\ :sub:`03`
+ - G\ :sub:`03`
+ - G\ :sub:`03`
+ - G\ :sub:`03`
+ * - start + 16:
+ - G\ :sub:`10`
+ - G\ :sub:`10`
+ - G\ :sub:`10`
+ - G\ :sub:`10`
+ - R\ :sub:`11`
+ - R\ :sub:`11`
+ - R\ :sub:`11`
+ - R\ :sub:`11`
+ - G\ :sub:`12`
+ - G\ :sub:`12`
+ - G\ :sub:`12`
+ - G\ :sub:`12`
+ - R\ :sub:`13`
+ - R\ :sub:`13`
+ - R\ :sub:`13`
+ - R\ :sub:`13`
+ * - start + 32:
+ - B\ :sub:`20`
+ - B\ :sub:`20`
+ - B\ :sub:`20`
+ - B\ :sub:`20`
+ - G\ :sub:`21`
+ - G\ :sub:`21`
+ - G\ :sub:`21`
+ - G\ :sub:`21`
+ - B\ :sub:`22`
+ - B\ :sub:`22`
+ - B\ :sub:`22`
+ - B\ :sub:`22`
+ - G\ :sub:`23`
+ - G\ :sub:`23`
+ - G\ :sub:`23`
+ - G\ :sub:`23`
+ * - start + 48:
+ - G\ :sub:`30`
+ - G\ :sub:`30`
+ - G\ :sub:`30`
+ - G\ :sub:`30`
+ - R\ :sub:`31`
+ - R\ :sub:`31`
+ - R\ :sub:`31`
+ - R\ :sub:`31`
+ - G\ :sub:`32`
+ - G\ :sub:`32`
+ - G\ :sub:`32`
+ - G\ :sub:`32`
+ - R\ :sub:`33`
+ - R\ :sub:`33`
+ - R\ :sub:`33`
+ - R\ :sub:`33`
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
index 009721cd2527..e6a37b3ec3d7 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -403,6 +403,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
{ .format = V4L2_PIX_FMT_SGRBG16, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
{ .format = V4L2_PIX_FMT_SRGGB16, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
{ .format = V4L2_PIX_FMT_SRGGB20, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
+ { .format = V4L2_PIX_FMT_SRGGB24, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
/* Renesas Camera Data Receiver Unit formats, bayer order agnostic */
{ .format = V4L2_PIX_FMT_RAW_CRU10, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .bpp_div = { 6, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 14cb94591ea8..cf2831cbdbc8 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1438,6 +1438,10 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_SGBRG20: descr = "20-bit Bayer GBGB/RGRG"; break;
case V4L2_PIX_FMT_SGRBG20: descr = "20-bit Bayer GRGR/BGBG"; break;
case V4L2_PIX_FMT_SRGGB20: descr = "20-bit Bayer RGRG/GBGB"; break;
+ case V4L2_PIX_FMT_SBGGR24: descr = "24-bit Bayer BGBG/GRGR"; break;
+ case V4L2_PIX_FMT_SGBRG24: descr = "24-bit Bayer GBGB/RGRG"; break;
+ case V4L2_PIX_FMT_SGRBG24: descr = "24-bit Bayer GRGR/BGBG"; break;
+ case V4L2_PIX_FMT_SRGGB24: descr = "24-bit Bayer RGRG/GBGB"; break;
case V4L2_PIX_FMT_RAW_CRU20: descr = "14-bit Raw CRU Packed"; break;
case V4L2_PIX_FMT_SN9C20X_I420: descr = "GSPCA SN9C20X I420"; break;
case V4L2_PIX_FMT_SPCA501: descr = "GSPCA SPCA501"; break;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 85a32dee4e21..027c7c7a352c 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -748,6 +748,10 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_SGBRG20 v4l2_fourcc('G', 'B', '2', '0') /* 20 GBGB.. RGRG.. */
#define V4L2_PIX_FMT_SGRBG20 v4l2_fourcc('G', 'R', '2', '0') /* 20 GRGR.. BGBG.. */
#define V4L2_PIX_FMT_SRGGB20 v4l2_fourcc('R', 'G', '2', '0') /* 20 RGRG.. GBGB.. */
+#define V4L2_PIX_FMT_SBGGR24 v4l2_fourcc('B', 'G', '2', '4') /* 24 BGBG.. GRGR.. */
+#define V4L2_PIX_FMT_SGBRG24 v4l2_fourcc('G', 'B', '2', '4') /* 24 GBGB.. RGRG.. */
+#define V4L2_PIX_FMT_SGRBG24 v4l2_fourcc('G', 'R', '2', '4') /* 24 GRGR.. BGBG.. */
+#define V4L2_PIX_FMT_SRGGB24 v4l2_fourcc('R', 'G', '2', '4') /* 24 RGRG.. GBGB.. */
/* HSV formats */
#define V4L2_PIX_FMT_HSV24 v4l2_fourcc('H', 'S', 'V', '3')
--
2.56.1
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v2 3/3] media: uapi: videodev2: Add 28-bit Bayer formats
2026-11-15 19:10 [PATCH v2 0/3] media: uapi: videodev2: Add 20-, 24- and 28-bit bayer pixel formats Niklas Söderlund
2026-11-15 19:10 ` [PATCH v2 1/3] media: uapi: videodev2: Add 20-bit Bayer formats Niklas Söderlund
2026-11-15 19:10 ` [PATCH v2 2/3] media: uapi: videodev2: Add 24-bit " Niklas Söderlund
@ 2026-11-15 19:10 ` Niklas Söderlund
2 siblings, 0 replies; 5+ messages in thread
From: Niklas Söderlund @ 2026-11-15 19:10 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Jacopo Mondi
Cc: linux-media, linux-kernel, linux-renesas-soc, Niklas Söderlund
Add 28-bit Bayer formats and documentation.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
* Changes since v1
- Use same table format example as for other Bayer formats.
- Add format to v4l2_format_info()
---
.../userspace-api/media/v4l/pixfmt-bayer.rst | 1 +
.../userspace-api/media/v4l/pixfmt-srggb28.rst | 103 +++++++++++++++++++++
drivers/media/v4l2-core/v4l2-common.c | 1 +
drivers/media/v4l2-core/v4l2-ioctl.c | 4 +
include/uapi/linux/videodev2.h | 4 +
5 files changed, 113 insertions(+)
diff --git a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
index 9d76def66648..ca915889199e 100644
--- a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
+++ b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
@@ -35,3 +35,4 @@ orders. See also `the Wikipedia article on Bayer filter
pixfmt-srggb16
pixfmt-srggb20
pixfmt-srggb24
+ pixfmt-srggb28
diff --git a/Documentation/userspace-api/media/v4l/pixfmt-srggb28.rst b/Documentation/userspace-api/media/v4l/pixfmt-srggb28.rst
new file mode 100644
index 000000000000..6eb53dce8b2a
--- /dev/null
+++ b/Documentation/userspace-api/media/v4l/pixfmt-srggb28.rst
@@ -0,0 +1,103 @@
+.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
+
+.. _V4L2-PIX-FMT-SRGGB28:
+.. _v4l2-pix-fmt-sbggr28:
+.. _v4l2-pix-fmt-sgbrg28:
+.. _v4l2-pix-fmt-sgrbg28:
+
+***************************************************************************************************************************
+V4L2_PIX_FMT_SBGGR28 ('BG28'), V4L2_PIX_FMT_SGBRG28 ('GB28'), V4L2_PIX_FMT_SGRBG28 ('GR28'), V4L2_PIX_FMT_SRGGB28 ('RG28'),
+***************************************************************************************************************************
+
+
+====================
+28-bit Bayer formats
+====================
+
+
+Description
+===========
+
+These four pixel formats are raw sRGB / Bayer formats with 28 bits per
+sample. Each sample is stored in a 32-bit word. Each n-pixel row contains
+n/2 green samples and n/2 blue or red samples, with alternating red and blue
+rows. Bytes are stored in memory in little endian order. They are
+conventionally described as GRGR... BGBG..., RGRG... GBGB..., etc. Below is
+an example of a small V4L2_PIX_FMT_SBGGR28 image:
+
+**Byte Order.**
+Each cell is one byte.
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+
+ * - start + 0:
+ - B\ :sub:`00`
+ - B\ :sub:`00`
+ - B\ :sub:`00`
+ - B\ :sub:`00`
+ - G\ :sub:`01`
+ - G\ :sub:`01`
+ - G\ :sub:`01`
+ - G\ :sub:`01`
+ - B\ :sub:`02`
+ - B\ :sub:`02`
+ - B\ :sub:`02`
+ - B\ :sub:`02`
+ - G\ :sub:`03`
+ - G\ :sub:`03`
+ - G\ :sub:`03`
+ - G\ :sub:`03`
+ * - start + 16:
+ - G\ :sub:`10`
+ - G\ :sub:`10`
+ - G\ :sub:`10`
+ - G\ :sub:`10`
+ - R\ :sub:`11`
+ - R\ :sub:`11`
+ - R\ :sub:`11`
+ - R\ :sub:`11`
+ - G\ :sub:`12`
+ - G\ :sub:`12`
+ - G\ :sub:`12`
+ - G\ :sub:`12`
+ - R\ :sub:`13`
+ - R\ :sub:`13`
+ - R\ :sub:`13`
+ - R\ :sub:`13`
+ * - start + 32:
+ - B\ :sub:`20`
+ - B\ :sub:`20`
+ - B\ :sub:`20`
+ - B\ :sub:`20`
+ - G\ :sub:`21`
+ - G\ :sub:`21`
+ - G\ :sub:`21`
+ - G\ :sub:`21`
+ - B\ :sub:`22`
+ - B\ :sub:`22`
+ - B\ :sub:`22`
+ - B\ :sub:`22`
+ - G\ :sub:`23`
+ - G\ :sub:`23`
+ - G\ :sub:`23`
+ - G\ :sub:`23`
+ * - start + 48:
+ - G\ :sub:`30`
+ - G\ :sub:`30`
+ - G\ :sub:`30`
+ - G\ :sub:`30`
+ - R\ :sub:`31`
+ - R\ :sub:`31`
+ - R\ :sub:`31`
+ - R\ :sub:`31`
+ - G\ :sub:`32`
+ - G\ :sub:`32`
+ - G\ :sub:`32`
+ - G\ :sub:`32`
+ - R\ :sub:`33`
+ - R\ :sub:`33`
+ - R\ :sub:`33`
+ - R\ :sub:`33`
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
index e6a37b3ec3d7..3ba2dc477322 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -404,6 +404,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
{ .format = V4L2_PIX_FMT_SRGGB16, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
{ .format = V4L2_PIX_FMT_SRGGB20, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
{ .format = V4L2_PIX_FMT_SRGGB24, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
+ { .format = V4L2_PIX_FMT_SRGGB28, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
/* Renesas Camera Data Receiver Unit formats, bayer order agnostic */
{ .format = V4L2_PIX_FMT_RAW_CRU10, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .bpp_div = { 6, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index cf2831cbdbc8..e14542ad3228 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1442,6 +1442,10 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_SGBRG24: descr = "24-bit Bayer GBGB/RGRG"; break;
case V4L2_PIX_FMT_SGRBG24: descr = "24-bit Bayer GRGR/BGBG"; break;
case V4L2_PIX_FMT_SRGGB24: descr = "24-bit Bayer RGRG/GBGB"; break;
+ case V4L2_PIX_FMT_SBGGR28: descr = "28-bit Bayer BGBG/GRGR"; break;
+ case V4L2_PIX_FMT_SGBRG28: descr = "28-bit Bayer GBGB/RGRG"; break;
+ case V4L2_PIX_FMT_SGRBG28: descr = "28-bit Bayer GRGR/BGBG"; break;
+ case V4L2_PIX_FMT_SRGGB28: descr = "28-bit Bayer RGRG/GBGB"; break;
case V4L2_PIX_FMT_RAW_CRU20: descr = "14-bit Raw CRU Packed"; break;
case V4L2_PIX_FMT_SN9C20X_I420: descr = "GSPCA SN9C20X I420"; break;
case V4L2_PIX_FMT_SPCA501: descr = "GSPCA SPCA501"; break;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 027c7c7a352c..0611ba1e5fd9 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -752,6 +752,10 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_SGBRG24 v4l2_fourcc('G', 'B', '2', '4') /* 24 GBGB.. RGRG.. */
#define V4L2_PIX_FMT_SGRBG24 v4l2_fourcc('G', 'R', '2', '4') /* 24 GRGR.. BGBG.. */
#define V4L2_PIX_FMT_SRGGB24 v4l2_fourcc('R', 'G', '2', '4') /* 24 RGRG.. GBGB.. */
+#define V4L2_PIX_FMT_SBGGR28 v4l2_fourcc('B', 'G', '2', '8') /* 28 BGBG.. GRGR.. */
+#define V4L2_PIX_FMT_SGBRG28 v4l2_fourcc('G', 'B', '2', '8') /* 28 GBGB.. RGRG.. */
+#define V4L2_PIX_FMT_SGRBG28 v4l2_fourcc('G', 'R', '2', '8') /* 28 GRGR.. BGBG.. */
+#define V4L2_PIX_FMT_SRGGB28 v4l2_fourcc('R', 'G', '2', '8') /* 28 RGRG.. GBGB.. */
/* HSV formats */
#define V4L2_PIX_FMT_HSV24 v4l2_fourcc('H', 'S', 'V', '3')
--
2.56.1
^ permalink raw reply [flat|nested] 5+ messages in thread