Ao Xu | 0733c43 | 2018-11-02 17:35:02 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the next |
| 12 | * paragraph) shall be included in all copies or substantial portions of the |
| 13 | * Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 21 | * OTHER DEALINGS IN THE SOFTWARE. |
| 22 | */ |
| 23 | |
| 24 | #ifndef DRM_FOURCC_H |
| 25 | #define DRM_FOURCC_H |
| 26 | |
| 27 | #include "drm.h" |
| 28 | |
| 29 | #if defined(__cplusplus) |
| 30 | extern "C" { |
| 31 | #endif |
| 32 | |
| 33 | #define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \ |
| 34 | ((__u32)(c) << 16) | ((__u32)(d) << 24)) |
| 35 | |
| 36 | #define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */ |
| 37 | |
| 38 | /* color index */ |
| 39 | #define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ |
| 40 | |
| 41 | /* 8 bpp Red */ |
| 42 | #define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */ |
| 43 | |
Ao Xu | fdaeff6 | 2020-07-31 16:47:29 +0800 | [diff] [blame] | 44 | /* 16 bpp Red */ |
| 45 | #define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */ |
| 46 | |
Ao Xu | 0733c43 | 2018-11-02 17:35:02 +0800 | [diff] [blame] | 47 | /* 16 bpp RG */ |
| 48 | #define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */ |
| 49 | #define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */ |
| 50 | |
| 51 | /* 8 bpp RGB */ |
| 52 | #define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ |
| 53 | #define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ |
| 54 | |
| 55 | /* 16 bpp RGB */ |
| 56 | #define DRM_FORMAT_XRGB4444 fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */ |
| 57 | #define DRM_FORMAT_XBGR4444 fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */ |
| 58 | #define DRM_FORMAT_RGBX4444 fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */ |
| 59 | #define DRM_FORMAT_BGRX4444 fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */ |
| 60 | |
| 61 | #define DRM_FORMAT_ARGB4444 fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */ |
| 62 | #define DRM_FORMAT_ABGR4444 fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */ |
| 63 | #define DRM_FORMAT_RGBA4444 fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */ |
| 64 | #define DRM_FORMAT_BGRA4444 fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */ |
| 65 | |
| 66 | #define DRM_FORMAT_XRGB1555 fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */ |
| 67 | #define DRM_FORMAT_XBGR1555 fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */ |
| 68 | #define DRM_FORMAT_RGBX5551 fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */ |
| 69 | #define DRM_FORMAT_BGRX5551 fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */ |
| 70 | |
| 71 | #define DRM_FORMAT_ARGB1555 fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */ |
| 72 | #define DRM_FORMAT_ABGR1555 fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */ |
| 73 | #define DRM_FORMAT_RGBA5551 fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */ |
| 74 | #define DRM_FORMAT_BGRA5551 fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */ |
| 75 | |
| 76 | #define DRM_FORMAT_RGB565 fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */ |
| 77 | #define DRM_FORMAT_BGR565 fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */ |
| 78 | |
| 79 | /* 24 bpp RGB */ |
| 80 | #define DRM_FORMAT_RGB888 fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */ |
| 81 | #define DRM_FORMAT_BGR888 fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */ |
| 82 | |
| 83 | /* 32 bpp RGB */ |
| 84 | #define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */ |
| 85 | #define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */ |
| 86 | #define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */ |
| 87 | #define DRM_FORMAT_BGRX8888 fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */ |
| 88 | |
| 89 | #define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */ |
| 90 | #define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */ |
| 91 | #define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */ |
| 92 | #define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */ |
| 93 | |
| 94 | #define DRM_FORMAT_XRGB2101010 fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */ |
| 95 | #define DRM_FORMAT_XBGR2101010 fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */ |
| 96 | #define DRM_FORMAT_RGBX1010102 fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */ |
| 97 | #define DRM_FORMAT_BGRX1010102 fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */ |
| 98 | |
| 99 | #define DRM_FORMAT_ARGB2101010 fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */ |
| 100 | #define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */ |
| 101 | #define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */ |
| 102 | #define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */ |
| 103 | |
Ao Xu | fdaeff6 | 2020-07-31 16:47:29 +0800 | [diff] [blame] | 104 | /* |
| 105 | * Floating point 64bpp RGB |
| 106 | * IEEE 754-2008 binary16 half-precision float |
| 107 | * [15:0] sign:exponent:mantissa 1:5:10 |
| 108 | */ |
| 109 | #define DRM_FORMAT_XRGB16161616F fourcc_code('X', 'R', '4', 'H') /* [63:0] x:R:G:B 16:16:16:16 little endian */ |
| 110 | #define DRM_FORMAT_XBGR16161616F fourcc_code('X', 'B', '4', 'H') /* [63:0] x:B:G:R 16:16:16:16 little endian */ |
| 111 | |
| 112 | #define DRM_FORMAT_ARGB16161616F fourcc_code('A', 'R', '4', 'H') /* [63:0] A:R:G:B 16:16:16:16 little endian */ |
| 113 | #define DRM_FORMAT_ABGR16161616F fourcc_code('A', 'B', '4', 'H') /* [63:0] A:B:G:R 16:16:16:16 little endian */ |
| 114 | |
Ao Xu | 0733c43 | 2018-11-02 17:35:02 +0800 | [diff] [blame] | 115 | /* packed YCbCr */ |
| 116 | #define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */ |
| 117 | #define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */ |
| 118 | #define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */ |
| 119 | #define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */ |
| 120 | |
| 121 | #define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ |
| 122 | |
| 123 | /* |
| 124 | * 2 plane YCbCr |
| 125 | * index 0 = Y plane, [7:0] Y |
| 126 | * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian |
| 127 | * or |
| 128 | * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian |
| 129 | */ |
| 130 | #define DRM_FORMAT_NV12 fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */ |
| 131 | #define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */ |
| 132 | #define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ |
| 133 | #define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ |
| 134 | #define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */ |
| 135 | #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */ |
| 136 | |
| 137 | /* |
| 138 | * 3 plane YCbCr |
| 139 | * index 0: Y plane, [7:0] Y |
| 140 | * index 1: Cb plane, [7:0] Cb |
| 141 | * index 2: Cr plane, [7:0] Cr |
| 142 | * or |
| 143 | * index 1: Cr plane, [7:0] Cr |
| 144 | * index 2: Cb plane, [7:0] Cb |
| 145 | */ |
| 146 | #define DRM_FORMAT_YUV410 fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */ |
| 147 | #define DRM_FORMAT_YVU410 fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */ |
| 148 | #define DRM_FORMAT_YUV411 fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */ |
| 149 | #define DRM_FORMAT_YVU411 fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */ |
| 150 | #define DRM_FORMAT_YUV420 fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */ |
| 151 | #define DRM_FORMAT_YVU420 fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */ |
| 152 | #define DRM_FORMAT_YUV422 fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */ |
| 153 | #define DRM_FORMAT_YVU422 fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */ |
| 154 | #define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ |
| 155 | #define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ |
| 156 | |
| 157 | |
| 158 | /* |
| 159 | * Format Modifiers: |
| 160 | * |
| 161 | * Format modifiers describe, typically, a re-ordering or modification |
| 162 | * of the data in a plane of an FB. This can be used to express tiled/ |
| 163 | * swizzled formats, or compression, or a combination of the two. |
| 164 | * |
| 165 | * The upper 8 bits of the format modifier are a vendor-id as assigned |
| 166 | * below. The lower 56 bits are assigned as vendor sees fit. |
| 167 | */ |
| 168 | |
| 169 | /* Vendor Ids: */ |
| 170 | #define DRM_FORMAT_MOD_NONE 0 |
| 171 | #define DRM_FORMAT_MOD_VENDOR_NONE 0 |
| 172 | #define DRM_FORMAT_MOD_VENDOR_INTEL 0x01 |
| 173 | #define DRM_FORMAT_MOD_VENDOR_AMD 0x02 |
| 174 | #define DRM_FORMAT_MOD_VENDOR_NV 0x03 |
| 175 | #define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 |
| 176 | #define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 |
Ao Xu | fdaeff6 | 2020-07-31 16:47:29 +0800 | [diff] [blame] | 177 | #define DRM_FORMAT_MOD_VENDOR_ARM 0x08 |
| 178 | #define DRM_FORMAT_MOD_VENDOR_AMLOGIC 0x0a |
Ao Xu | 0733c43 | 2018-11-02 17:35:02 +0800 | [diff] [blame] | 179 | /* add more to the end as needed */ |
| 180 | |
| 181 | #define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) |
| 182 | |
| 183 | #define fourcc_mod_code(vendor, val) \ |
Ao Xu | fdaeff6 | 2020-07-31 16:47:29 +0800 | [diff] [blame] | 184 | ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL)) |
Ao Xu | 0733c43 | 2018-11-02 17:35:02 +0800 | [diff] [blame] | 185 | |
| 186 | /* |
| 187 | * Format Modifier tokens: |
| 188 | * |
| 189 | * When adding a new token please document the layout with a code comment, |
| 190 | * similar to the fourcc codes above. drm_fourcc.h is considered the |
| 191 | * authoritative source for all of these. |
| 192 | */ |
| 193 | |
| 194 | /* |
| 195 | * Invalid Modifier |
| 196 | * |
| 197 | * This modifier can be used as a sentinel to terminate the format modifiers |
| 198 | * list, or to initialize a variable with an invalid modifier. It might also be |
| 199 | * used to report an error back to userspace for certain APIs. |
| 200 | */ |
| 201 | #define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED) |
| 202 | |
| 203 | /* |
| 204 | * Linear Layout |
| 205 | * |
| 206 | * Just plain linear layout. Note that this is different from no specifying any |
| 207 | * modifier (e.g. not setting DRM_MODE_FB_MODIFIERS in the DRM_ADDFB2 ioctl), |
| 208 | * which tells the driver to also take driver-internal information into account |
| 209 | * and so might actually result in a tiled framebuffer. |
| 210 | */ |
| 211 | #define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0) |
| 212 | |
| 213 | /* Intel framebuffer modifiers */ |
| 214 | |
| 215 | /* |
| 216 | * Intel X-tiling layout |
| 217 | * |
| 218 | * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb) |
| 219 | * in row-major layout. Within the tile bytes are laid out row-major, with |
| 220 | * a platform-dependent stride. On top of that the memory can apply |
| 221 | * platform-depending swizzling of some higher address bits into bit6. |
| 222 | * |
| 223 | * This format is highly platforms specific and not useful for cross-driver |
| 224 | * sharing. It exists since on a given platform it does uniquely identify the |
| 225 | * layout in a simple way for i915-specific userspace. |
| 226 | */ |
| 227 | #define I915_FORMAT_MOD_X_TILED fourcc_mod_code(INTEL, 1) |
| 228 | |
| 229 | /* |
| 230 | * Intel Y-tiling layout |
| 231 | * |
| 232 | * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb) |
| 233 | * in row-major layout. Within the tile bytes are laid out in OWORD (16 bytes) |
| 234 | * chunks column-major, with a platform-dependent height. On top of that the |
| 235 | * memory can apply platform-depending swizzling of some higher address bits |
| 236 | * into bit6. |
| 237 | * |
| 238 | * This format is highly platforms specific and not useful for cross-driver |
| 239 | * sharing. It exists since on a given platform it does uniquely identify the |
| 240 | * layout in a simple way for i915-specific userspace. |
| 241 | */ |
| 242 | #define I915_FORMAT_MOD_Y_TILED fourcc_mod_code(INTEL, 2) |
| 243 | |
| 244 | /* |
| 245 | * Intel Yf-tiling layout |
| 246 | * |
| 247 | * This is a tiled layout using 4Kb tiles in row-major layout. |
| 248 | * Within the tile pixels are laid out in 16 256 byte units / sub-tiles which |
| 249 | * are arranged in four groups (two wide, two high) with column-major layout. |
| 250 | * Each group therefore consits out of four 256 byte units, which are also laid |
| 251 | * out as 2x2 column-major. |
| 252 | * 256 byte units are made out of four 64 byte blocks of pixels, producing |
| 253 | * either a square block or a 2:1 unit. |
| 254 | * 64 byte blocks of pixels contain four pixel rows of 16 bytes, where the width |
| 255 | * in pixel depends on the pixel depth. |
| 256 | */ |
| 257 | #define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3) |
| 258 | |
| 259 | /* |
| 260 | * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks |
| 261 | * |
| 262 | * Macroblocks are laid in a Z-shape, and each pixel data is following the |
| 263 | * standard NV12 style. |
| 264 | * As for NV12, an image is the result of two frame buffers: one for Y, |
| 265 | * one for the interleaved Cb/Cr components (1/2 the height of the Y buffer). |
| 266 | * Alignment requirements are (for each buffer): |
| 267 | * - multiple of 128 pixels for the width |
| 268 | * - multiple of 32 pixels for the height |
| 269 | * |
| 270 | * For more information: see https://linuxtv.org/downloads/v4l-dvb-apis/re32.html |
| 271 | */ |
| 272 | #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) |
| 273 | |
Ao Xu | fdaeff6 | 2020-07-31 16:47:29 +0800 | [diff] [blame] | 274 | /* |
| 275 | * Arm Framebuffer Compression (AFBC) modifiers |
| 276 | * |
| 277 | * AFBC is a proprietary lossless image compression protocol and format. |
| 278 | * It provides fine-grained random access and minimizes the amount of data |
| 279 | * transferred between IP blocks. |
| 280 | * |
| 281 | * AFBC has several features which may be supported and/or used, which are |
| 282 | * represented using bits in the modifier. Not all combinations are valid, |
| 283 | * and different devices or use-cases may support different combinations. |
| 284 | */ |
| 285 | |
| 286 | /* |
| 287 | * The top 4 bits (out of the 56 bits alloted for specifying vendor specific |
| 288 | * modifiers) denote the category for modifiers. Currently we have only two |
| 289 | * categories of modifiers ie AFBC and MISC. We can have a maximum of sixteen |
| 290 | * different categories. |
| 291 | */ |
| 292 | #define DRM_FORMAT_MOD_ARM_CODE(__type, __val) \ |
| 293 | fourcc_mod_code(ARM, ((__u64)(__type) << 52) | ((__val) & 0x000fffffffffffffULL)) |
| 294 | |
| 295 | #define DRM_FORMAT_MOD_ARM_TYPE_AFBC 0x00 |
| 296 | #define DRM_FORMAT_MOD_ARM_TYPE_MISC 0x01 |
| 297 | |
| 298 | #define DRM_FORMAT_MOD_ARM_AFBC(__afbc_mode) \ |
| 299 | DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_AFBC, __afbc_mode) |
| 300 | |
| 301 | /* |
| 302 | * AFBC superblock size |
| 303 | * |
| 304 | * Indicates the superblock size(s) used for the AFBC buffer. The buffer |
| 305 | * size (in pixels) must be aligned to a multiple of the superblock size. |
| 306 | * Four lowest significant bits(LSBs) are reserved for block size. |
| 307 | * |
| 308 | * Where one superblock size is specified, it applies to all planes of the |
| 309 | * buffer (e.g. 16x16, 32x8). When multiple superblock sizes are specified, |
| 310 | * the first applies to the Luma plane and the second applies to the Chroma |
| 311 | * plane(s). e.g. (32x8_64x4 means 32x8 Luma, with 64x4 Chroma). |
| 312 | * Multiple superblock sizes are only valid for multi-plane YCbCr formats. |
| 313 | */ |
| 314 | #define AFBC_FORMAT_MOD_BLOCK_SIZE_MASK 0xf |
| 315 | #define AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 (1ULL) |
| 316 | #define AFBC_FORMAT_MOD_BLOCK_SIZE_32x8 (2ULL) |
| 317 | #define AFBC_FORMAT_MOD_BLOCK_SIZE_64x4 (3ULL) |
| 318 | #define AFBC_FORMAT_MOD_BLOCK_SIZE_32x8_64x4 (4ULL) |
| 319 | |
| 320 | /* |
| 321 | * AFBC lossless colorspace transform |
| 322 | * |
| 323 | * Indicates that the buffer makes use of the AFBC lossless colorspace |
| 324 | * transform. |
| 325 | */ |
| 326 | #define AFBC_FORMAT_MOD_YTR (1ULL << 4) |
| 327 | |
| 328 | /* |
| 329 | * AFBC block-split |
| 330 | * |
| 331 | * Indicates that the payload of each superblock is split. The second |
| 332 | * half of the payload is positioned at a predefined offset from the start |
| 333 | * of the superblock payload. |
| 334 | */ |
| 335 | #define AFBC_FORMAT_MOD_SPLIT (1ULL << 5) |
| 336 | |
| 337 | /* |
| 338 | * AFBC sparse layout |
| 339 | * |
| 340 | * This flag indicates that the payload of each superblock must be stored at a |
| 341 | * predefined position relative to the other superblocks in the same AFBC |
| 342 | * buffer. This order is the same order used by the header buffer. In this mode |
| 343 | * each superblock is given the same amount of space as an uncompressed |
| 344 | * superblock of the particular format would require, rounding up to the next |
| 345 | * multiple of 128 bytes in size. |
| 346 | */ |
| 347 | #define AFBC_FORMAT_MOD_SPARSE (1ULL << 6) |
| 348 | |
| 349 | /* |
| 350 | * AFBC copy-block restrict |
| 351 | * |
| 352 | * Buffers with this flag must obey the copy-block restriction. The restriction |
| 353 | * is such that there are no copy-blocks referring across the border of 8x8 |
| 354 | * blocks. For the subsampled data the 8x8 limitation is also subsampled. |
| 355 | */ |
| 356 | #define AFBC_FORMAT_MOD_CBR (1ULL << 7) |
| 357 | |
| 358 | /* |
| 359 | * AFBC tiled layout |
| 360 | * |
| 361 | * The tiled layout groups superblocks in 8x8 or 4x4 tiles, where all |
| 362 | * superblocks inside a tile are stored together in memory. 8x8 tiles are used |
| 363 | * for pixel formats up to and including 32 bpp while 4x4 tiles are used for |
| 364 | * larger bpp formats. The order between the tiles is scan line. |
| 365 | * When the tiled layout is used, the buffer size (in pixels) must be aligned |
| 366 | * to the tile size. |
| 367 | */ |
| 368 | #define AFBC_FORMAT_MOD_TILED (1ULL << 8) |
| 369 | |
| 370 | /* |
| 371 | * AFBC solid color blocks |
| 372 | * |
| 373 | * Indicates that the buffer makes use of solid-color blocks, whereby bandwidth |
| 374 | * can be reduced if a whole superblock is a single color. |
| 375 | */ |
| 376 | #define AFBC_FORMAT_MOD_SC (1ULL << 9) |
| 377 | |
| 378 | /* |
| 379 | * AFBC double-buffer |
| 380 | * |
| 381 | * Indicates that the buffer is allocated in a layout safe for front-buffer |
| 382 | * rendering. |
| 383 | */ |
| 384 | #define AFBC_FORMAT_MOD_DB (1ULL << 10) |
| 385 | |
| 386 | /* |
| 387 | * AFBC buffer content hints |
| 388 | * |
| 389 | * Indicates that the buffer includes per-superblock content hints. |
| 390 | */ |
| 391 | #define AFBC_FORMAT_MOD_BCH (1ULL << 11) |
| 392 | |
| 393 | /* |
| 394 | * Arm 16x16 Block U-Interleaved modifier |
| 395 | * |
| 396 | * This is used by Arm Mali Utgard and Midgard GPUs. It divides the image |
| 397 | * into 16x16 pixel blocks. Blocks are stored linearly in order, but pixels |
| 398 | * in the block are reordered. |
| 399 | */ |
| 400 | #define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \ |
| 401 | DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 1ULL) |
Ao Xu | 0733c43 | 2018-11-02 17:35:02 +0800 | [diff] [blame] | 402 | |
| 403 | #define DRM_FORMAT_MOD_MESON_AFBC fourcc_mod_code(AMLOGIC, 1) |
| 404 | #define DRM_FORMAT_MOD_MESON_AFBC_WB fourcc_mod_code(AMLOGIC, 2) |
| 405 | |
| 406 | #if defined(__cplusplus) |
| 407 | } |
| 408 | #endif |
| 409 | |
| 410 | #endif /* DRM_FOURCC_H */ |