@@ -99,12 +99,42 @@ extern "C" {
9999#define DRM_FORMAT_INVALID 0
100100
101101/* color index */
102+ #define DRM_FORMAT_C1 fourcc_code('C', '1', ' ', ' ') /* [7:0] C0:C1:C2:C3:C4:C5:C6:C7 1:1:1:1:1:1:1:1 eight pixels/byte */
103+ #define DRM_FORMAT_C2 fourcc_code('C', '2', ' ', ' ') /* [7:0] C0:C1:C2:C3 2:2:2:2 four pixels/byte */
104+ #define DRM_FORMAT_C4 fourcc_code('C', '4', ' ', ' ') /* [7:0] C0:C1 4:4 two pixels/byte */
102105#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */
103106
104- /* 8 bpp Red */
107+ /* 1 bpp Darkness (inverse relationship between channel value and brightness) */
108+ #define DRM_FORMAT_D1 fourcc_code('D', '1', ' ', ' ') /* [7:0] D0:D1:D2:D3:D4:D5:D6:D7 1:1:1:1:1:1:1:1 eight pixels/byte */
109+
110+ /* 2 bpp Darkness (inverse relationship between channel value and brightness) */
111+ #define DRM_FORMAT_D2 fourcc_code('D', '2', ' ', ' ') /* [7:0] D0:D1:D2:D3 2:2:2:2 four pixels/byte */
112+
113+ /* 4 bpp Darkness (inverse relationship between channel value and brightness) */
114+ #define DRM_FORMAT_D4 fourcc_code('D', '4', ' ', ' ') /* [7:0] D0:D1 4:4 two pixels/byte */
115+
116+ /* 8 bpp Darkness (inverse relationship between channel value and brightness) */
117+ #define DRM_FORMAT_D8 fourcc_code('D', '8', ' ', ' ') /* [7:0] D */
118+
119+ /* 1 bpp Red (direct relationship between channel value and brightness) */
120+ #define DRM_FORMAT_R1 fourcc_code('R', '1', ' ', ' ') /* [7:0] R0:R1:R2:R3:R4:R5:R6:R7 1:1:1:1:1:1:1:1 eight pixels/byte */
121+
122+ /* 2 bpp Red (direct relationship between channel value and brightness) */
123+ #define DRM_FORMAT_R2 fourcc_code('R', '2', ' ', ' ') /* [7:0] R0:R1:R2:R3 2:2:2:2 four pixels/byte */
124+
125+ /* 4 bpp Red (direct relationship between channel value and brightness) */
126+ #define DRM_FORMAT_R4 fourcc_code('R', '4', ' ', ' ') /* [7:0] R0:R1 4:4 two pixels/byte */
127+
128+ /* 8 bpp Red (direct relationship between channel value and brightness) */
105129#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */
106130
107- /* 16 bpp Red */
131+ /* 10 bpp Red (direct relationship between channel value and brightness) */
132+ #define DRM_FORMAT_R10 fourcc_code('R', '1', '0', ' ') /* [15:0] x:R 6:10 little endian */
133+
134+ /* 12 bpp Red (direct relationship between channel value and brightness) */
135+ #define DRM_FORMAT_R12 fourcc_code('R', '1', '2', ' ') /* [15:0] x:R 4:12 little endian */
136+
137+ /* 16 bpp Red (direct relationship between channel value and brightness) */
108138#define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */
109139
110140/* 16 bpp RG */
@@ -199,7 +229,9 @@ extern "C" {
199229#define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
200230
201231#define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
232+ #define DRM_FORMAT_AVUY8888 fourcc_code('A', 'V', 'U', 'Y') /* [31:0] A:Cr:Cb:Y 8:8:8:8 little endian */
202233#define DRM_FORMAT_XYUV8888 fourcc_code('X', 'Y', 'U', 'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian */
234+ #define DRM_FORMAT_XVUY8888 fourcc_code('X', 'V', 'U', 'Y') /* [31:0] X:Cr:Cb:Y 8:8:8:8 little endian */
203235#define DRM_FORMAT_VUY888 fourcc_code('V', 'U', '2', '4') /* [23:0] Cr:Cb:Y 8:8:8 little endian */
204236#define DRM_FORMAT_VUY101010 fourcc_code('V', 'U', '3', '0') /* Y followed by U then V, 10:10:10. Non-linear modifier only */
205237
@@ -308,6 +340,13 @@ extern "C" {
308340 */
309341#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
310342
343+ /* 2 plane YCbCr420.
344+ * 3 10 bit components and 2 padding bits packed into 4 bytes.
345+ * index 0 = Y plane, [31:0] x:Y2:Y1:Y0 2:10:10:10 little endian
346+ * 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
347+ */
348+ #define DRM_FORMAT_P030 fourcc_code('P', '0', '3', '0') /* 2x2 subsampled Cr:Cb plane 10 bits per channel packed */
349+
311350/* 3 plane non-subsampled (444) YCbCr
312351 * 16 bits per component, but only 10 bits are used and 6 bits are padded
313352 * index 0: Y plane, [15:0] Y:x [10:6] little endian
@@ -373,6 +412,12 @@ extern "C" {
373412
374413#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1)
375414
415+ #define fourcc_mod_get_vendor (modifier ) \
416+ (((modifier) >> 56) & 0xff)
417+
418+ #define fourcc_mod_is_vendor (modifier , vendor ) \
419+ (fourcc_mod_get_vendor(modifier) == DRM_FORMAT_MOD_VENDOR_## vendor)
420+
376421#define fourcc_mod_code (vendor , val ) \
377422 ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL))
378423
@@ -540,7 +585,7 @@ extern "C" {
540585 *
541586 * The main surface is Y-tiled and is at plane index 0 whereas CCS is linear
542587 * and at index 1. The clear color is stored at index 2, and the pitch should
543- * be ignored . The clear color structure is 256 bits. The first 128 bits
588+ * be 64 bytes aligned . The clear color structure is 256 bits. The first 128 bits
544589 * represents Raw Clear Color Red, Green, Blue and Alpha color each represented
545590 * by 32 bits. The raw clear color is consumed by the 3d engine and generates
546591 * the converted clear color of size 64 bits. The first 32 bits store the Lower
@@ -553,6 +598,53 @@ extern "C" {
553598 */
554599#define I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC fourcc_mod_code(INTEL, 8)
555600
601+ /*
602+ * Intel Tile 4 layout
603+ *
604+ * This is a tiled layout using 4KB tiles in a row-major layout. It has the same
605+ * shape as Tile Y at two granularities: 4KB (128B x 32) and 64B (16B x 4). It
606+ * only differs from Tile Y at the 256B granularity in between. At this
607+ * granularity, Tile Y has a shape of 16B x 32 rows, but this tiling has a shape
608+ * of 64B x 8 rows.
609+ */
610+ #define I915_FORMAT_MOD_4_TILED fourcc_mod_code(INTEL, 9)
611+
612+ /*
613+ * Intel color control surfaces (CCS) for DG2 render compression.
614+ *
615+ * The main surface is Tile 4 and at plane index 0. The CCS data is stored
616+ * outside of the GEM object in a reserved memory area dedicated for the
617+ * storage of the CCS data for all RC/RC_CC/MC compressible GEM objects. The
618+ * main surface pitch is required to be a multiple of four Tile 4 widths.
619+ */
620+ #define I915_FORMAT_MOD_4_TILED_DG2_RC_CCS fourcc_mod_code(INTEL, 10)
621+
622+ /*
623+ * Intel color control surfaces (CCS) for DG2 media compression.
624+ *
625+ * The main surface is Tile 4 and at plane index 0. For semi-planar formats
626+ * like NV12, the Y and UV planes are Tile 4 and are located at plane indices
627+ * 0 and 1, respectively. The CCS for all planes are stored outside of the
628+ * GEM object in a reserved memory area dedicated for the storage of the
629+ * CCS data for all RC/RC_CC/MC compressible GEM objects. The main surface
630+ * pitch is required to be a multiple of four Tile 4 widths.
631+ */
632+ #define I915_FORMAT_MOD_4_TILED_DG2_MC_CCS fourcc_mod_code(INTEL, 11)
633+
634+ /*
635+ * Intel Color Control Surface with Clear Color (CCS) for DG2 render compression.
636+ *
637+ * The main surface is Tile 4 and at plane index 0. The CCS data is stored
638+ * outside of the GEM object in a reserved memory area dedicated for the
639+ * storage of the CCS data for all RC/RC_CC/MC compressible GEM objects. The
640+ * main surface pitch is required to be a multiple of four Tile 4 widths. The
641+ * clear color is stored at plane index 1 and the pitch should be 64 bytes
642+ * aligned. The format of the 256 bits of clear color data matches the one used
643+ * for the I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC modifier, see its description
644+ * for details.
645+ */
646+ #define I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC fourcc_mod_code(INTEL, 12)
647+
556648/*
557649 * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks
558650 *
@@ -590,6 +682,28 @@ extern "C" {
590682 */
591683#define DRM_FORMAT_MOD_QCOM_COMPRESSED fourcc_mod_code(QCOM, 1)
592684
685+ /*
686+ * Qualcomm Tiled Format
687+ *
688+ * Similar to DRM_FORMAT_MOD_QCOM_COMPRESSED but not compressed.
689+ * Implementation may be platform and base-format specific.
690+ *
691+ * Each macrotile consists of m x n (mostly 4 x 4) tiles.
692+ * Pixel data pitch/stride is aligned with macrotile width.
693+ * Pixel data height is aligned with macrotile height.
694+ * Entire pixel data buffer is aligned with 4k(bytes).
695+ */
696+ #define DRM_FORMAT_MOD_QCOM_TILED3 fourcc_mod_code(QCOM, 3)
697+
698+ /*
699+ * Qualcomm Alternate Tiled Format
700+ *
701+ * Alternate tiled format typically only used within GMEM.
702+ * Implementation may be platform and base-format specific.
703+ */
704+ #define DRM_FORMAT_MOD_QCOM_TILED2 fourcc_mod_code(QCOM, 2)
705+
706+
593707/* Vivante framebuffer modifiers */
594708
595709/*
@@ -842,6 +956,10 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)
842956 * and UV. Some SAND-using hardware stores UV in a separate tiled
843957 * image from Y to reduce the column height, which is not supported
844958 * with these modifiers.
959+ *
960+ * The DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT modifier is also
961+ * supported for DRM_FORMAT_P030 where the columns remain as 128 bytes
962+ * wide, but as this is a 10 bpp format that translates to 96 pixels.
845963 */
846964
847965#define DRM_FORMAT_MOD_BROADCOM_SAND32_COL_HEIGHT (v ) \
@@ -1271,6 +1389,7 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)
12711389#define AMD_FMT_MOD_TILE_VER_GFX9 1
12721390#define AMD_FMT_MOD_TILE_VER_GFX10 2
12731391#define AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS 3
1392+ #define AMD_FMT_MOD_TILE_VER_GFX11 4
12741393
12751394/*
12761395 * 64K_S is the same for GFX9/GFX10/GFX10_RBPLUS and hence has GFX9 as canonical
@@ -1286,6 +1405,7 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)
12861405#define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25
12871406#define AMD_FMT_MOD_TILE_GFX9_64K_D_X 26
12881407#define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27
1408+ #define AMD_FMT_MOD_TILE_GFX11_256K_R_X 31
12891409
12901410#define AMD_FMT_MOD_DCC_BLOCK_64B 0
12911411#define AMD_FMT_MOD_DCC_BLOCK_128B 1
@@ -1352,11 +1472,11 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)
13521472#define AMD_FMT_MOD_PIPE_MASK 0x7
13531473
13541474#define AMD_FMT_MOD_SET (field , value ) \
1355- ((uint64_t )(value) << AMD_FMT_MOD_##field##_SHIFT)
1475+ ((__u64 )(value) << AMD_FMT_MOD_##field##_SHIFT)
13561476#define AMD_FMT_MOD_GET (field , value ) \
13571477 (((value) >> AMD_FMT_MOD_##field##_SHIFT) & AMD_FMT_MOD_##field##_MASK)
13581478#define AMD_FMT_MOD_CLEAR (field ) \
1359- (~((uint64_t )AMD_FMT_MOD_##field##_MASK << AMD_FMT_MOD_##field##_SHIFT))
1479+ (~((__u64 )AMD_FMT_MOD_##field##_MASK << AMD_FMT_MOD_##field##_SHIFT))
13601480
13611481#if defined(__cplusplus )
13621482 }
0 commit comments