aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm/drm_fourcc.h')
-rw-r--r--include/drm/drm_fourcc.h184
1 files changed, 182 insertions, 2 deletions
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
index 4d8da699..e04613d3 100644
--- a/include/drm/drm_fourcc.h
+++ b/include/drm/drm_fourcc.h
@@ -26,6 +26,10 @@
26 26
27#include "drm.h" 27#include "drm.h"
28 28
29#if defined(__cplusplus)
30extern "C" {
31#endif
32
29#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \ 33#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \
30 ((__u32)(c) << 16) | ((__u32)(d) << 24)) 34 ((__u32)(c) << 16) | ((__u32)(d) << 24))
31 35
@@ -37,10 +41,17 @@
37/* 8 bpp Red */ 41/* 8 bpp Red */
38#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */ 42#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */
39 43
44/* 16 bpp Red */
45#define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */
46
40/* 16 bpp RG */ 47/* 16 bpp RG */
41#define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */ 48#define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */
42#define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */ 49#define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */
43 50
51/* 32 bpp RG */
52#define DRM_FORMAT_RG1616 fourcc_code('R', 'G', '3', '2') /* [31:0] R:G 16:16 little endian */
53#define DRM_FORMAT_GR1616 fourcc_code('G', 'R', '3', '2') /* [31:0] G:R 16:16 little endian */
54
44/* 8 bpp RGB */ 55/* 8 bpp RGB */
45#define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ 56#define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */
46#define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ 57#define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */
@@ -103,6 +114,20 @@
103#define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ 114#define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
104 115
105/* 116/*
117 * 2 plane RGB + A
118 * index 0 = RGB plane, same format as the corresponding non _A8 format has
119 * index 1 = A plane, [7:0] A
120 */
121#define DRM_FORMAT_XRGB8888_A8 fourcc_code('X', 'R', 'A', '8')
122#define DRM_FORMAT_XBGR8888_A8 fourcc_code('X', 'B', 'A', '8')
123#define DRM_FORMAT_RGBX8888_A8 fourcc_code('R', 'X', 'A', '8')
124#define DRM_FORMAT_BGRX8888_A8 fourcc_code('B', 'X', 'A', '8')
125#define DRM_FORMAT_RGB888_A8 fourcc_code('R', '8', 'A', '8')
126#define DRM_FORMAT_BGR888_A8 fourcc_code('B', '8', 'A', '8')
127#define DRM_FORMAT_RGB565_A8 fourcc_code('R', '5', 'A', '8')
128#define DRM_FORMAT_BGR565_A8 fourcc_code('B', '5', 'A', '8')
129
130/*
106 * 2 plane YCbCr 131 * 2 plane YCbCr
107 * index 0 = Y plane, [7:0] Y 132 * index 0 = Y plane, [7:0] Y
108 * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian 133 * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
@@ -150,15 +175,20 @@
150 175
151/* Vendor Ids: */ 176/* Vendor Ids: */
152#define DRM_FORMAT_MOD_NONE 0 177#define DRM_FORMAT_MOD_NONE 0
178#define DRM_FORMAT_MOD_VENDOR_NONE 0
153#define DRM_FORMAT_MOD_VENDOR_INTEL 0x01 179#define DRM_FORMAT_MOD_VENDOR_INTEL 0x01
154#define DRM_FORMAT_MOD_VENDOR_AMD 0x02 180#define DRM_FORMAT_MOD_VENDOR_AMD 0x02
155#define DRM_FORMAT_MOD_VENDOR_NV 0x03 181#define DRM_FORMAT_MOD_VENDOR_NVIDIA 0x03
156#define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 182#define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04
157#define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 183#define DRM_FORMAT_MOD_VENDOR_QCOM 0x05
184#define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06
185#define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07
158/* add more to the end as needed */ 186/* add more to the end as needed */
159 187
188#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1)
189
160#define fourcc_mod_code(vendor, val) \ 190#define fourcc_mod_code(vendor, val) \
161 ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | (val & 0x00ffffffffffffffULL)) 191 ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL))
162 192
163/* 193/*
164 * Format Modifier tokens: 194 * Format Modifier tokens:
@@ -168,6 +198,25 @@
168 * authoritative source for all of these. 198 * authoritative source for all of these.
169 */ 199 */
170 200
201/*
202 * Invalid Modifier
203 *
204 * This modifier can be used as a sentinel to terminate the format modifiers
205 * list, or to initialize a variable with an invalid modifier. It might also be
206 * used to report an error back to userspace for certain APIs.
207 */
208#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED)
209
210/*
211 * Linear Layout
212 *
213 * Just plain linear layout. Note that this is different from no specifying any
214 * modifier (e.g. not setting DRM_MODE_FB_MODIFIERS in the DRM_ADDFB2 ioctl),
215 * which tells the driver to also take driver-internal information into account
216 * and so might actually result in a tiled framebuffer.
217 */
218#define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0)
219
171/* Intel framebuffer modifiers */ 220/* Intel framebuffer modifiers */
172 221
173/* 222/*
@@ -215,6 +264,26 @@
215#define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3) 264#define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3)
216 265
217/* 266/*
267 * Intel color control surface (CCS) for render compression
268 *
269 * The framebuffer format must be one of the 8:8:8:8 RGB formats.
270 * The main surface will be plane index 0 and must be Y/Yf-tiled,
271 * the CCS will be plane index 1.
272 *
273 * Each CCS tile matches a 1024x512 pixel area of the main surface.
274 * To match certain aspects of the 3D hardware the CCS is
275 * considered to be made up of normal 128Bx32 Y tiles, Thus
276 * the CCS pitch must be specified in multiples of 128 bytes.
277 *
278 * In reality the CCS tile appears to be a 64Bx64 Y tile, composed
279 * of QWORD (8 bytes) chunks instead of OWORD (16 bytes) chunks.
280 * But that fact is not relevant unless the memory is accessed
281 * directly.
282 */
283#define I915_FORMAT_MOD_Y_TILED_CCS fourcc_mod_code(INTEL, 4)
284#define I915_FORMAT_MOD_Yf_TILED_CCS fourcc_mod_code(INTEL, 5)
285
286/*
218 * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks 287 * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks
219 * 288 *
220 * Macroblocks are laid in a Z-shape, and each pixel data is following the 289 * Macroblocks are laid in a Z-shape, and each pixel data is following the
@@ -229,4 +298,115 @@
229 */ 298 */
230#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) 299#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
231 300
301/* Vivante framebuffer modifiers */
302
303/*
304 * Vivante 4x4 tiling layout
305 *
306 * This is a simple tiled layout using tiles of 4x4 pixels in a row-major
307 * layout.
308 */
309#define DRM_FORMAT_MOD_VIVANTE_TILED fourcc_mod_code(VIVANTE, 1)
310
311/*
312 * Vivante 64x64 super-tiling layout
313 *
314 * This is a tiled layout using 64x64 pixel super-tiles, where each super-tile
315 * contains 8x4 groups of 2x4 tiles of 4x4 pixels (like above) each, all in row-
316 * major layout.
317 *
318 * For more information: see
319 * https://github.com/etnaviv/etna_viv/blob/master/doc/hardware.md#texture-tiling
320 */
321#define DRM_FORMAT_MOD_VIVANTE_SUPER_TILED fourcc_mod_code(VIVANTE, 2)
322
323/*
324 * Vivante 4x4 tiling layout for dual-pipe
325 *
326 * Same as the 4x4 tiling layout, except every second 4x4 pixel tile starts at a
327 * different base address. Offsets from the base addresses are therefore halved
328 * compared to the non-split tiled layout.
329 */
330#define DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED fourcc_mod_code(VIVANTE, 3)
331
332/*
333 * Vivante 64x64 super-tiling layout for dual-pipe
334 *
335 * Same as the 64x64 super-tiling layout, except every second 4x4 pixel tile
336 * starts at a different base address. Offsets from the base addresses are
337 * therefore halved compared to the non-split super-tiled layout.
338 */
339#define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4)
340
341/* NVIDIA frame buffer modifiers */
342
343/*
344 * Tegra Tiled Layout, used by Tegra 2, 3 and 4.
345 *
346 * Pixels are arranged in simple tiles of 16 x 16 bytes.
347 */
348#define DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED fourcc_mod_code(NVIDIA, 1)
349
350/*
351 * 16Bx2 Block Linear layout, used by desktop GPUs, and Tegra K1 and later
352 *
353 * Pixels are arranged in 64x8 Groups Of Bytes (GOBs). GOBs are then stacked
354 * vertically by a power of 2 (1 to 32 GOBs) to form a block.
355 *
356 * Within a GOB, data is ordered as 16B x 2 lines sectors laid in Z-shape.
357 *
358 * Parameter 'v' is the log2 encoding of the number of GOBs stacked vertically.
359 * Valid values are:
360 *
361 * 0 == ONE_GOB
362 * 1 == TWO_GOBS
363 * 2 == FOUR_GOBS
364 * 3 == EIGHT_GOBS
365 * 4 == SIXTEEN_GOBS
366 * 5 == THIRTYTWO_GOBS
367 *
368 * Chapter 20 "Pixel Memory Formats" of the Tegra X1 TRM describes this format
369 * in full detail.
370 */
371#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(v) \
372 fourcc_mod_code(NVIDIA, 0x10 | ((v) & 0xf))
373
374#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB \
375 fourcc_mod_code(NVIDIA, 0x10)
376#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB \
377 fourcc_mod_code(NVIDIA, 0x11)
378#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB \
379 fourcc_mod_code(NVIDIA, 0x12)
380#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB \
381 fourcc_mod_code(NVIDIA, 0x13)
382#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB \
383 fourcc_mod_code(NVIDIA, 0x14)
384#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB \
385 fourcc_mod_code(NVIDIA, 0x15)
386
387/*
388 * Broadcom VC4 "T" format
389 *
390 * This is the primary layout that the V3D GPU can texture from (it
391 * can't do linear). The T format has:
392 *
393 * - 64b utiles of pixels in a raster-order grid according to cpp. It's 4x4
394 * pixels at 32 bit depth.
395 *
396 * - 1k subtiles made of a 4x4 raster-order grid of 64b utiles (so usually
397 * 16x16 pixels).
398 *
399 * - 4k tiles made of a 2x2 grid of 1k subtiles (so usually 32x32 pixels). On
400 * even 4k tile rows, they're arranged as (BL, TL, TR, BR), and on odd rows
401 * they're (TR, BR, BL, TL), where bottom left is start of memory.
402 *
403 * - an image made of 4k tiles in rows either left-to-right (even rows of 4k
404 * tiles) or right-to-left (odd rows of 4k tiles).
405 */
406#define DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED fourcc_mod_code(BROADCOM, 1)
407
408#if defined(__cplusplus)
409}
410#endif
411
232#endif /* DRM_FOURCC_H */ 412#endif /* DRM_FOURCC_H */