diff mbox series

[libdrm] drm/fourcc: extend 12 and 14 bit YUV formats

Message ID 20241002111714.739929-1-iason.paraskevopoulos@arm.com (mailing list archive)
State New, archived
Headers show
Series [libdrm] drm/fourcc: extend 12 and 14 bit YUV formats | expand

Commit Message

Iason Paraskevopoulos Oct. 2, 2024, 11:17 a.m. UTC
Extends the 12 and 14 bit YUV formats with:
    - P014: two plane 4:2:0 YUV with 14bits per channel.
    - P212: two plane 4:2:2 YUV with 12bits per channel.
    - P214: two plane 4:2:2 YUV with 14bits per channel.

Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
---
 drivers/gpu/drm/drm_fourcc.c  | 13 ++++++++++++-
 include/uapi/drm/drm_fourcc.h | 21 +++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
index 193cf8ed7912..76a9733fc24a 100644
--- a/drivers/gpu/drm/drm_fourcc.c
+++ b/drivers/gpu/drm/drm_fourcc.c
@@ -278,7 +278,10 @@  const struct drm_format_info *__drm_format_info(u32 format)
 		  .hsub = 2, .vsub = 2, .is_yuv = true},
 		{ .format = DRM_FORMAT_P012,		.depth = 0,  .num_planes = 2,
 		  .char_per_block = { 2, 4, 0 }, .block_w = { 1, 1, 0 }, .block_h = { 1, 1, 0 },
-		   .hsub = 2, .vsub = 2, .is_yuv = true},
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_P014,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 2, 4, 0 }, .block_w = { 1, 1, 0 }, .block_h = { 1, 1, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
 		{ .format = DRM_FORMAT_P016,		.depth = 0,  .num_planes = 2,
 		  .char_per_block = { 2, 4, 0 }, .block_w = { 1, 1, 0 }, .block_h = { 1, 1, 0 },
 		  .hsub = 2, .vsub = 2, .is_yuv = true},
@@ -286,6 +289,14 @@  const struct drm_format_info *__drm_format_info(u32 format)
 		  .num_planes = 2, .char_per_block = { 2, 4, 0 },
 		  .block_w = { 1, 1, 0 }, .block_h = { 1, 1, 0 }, .hsub = 2,
 		  .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_P212,		.depth = 0,
+		  .num_planes = 2, .char_per_block = { 2, 4, 0 },
+		  .block_w = { 1, 1, 0 }, .block_h = { 1, 1, 0 }, .hsub = 2,
+		  .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_P214,		.depth = 0,
+		  .num_planes = 2, .char_per_block = { 2, 4, 0 },
+		  .block_w = { 1, 1, 0 }, .block_h = { 1, 1, 0 }, .hsub = 2,
+		  .vsub = 1, .is_yuv = true },
 		{ .format = DRM_FORMAT_VUY101010,	.depth = 0,
 		  .num_planes = 1, .cpp = { 0, 0, 0 }, .hsub = 1, .vsub = 1,
 		  .is_yuv = true },
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index 78abd819fd62..aa7b4cd0a116 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -333,6 +333,20 @@  extern "C" {
  */
 #define DRM_FORMAT_P210		fourcc_code('P', '2', '1', '0') /* 2x1 subsampled Cr:Cb plane, 10 bit per channel */
 
+/*
+ * 2 plane YCbCr MSB aligned
+ * index 0 = Y plane, [15:0] Y:x [12:4] little endian
+ * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [12:4:12:4] little endian
+ */
+#define DRM_FORMAT_P212		fourcc_code('P', '2', '1', '2') /* 2x1 subsampled Cr:Cb plane 12 bits per channel */
+
+/*
+ * 2 plane YCbCr MSB aligned
+ * index 0 = Y plane, [15:0] Y:x [14:2] little endian
+ * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [14:2:14:2] little endian
+ */
+#define DRM_FORMAT_P214		fourcc_code('P', '2', '1', '4') /* 2x1 subsampled Cr:Cb plane 14 bits per channel */
+
 /*
  * 2 plane YCbCr MSB aligned
  * index 0 = Y plane, [15:0] Y:x [10:6] little endian
@@ -347,6 +361,13 @@  extern "C" {
  */
 #define DRM_FORMAT_P012		fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cr:Cb plane 12 bits per channel */
 
+/*
+ * 2 plane YCbCr MSB aligned
+ * index 0 = Y plane, [15:0] Y:x [14:2] little endian
+ * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [14:2:14:2] little endian
+ */
+#define DRM_FORMAT_P014		fourcc_code('P', '0', '1', '4') /* 2x2 subsampled Cr:Cb plane 14 bits per channel */
+
 /*
  * 2 plane YCbCr MSB aligned
  * index 0 = Y plane, [15:0] Y little endian