Skip to content

Commit 0a835bd

Browse files
6by9popcornmix
authored andcommitted
drm/fourcc: Add packed 10bit YUV 4:2:0 format
Adds a format that is 3 10bit YUV 4:2:0 samples packed into a 32bit work (with 2 spare bits). Supported on Broadcom BCM2711 chips. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
1 parent e80a7fe commit 0a835bd

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎drivers/gpu/drm/drm_fourcc.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ const struct drm_format_info *__drm_format_info(u32 format)
287287
.num_planes = 3, .char_per_block = { 2, 2, 2 },
288288
.block_w = { 1, 1, 1 }, .block_h = { 1, 1, 1 }, .hsub = 0,
289289
.vsub = 0, .is_yuv = true },
290+
{ .format = DRM_FORMAT_P030, .depth = 0, .num_planes = 2,
291+
.char_per_block = { 4, 4, 0 }, .block_w = { 3, 0, 0 }, .block_h = { 1, 0, 0 },
292+
.hsub = 2, .vsub = 2, .is_yuv = true},
290293
};
291294

292295
unsigned int i;

‎include/uapi/drm/drm_fourcc.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,13 @@ extern "C" {
317317
*/
318318
#define DRM_FORMAT_Q401 fourcc_code('Q', '4', '0', '1')
319319

320+
/*
321+
* 2 plane YCbCr MSB aligned, 3 pixels packed into 4 bytes.
322+
* index 0 = Y plane, [31:0] x:Y2:Y1:Y0 2:10:10:10 little endian
323+
* index 1 = Cr:Cb plane, [63:0] x:Cr2:Cb2:Cr1:x:Cb1:Cr0:Cb0 [2:10:10:10:2:10:10:10] little endian
324+
*/
325+
#define DRM_FORMAT_P030 fourcc_code('P', '0', '3', '0') /* 2x2 subsampled Cr:Cb plane 10 bits per channel packed */
326+
320327
/*
321328
* 3 plane YCbCr
322329
* index 0: Y plane, [7:0] Y
@@ -835,6 +842,10 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)
835842
* and UV. Some SAND-using hardware stores UV in a separate tiled
836843
* image from Y to reduce the column height, which is not supported
837844
* with these modifiers.
845+
*
846+
* The DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT modifier is also
847+
* supported for DRM_FORMAT_P030 where the columns remain as 128 bytes
848+
* wide, but as this is a 10 bpp format that translates to 96 pixels.
838849
*/
839850

840851
#define DRM_FORMAT_MOD_BROADCOM_SAND32_COL_HEIGHT(v) \

0 commit comments

Comments
 (0)