|
|
|
@ -57,6 +57,30 @@ extern "C" { |
|
|
|
* may preserve meaning - such as number of planes - from the fourcc code, |
|
|
|
* whereas others may not. |
|
|
|
* |
|
|
|
* Modifiers must uniquely encode buffer layout. In other words, a buffer must |
|
|
|
* match only a single modifier. A modifier must not be a subset of layouts of |
|
|
|
* another modifier. For instance, it's incorrect to encode pitch alignment in |
|
|
|
* a modifier: a buffer may match a 64-pixel aligned modifier and a 32-pixel |
|
|
|
* aligned modifier. That said, modifiers can have implicit minimal |
|
|
|
* requirements. |
|
|
|
* |
|
|
|
* For modifiers where the combination of fourcc code and modifier can alias, |
|
|
|
* a canonical pair needs to be defined and used by all drivers. Preferred |
|
|
|
* combinations are also encouraged where all combinations might lead to |
|
|
|
* confusion and unnecessarily reduced interoperability. An example for the |
|
|
|
* latter is AFBC, where the ABGR layouts are preferred over ARGB layouts. |
|
|
|
* |
|
|
|
* There are two kinds of modifier users: |
|
|
|
* |
|
|
|
* - Kernel and user-space drivers: for drivers it's important that modifiers |
|
|
|
* don't alias, otherwise two drivers might support the same format but use |
|
|
|
* different aliases, preventing them from sharing buffers in an efficient |
|
|
|
* format. |
|
|
|
* - Higher-level programs interfacing with KMS/GBM/EGL/Vulkan/etc: these users |
|
|
|
* see modifiers as opaque tokens they can check for equality and intersect. |
|
|
|
* These users musn't need to know to reason about the modifier value |
|
|
|
* (i.e. they are not expected to extract information out of the modifier). |
|
|
|
* |
|
|
|
* Vendors should document their modifier usage in as much detail as |
|
|
|
* possible, to ensure maximum compatibility across devices, drivers and |
|
|
|
* applications. |
|
|
|
@ -154,6 +178,12 @@ extern "C" { |
|
|
|
#define DRM_FORMAT_ARGB16161616F fourcc_code('A', 'R', '4', 'H') /* [63:0] A:R:G:B 16:16:16:16 little endian */ |
|
|
|
#define DRM_FORMAT_ABGR16161616F fourcc_code('A', 'B', '4', 'H') /* [63:0] A:B:G:R 16:16:16:16 little endian */ |
|
|
|
|
|
|
|
/*
|
|
|
|
* RGBA format with 10-bit components packed in 64-bit per pixel, with 6 bits |
|
|
|
* of unused padding per component: |
|
|
|
*/ |
|
|
|
#define DRM_FORMAT_AXBXGXRX106106106106 fourcc_code('A', 'B', '1', '0') /* [63:0] A:x:B:x:G:x:R:x 10:6:10:6:10:6:10:6 little endian */ |
|
|
|
|
|
|
|
/* packed YCbCr */ |
|
|
|
#define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */ |
|
|
|
#define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */ |
|
|
|
@ -319,7 +349,6 @@ extern "C" { |
|
|
|
*/ |
|
|
|
|
|
|
|
/* Vendor Ids: */ |
|
|
|
#define DRM_FORMAT_MOD_NONE 0 |
|
|
|
#define DRM_FORMAT_MOD_VENDOR_NONE 0 |
|
|
|
#define DRM_FORMAT_MOD_VENDOR_INTEL 0x01 |
|
|
|
#define DRM_FORMAT_MOD_VENDOR_AMD 0x02 |
|
|
|
@ -391,6 +420,16 @@ extern "C" { |
|
|
|
*/ |
|
|
|
#define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0) |
|
|
|
|
|
|
|
/*
|
|
|
|
* Deprecated: use DRM_FORMAT_MOD_LINEAR instead |
|
|
|
* |
|
|
|
* The "none" format modifier doesn't actually mean that the modifier is |
|
|
|
* implicit, instead it means that the layout is linear. Whether modifiers are |
|
|
|
* used is out-of-band information carried in an API-specific way (e.g. in a |
|
|
|
* flag for drm_mode_fb_cmd2). |
|
|
|
*/ |
|
|
|
#define DRM_FORMAT_MOD_NONE 0 |
|
|
|
|
|
|
|
/* Intel framebuffer modifiers */ |
|
|
|
|
|
|
|
/*
|
|
|
|
@ -1055,6 +1094,140 @@ drm_fourcc_canonicalize_nvidia_format_mod(uint64_t modifier) |
|
|
|
*/ |
|
|
|
#define AMLOGIC_FBC_OPTION_MEM_SAVING (1ULL << 0) |
|
|
|
|
|
|
|
/*
|
|
|
|
* AMD modifiers |
|
|
|
* |
|
|
|
* Memory layout: |
|
|
|
* |
|
|
|
* without DCC: |
|
|
|
* - main surface |
|
|
|
* |
|
|
|
* with DCC & without DCC_RETILE: |
|
|
|
* - main surface in plane 0 |
|
|
|
* - DCC surface in plane 1 (RB-aligned, pipe-aligned if DCC_PIPE_ALIGN is set) |
|
|
|
* |
|
|
|
* with DCC & DCC_RETILE: |
|
|
|
* - main surface in plane 0 |
|
|
|
* - displayable DCC surface in plane 1 (not RB-aligned & not pipe-aligned) |
|
|
|
* - pipe-aligned DCC surface in plane 2 (RB-aligned & pipe-aligned) |
|
|
|
* |
|
|
|
* For multi-plane formats the above surfaces get merged into one plane for |
|
|
|
* each format plane, based on the required alignment only. |
|
|
|
* |
|
|
|
* Bits Parameter Notes |
|
|
|
* ----- ------------------------ --------------------------------------------- |
|
|
|
* |
|
|
|
* 7:0 TILE_VERSION Values are AMD_FMT_MOD_TILE_VER_* |
|
|
|
* 12:8 TILE Values are AMD_FMT_MOD_TILE_<version>_* |
|
|
|
* 13 DCC |
|
|
|
* 14 DCC_RETILE |
|
|
|
* 15 DCC_PIPE_ALIGN |
|
|
|
* 16 DCC_INDEPENDENT_64B |
|
|
|
* 17 DCC_INDEPENDENT_128B |
|
|
|
* 19:18 DCC_MAX_COMPRESSED_BLOCK Values are AMD_FMT_MOD_DCC_BLOCK_* |
|
|
|
* 20 DCC_CONSTANT_ENCODE |
|
|
|
* 23:21 PIPE_XOR_BITS Only for some chips |
|
|
|
* 26:24 BANK_XOR_BITS Only for some chips |
|
|
|
* 29:27 PACKERS Only for some chips |
|
|
|
* 32:30 RB Only for some chips |
|
|
|
* 35:33 PIPE Only for some chips |
|
|
|
* 55:36 - Reserved for future use, must be zero |
|
|
|
*/ |
|
|
|
#define AMD_FMT_MOD fourcc_mod_code(AMD, 0) |
|
|
|
|
|
|
|
#define IS_AMD_FMT_MOD(val) (((val) >> 56) == DRM_FORMAT_MOD_VENDOR_AMD) |
|
|
|
|
|
|
|
/* Reserve 0 for GFX8 and older */ |
|
|
|
#define AMD_FMT_MOD_TILE_VER_GFX9 1 |
|
|
|
#define AMD_FMT_MOD_TILE_VER_GFX10 2 |
|
|
|
#define AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS 3 |
|
|
|
|
|
|
|
/*
|
|
|
|
* 64K_S is the same for GFX9/GFX10/GFX10_RBPLUS and hence has GFX9 as canonical |
|
|
|
* version. |
|
|
|
*/ |
|
|
|
#define AMD_FMT_MOD_TILE_GFX9_64K_S 9 |
|
|
|
|
|
|
|
/*
|
|
|
|
* 64K_D for non-32 bpp is the same for GFX9/GFX10/GFX10_RBPLUS and hence has |
|
|
|
* GFX9 as canonical version. |
|
|
|
*/ |
|
|
|
#define AMD_FMT_MOD_TILE_GFX9_64K_D 10 |
|
|
|
#define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25 |
|
|
|
#define AMD_FMT_MOD_TILE_GFX9_64K_D_X 26 |
|
|
|
#define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27 |
|
|
|
|
|
|
|
#define AMD_FMT_MOD_DCC_BLOCK_64B 0 |
|
|
|
#define AMD_FMT_MOD_DCC_BLOCK_128B 1 |
|
|
|
#define AMD_FMT_MOD_DCC_BLOCK_256B 2 |
|
|
|
|
|
|
|
#define AMD_FMT_MOD_TILE_VERSION_SHIFT 0 |
|
|
|
#define AMD_FMT_MOD_TILE_VERSION_MASK 0xFF |
|
|
|
#define AMD_FMT_MOD_TILE_SHIFT 8 |
|
|
|
#define AMD_FMT_MOD_TILE_MASK 0x1F |
|
|
|
|
|
|
|
/* Whether DCC compression is enabled. */ |
|
|
|
#define AMD_FMT_MOD_DCC_SHIFT 13 |
|
|
|
#define AMD_FMT_MOD_DCC_MASK 0x1 |
|
|
|
|
|
|
|
/*
|
|
|
|
* Whether to include two DCC surfaces, one which is rb & pipe aligned, and |
|
|
|
* one which is not-aligned. |
|
|
|
*/ |
|
|
|
#define AMD_FMT_MOD_DCC_RETILE_SHIFT 14 |
|
|
|
#define AMD_FMT_MOD_DCC_RETILE_MASK 0x1 |
|
|
|
|
|
|
|
/* Only set if DCC_RETILE = false */ |
|
|
|
#define AMD_FMT_MOD_DCC_PIPE_ALIGN_SHIFT 15 |
|
|
|
#define AMD_FMT_MOD_DCC_PIPE_ALIGN_MASK 0x1 |
|
|
|
|
|
|
|
#define AMD_FMT_MOD_DCC_INDEPENDENT_64B_SHIFT 16 |
|
|
|
#define AMD_FMT_MOD_DCC_INDEPENDENT_64B_MASK 0x1 |
|
|
|
#define AMD_FMT_MOD_DCC_INDEPENDENT_128B_SHIFT 17 |
|
|
|
#define AMD_FMT_MOD_DCC_INDEPENDENT_128B_MASK 0x1 |
|
|
|
#define AMD_FMT_MOD_DCC_MAX_COMPRESSED_BLOCK_SHIFT 18 |
|
|
|
#define AMD_FMT_MOD_DCC_MAX_COMPRESSED_BLOCK_MASK 0x3 |
|
|
|
|
|
|
|
/*
|
|
|
|
* DCC supports embedding some clear colors directly in the DCC surface. |
|
|
|
* However, on older GPUs the rendering HW ignores the embedded clear color |
|
|
|
* and prefers the driver provided color. This necessitates doing a fastclear |
|
|
|
* eliminate operation before a process transfers control. |
|
|
|
* |
|
|
|
* If this bit is set that means the fastclear eliminate is not needed for these |
|
|
|
* embeddable colors. |
|
|
|
*/ |
|
|
|
#define AMD_FMT_MOD_DCC_CONSTANT_ENCODE_SHIFT 20 |
|
|
|
#define AMD_FMT_MOD_DCC_CONSTANT_ENCODE_MASK 0x1 |
|
|
|
|
|
|
|
/*
|
|
|
|
* The below fields are for accounting for per GPU differences. These are only |
|
|
|
* relevant for GFX9 and later and if the tile field is *_X/_T. |
|
|
|
* |
|
|
|
* PIPE_XOR_BITS = always needed |
|
|
|
* BANK_XOR_BITS = only for TILE_VER_GFX9 |
|
|
|
* PACKERS = only for TILE_VER_GFX10_RBPLUS |
|
|
|
* RB = only for TILE_VER_GFX9 & DCC |
|
|
|
* PIPE = only for TILE_VER_GFX9 & DCC & (DCC_RETILE | DCC_PIPE_ALIGN) |
|
|
|
*/ |
|
|
|
#define AMD_FMT_MOD_PIPE_XOR_BITS_SHIFT 21 |
|
|
|
#define AMD_FMT_MOD_PIPE_XOR_BITS_MASK 0x7 |
|
|
|
#define AMD_FMT_MOD_BANK_XOR_BITS_SHIFT 24 |
|
|
|
#define AMD_FMT_MOD_BANK_XOR_BITS_MASK 0x7 |
|
|
|
#define AMD_FMT_MOD_PACKERS_SHIFT 27 |
|
|
|
#define AMD_FMT_MOD_PACKERS_MASK 0x7 |
|
|
|
#define AMD_FMT_MOD_RB_SHIFT 30 |
|
|
|
#define AMD_FMT_MOD_RB_MASK 0x7 |
|
|
|
#define AMD_FMT_MOD_PIPE_SHIFT 33 |
|
|
|
#define AMD_FMT_MOD_PIPE_MASK 0x7 |
|
|
|
|
|
|
|
#define AMD_FMT_MOD_SET(field, value) \ |
|
|
|
((uint64_t)(value) << AMD_FMT_MOD_##field##_SHIFT) |
|
|
|
#define AMD_FMT_MOD_GET(field, value) \ |
|
|
|
(((value) >> AMD_FMT_MOD_##field##_SHIFT) & AMD_FMT_MOD_##field##_MASK) |
|
|
|
#define AMD_FMT_MOD_CLEAR(field) \ |
|
|
|
(~((uint64_t)AMD_FMT_MOD_##field##_MASK << AMD_FMT_MOD_##field##_SHIFT)) |
|
|
|
|
|
|
|
#if defined(__cplusplus) |
|
|
|
} |
|
|
|
#endif |
|
|
|
|