drm_fourcc.h revision d8807b2f
1e88f27b3Smrg/* 2e88f27b3Smrg * Copyright 2011 Intel Corporation 3e88f27b3Smrg * 4e88f27b3Smrg * Permission is hereby granted, free of charge, to any person obtaining a 5e88f27b3Smrg * copy of this software and associated documentation files (the "Software"), 6e88f27b3Smrg * to deal in the Software without restriction, including without limitation 7e88f27b3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8e88f27b3Smrg * and/or sell copies of the Software, and to permit persons to whom the 9e88f27b3Smrg * Software is furnished to do so, subject to the following conditions: 10e88f27b3Smrg * 11e88f27b3Smrg * The above copyright notice and this permission notice (including the next 12e88f27b3Smrg * paragraph) shall be included in all copies or substantial portions of the 13e88f27b3Smrg * Software. 14e88f27b3Smrg * 15e88f27b3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16e88f27b3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17e88f27b3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18e88f27b3Smrg * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19e88f27b3Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20e88f27b3Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21e88f27b3Smrg * OTHER DEALINGS IN THE SOFTWARE. 22e88f27b3Smrg */ 23e88f27b3Smrg 24e88f27b3Smrg#ifndef DRM_FOURCC_H 25e88f27b3Smrg#define DRM_FOURCC_H 26e88f27b3Smrg 273f012e29Smrg#include "drm.h" 28e88f27b3Smrg 29d8807b2fSmrg#if defined(__cplusplus) 30d8807b2fSmrgextern "C" { 31d8807b2fSmrg#endif 32d8807b2fSmrg 333f012e29Smrg#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \ 343f012e29Smrg ((__u32)(c) << 16) | ((__u32)(d) << 24)) 35e88f27b3Smrg 36e88f27b3Smrg#define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */ 37e88f27b3Smrg 38e88f27b3Smrg/* color index */ 39e88f27b3Smrg#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ 40e88f27b3Smrg 413f012e29Smrg/* 8 bpp Red */ 423f012e29Smrg#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */ 433f012e29Smrg 44d8807b2fSmrg/* 16 bpp Red */ 45d8807b2fSmrg#define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */ 46d8807b2fSmrg 473f012e29Smrg/* 16 bpp RG */ 483f012e29Smrg#define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */ 493f012e29Smrg#define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */ 503f012e29Smrg 51d8807b2fSmrg/* 32 bpp RG */ 52d8807b2fSmrg#define DRM_FORMAT_RG1616 fourcc_code('R', 'G', '3', '2') /* [31:0] R:G 16:16 little endian */ 53d8807b2fSmrg#define DRM_FORMAT_GR1616 fourcc_code('G', 'R', '3', '2') /* [31:0] G:R 16:16 little endian */ 54d8807b2fSmrg 55e88f27b3Smrg/* 8 bpp RGB */ 56e88f27b3Smrg#define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ 57e88f27b3Smrg#define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ 58e88f27b3Smrg 59e88f27b3Smrg/* 16 bpp RGB */ 60e88f27b3Smrg#define DRM_FORMAT_XRGB4444 fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */ 61e88f27b3Smrg#define DRM_FORMAT_XBGR4444 fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */ 62e88f27b3Smrg#define DRM_FORMAT_RGBX4444 fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */ 63e88f27b3Smrg#define DRM_FORMAT_BGRX4444 fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */ 64e88f27b3Smrg 65e88f27b3Smrg#define DRM_FORMAT_ARGB4444 fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */ 66e88f27b3Smrg#define DRM_FORMAT_ABGR4444 fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */ 67e88f27b3Smrg#define DRM_FORMAT_RGBA4444 fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */ 68e88f27b3Smrg#define DRM_FORMAT_BGRA4444 fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */ 69e88f27b3Smrg 70e88f27b3Smrg#define DRM_FORMAT_XRGB1555 fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */ 71e88f27b3Smrg#define DRM_FORMAT_XBGR1555 fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */ 72e88f27b3Smrg#define DRM_FORMAT_RGBX5551 fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */ 73e88f27b3Smrg#define DRM_FORMAT_BGRX5551 fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */ 74e88f27b3Smrg 75e88f27b3Smrg#define DRM_FORMAT_ARGB1555 fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */ 76e88f27b3Smrg#define DRM_FORMAT_ABGR1555 fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */ 77e88f27b3Smrg#define DRM_FORMAT_RGBA5551 fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */ 78e88f27b3Smrg#define DRM_FORMAT_BGRA5551 fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */ 79e88f27b3Smrg 80e88f27b3Smrg#define DRM_FORMAT_RGB565 fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */ 81e88f27b3Smrg#define DRM_FORMAT_BGR565 fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */ 82e88f27b3Smrg 83e88f27b3Smrg/* 24 bpp RGB */ 84e88f27b3Smrg#define DRM_FORMAT_RGB888 fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */ 85e88f27b3Smrg#define DRM_FORMAT_BGR888 fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */ 86e88f27b3Smrg 87e88f27b3Smrg/* 32 bpp RGB */ 88e88f27b3Smrg#define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */ 89e88f27b3Smrg#define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */ 90e88f27b3Smrg#define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */ 91e88f27b3Smrg#define DRM_FORMAT_BGRX8888 fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */ 92e88f27b3Smrg 93e88f27b3Smrg#define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */ 94e88f27b3Smrg#define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */ 95e88f27b3Smrg#define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */ 96e88f27b3Smrg#define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */ 97e88f27b3Smrg 98e88f27b3Smrg#define DRM_FORMAT_XRGB2101010 fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */ 99e88f27b3Smrg#define DRM_FORMAT_XBGR2101010 fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */ 100e88f27b3Smrg#define DRM_FORMAT_RGBX1010102 fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */ 101e88f27b3Smrg#define DRM_FORMAT_BGRX1010102 fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */ 102e88f27b3Smrg 103e88f27b3Smrg#define DRM_FORMAT_ARGB2101010 fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */ 104e88f27b3Smrg#define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */ 105e88f27b3Smrg#define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */ 106e88f27b3Smrg#define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */ 107e88f27b3Smrg 108e88f27b3Smrg/* packed YCbCr */ 109e88f27b3Smrg#define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */ 110e88f27b3Smrg#define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */ 111e88f27b3Smrg#define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */ 112e88f27b3Smrg#define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */ 113e88f27b3Smrg 114e88f27b3Smrg#define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ 115e88f27b3Smrg 116d8807b2fSmrg/* 117d8807b2fSmrg * 2 plane RGB + A 118d8807b2fSmrg * index 0 = RGB plane, same format as the corresponding non _A8 format has 119d8807b2fSmrg * index 1 = A plane, [7:0] A 120d8807b2fSmrg */ 121d8807b2fSmrg#define DRM_FORMAT_XRGB8888_A8 fourcc_code('X', 'R', 'A', '8') 122d8807b2fSmrg#define DRM_FORMAT_XBGR8888_A8 fourcc_code('X', 'B', 'A', '8') 123d8807b2fSmrg#define DRM_FORMAT_RGBX8888_A8 fourcc_code('R', 'X', 'A', '8') 124d8807b2fSmrg#define DRM_FORMAT_BGRX8888_A8 fourcc_code('B', 'X', 'A', '8') 125d8807b2fSmrg#define DRM_FORMAT_RGB888_A8 fourcc_code('R', '8', 'A', '8') 126d8807b2fSmrg#define DRM_FORMAT_BGR888_A8 fourcc_code('B', '8', 'A', '8') 127d8807b2fSmrg#define DRM_FORMAT_RGB565_A8 fourcc_code('R', '5', 'A', '8') 128d8807b2fSmrg#define DRM_FORMAT_BGR565_A8 fourcc_code('B', '5', 'A', '8') 129d8807b2fSmrg 130e88f27b3Smrg/* 131e88f27b3Smrg * 2 plane YCbCr 132e88f27b3Smrg * index 0 = Y plane, [7:0] Y 133e88f27b3Smrg * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian 134e88f27b3Smrg * or 135e88f27b3Smrg * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian 136e88f27b3Smrg */ 137e88f27b3Smrg#define DRM_FORMAT_NV12 fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */ 138e88f27b3Smrg#define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */ 139e88f27b3Smrg#define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ 140e88f27b3Smrg#define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ 1413f012e29Smrg#define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */ 1423f012e29Smrg#define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */ 143e88f27b3Smrg 144e88f27b3Smrg/* 145e88f27b3Smrg * 3 plane YCbCr 146e88f27b3Smrg * index 0: Y plane, [7:0] Y 147e88f27b3Smrg * index 1: Cb plane, [7:0] Cb 148e88f27b3Smrg * index 2: Cr plane, [7:0] Cr 149e88f27b3Smrg * or 150e88f27b3Smrg * index 1: Cr plane, [7:0] Cr 151e88f27b3Smrg * index 2: Cb plane, [7:0] Cb 152e88f27b3Smrg */ 153e88f27b3Smrg#define DRM_FORMAT_YUV410 fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */ 154e88f27b3Smrg#define DRM_FORMAT_YVU410 fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */ 155e88f27b3Smrg#define DRM_FORMAT_YUV411 fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */ 156e88f27b3Smrg#define DRM_FORMAT_YVU411 fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */ 157e88f27b3Smrg#define DRM_FORMAT_YUV420 fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */ 158e88f27b3Smrg#define DRM_FORMAT_YVU420 fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */ 159e88f27b3Smrg#define DRM_FORMAT_YUV422 fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */ 160e88f27b3Smrg#define DRM_FORMAT_YVU422 fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */ 161e88f27b3Smrg#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ 162e88f27b3Smrg#define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ 163e88f27b3Smrg 1643f012e29Smrg 1653f012e29Smrg/* 1663f012e29Smrg * Format Modifiers: 1673f012e29Smrg * 1683f012e29Smrg * Format modifiers describe, typically, a re-ordering or modification 1693f012e29Smrg * of the data in a plane of an FB. This can be used to express tiled/ 1703f012e29Smrg * swizzled formats, or compression, or a combination of the two. 1713f012e29Smrg * 1723f012e29Smrg * The upper 8 bits of the format modifier are a vendor-id as assigned 1733f012e29Smrg * below. The lower 56 bits are assigned as vendor sees fit. 1743f012e29Smrg */ 1753f012e29Smrg 1763f012e29Smrg/* Vendor Ids: */ 1773f012e29Smrg#define DRM_FORMAT_MOD_NONE 0 178d8807b2fSmrg#define DRM_FORMAT_MOD_VENDOR_NONE 0 1793f012e29Smrg#define DRM_FORMAT_MOD_VENDOR_INTEL 0x01 1803f012e29Smrg#define DRM_FORMAT_MOD_VENDOR_AMD 0x02 1813f012e29Smrg#define DRM_FORMAT_MOD_VENDOR_NV 0x03 1823f012e29Smrg#define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 1833f012e29Smrg#define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 184d8807b2fSmrg#define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06 185d8807b2fSmrg#define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07 1863f012e29Smrg/* add more to the end as needed */ 1873f012e29Smrg 188d8807b2fSmrg#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) 189d8807b2fSmrg 1903f012e29Smrg#define fourcc_mod_code(vendor, val) \ 1913f012e29Smrg ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | (val & 0x00ffffffffffffffULL)) 1923f012e29Smrg 1933f012e29Smrg/* 1943f012e29Smrg * Format Modifier tokens: 1953f012e29Smrg * 1963f012e29Smrg * When adding a new token please document the layout with a code comment, 1973f012e29Smrg * similar to the fourcc codes above. drm_fourcc.h is considered the 1983f012e29Smrg * authoritative source for all of these. 1993f012e29Smrg */ 2003f012e29Smrg 201d8807b2fSmrg/* 202d8807b2fSmrg * Invalid Modifier 203d8807b2fSmrg * 204d8807b2fSmrg * This modifier can be used as a sentinel to terminate the format modifiers 205d8807b2fSmrg * list, or to initialize a variable with an invalid modifier. It might also be 206d8807b2fSmrg * used to report an error back to userspace for certain APIs. 207d8807b2fSmrg */ 208d8807b2fSmrg#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED) 209d8807b2fSmrg 210d8807b2fSmrg/* 211d8807b2fSmrg * Linear Layout 212d8807b2fSmrg * 213d8807b2fSmrg * Just plain linear layout. Note that this is different from no specifying any 214d8807b2fSmrg * modifier (e.g. not setting DRM_MODE_FB_MODIFIERS in the DRM_ADDFB2 ioctl), 215d8807b2fSmrg * which tells the driver to also take driver-internal information into account 216d8807b2fSmrg * and so might actually result in a tiled framebuffer. 217d8807b2fSmrg */ 218d8807b2fSmrg#define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0) 219d8807b2fSmrg 2203f012e29Smrg/* Intel framebuffer modifiers */ 2213f012e29Smrg 2223f012e29Smrg/* 2233f012e29Smrg * Intel X-tiling layout 2243f012e29Smrg * 2253f012e29Smrg * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb) 2263f012e29Smrg * in row-major layout. Within the tile bytes are laid out row-major, with 2273f012e29Smrg * a platform-dependent stride. On top of that the memory can apply 2283f012e29Smrg * platform-depending swizzling of some higher address bits into bit6. 2293f012e29Smrg * 2303f012e29Smrg * This format is highly platforms specific and not useful for cross-driver 2313f012e29Smrg * sharing. It exists since on a given platform it does uniquely identify the 2323f012e29Smrg * layout in a simple way for i915-specific userspace. 2333f012e29Smrg */ 2343f012e29Smrg#define I915_FORMAT_MOD_X_TILED fourcc_mod_code(INTEL, 1) 2353f012e29Smrg 2363f012e29Smrg/* 2373f012e29Smrg * Intel Y-tiling layout 2383f012e29Smrg * 2393f012e29Smrg * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb) 2403f012e29Smrg * in row-major layout. Within the tile bytes are laid out in OWORD (16 bytes) 2413f012e29Smrg * chunks column-major, with a platform-dependent height. On top of that the 2423f012e29Smrg * memory can apply platform-depending swizzling of some higher address bits 2433f012e29Smrg * into bit6. 2443f012e29Smrg * 2453f012e29Smrg * This format is highly platforms specific and not useful for cross-driver 2463f012e29Smrg * sharing. It exists since on a given platform it does uniquely identify the 2473f012e29Smrg * layout in a simple way for i915-specific userspace. 2483f012e29Smrg */ 2493f012e29Smrg#define I915_FORMAT_MOD_Y_TILED fourcc_mod_code(INTEL, 2) 2503f012e29Smrg 2513f012e29Smrg/* 2523f012e29Smrg * Intel Yf-tiling layout 2533f012e29Smrg * 2543f012e29Smrg * This is a tiled layout using 4Kb tiles in row-major layout. 2553f012e29Smrg * Within the tile pixels are laid out in 16 256 byte units / sub-tiles which 2563f012e29Smrg * are arranged in four groups (two wide, two high) with column-major layout. 2573f012e29Smrg * Each group therefore consits out of four 256 byte units, which are also laid 2583f012e29Smrg * out as 2x2 column-major. 2593f012e29Smrg * 256 byte units are made out of four 64 byte blocks of pixels, producing 2603f012e29Smrg * either a square block or a 2:1 unit. 2613f012e29Smrg * 64 byte blocks of pixels contain four pixel rows of 16 bytes, where the width 2623f012e29Smrg * in pixel depends on the pixel depth. 2633f012e29Smrg */ 2643f012e29Smrg#define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3) 2653f012e29Smrg 266d8807b2fSmrg/* 267d8807b2fSmrg * Intel color control surface (CCS) for render compression 268d8807b2fSmrg * 269d8807b2fSmrg * The framebuffer format must be one of the 8:8:8:8 RGB formats. 270d8807b2fSmrg * The main surface will be plane index 0 and must be Y/Yf-tiled, 271d8807b2fSmrg * the CCS will be plane index 1. 272d8807b2fSmrg * 273d8807b2fSmrg * Each CCS tile matches a 1024x512 pixel area of the main surface. 274d8807b2fSmrg * To match certain aspects of the 3D hardware the CCS is 275d8807b2fSmrg * considered to be made up of normal 128Bx32 Y tiles, Thus 276d8807b2fSmrg * the CCS pitch must be specified in multiples of 128 bytes. 277d8807b2fSmrg * 278d8807b2fSmrg * In reality the CCS tile appears to be a 64Bx64 Y tile, composed 279d8807b2fSmrg * of QWORD (8 bytes) chunks instead of OWORD (16 bytes) chunks. 280d8807b2fSmrg * But that fact is not relevant unless the memory is accessed 281d8807b2fSmrg * directly. 282d8807b2fSmrg */ 283d8807b2fSmrg#define I915_FORMAT_MOD_Y_TILED_CCS fourcc_mod_code(INTEL, 4) 284d8807b2fSmrg#define I915_FORMAT_MOD_Yf_TILED_CCS fourcc_mod_code(INTEL, 5) 285d8807b2fSmrg 2863f012e29Smrg/* 2873f012e29Smrg * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks 2883f012e29Smrg * 2893f012e29Smrg * Macroblocks are laid in a Z-shape, and each pixel data is following the 2903f012e29Smrg * standard NV12 style. 2913f012e29Smrg * As for NV12, an image is the result of two frame buffers: one for Y, 2923f012e29Smrg * one for the interleaved Cb/Cr components (1/2 the height of the Y buffer). 2933f012e29Smrg * Alignment requirements are (for each buffer): 2943f012e29Smrg * - multiple of 128 pixels for the width 2953f012e29Smrg * - multiple of 32 pixels for the height 2963f012e29Smrg * 2973f012e29Smrg * For more information: see https://linuxtv.org/downloads/v4l-dvb-apis/re32.html 2983f012e29Smrg */ 2993f012e29Smrg#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) 3003f012e29Smrg 301d8807b2fSmrg/* Vivante framebuffer modifiers */ 302d8807b2fSmrg 303d8807b2fSmrg/* 304d8807b2fSmrg * Vivante 4x4 tiling layout 305d8807b2fSmrg * 306d8807b2fSmrg * This is a simple tiled layout using tiles of 4x4 pixels in a row-major 307d8807b2fSmrg * layout. 308d8807b2fSmrg */ 309d8807b2fSmrg#define DRM_FORMAT_MOD_VIVANTE_TILED fourcc_mod_code(VIVANTE, 1) 310d8807b2fSmrg 311d8807b2fSmrg/* 312d8807b2fSmrg * Vivante 64x64 super-tiling layout 313d8807b2fSmrg * 314d8807b2fSmrg * This is a tiled layout using 64x64 pixel super-tiles, where each super-tile 315d8807b2fSmrg * contains 8x4 groups of 2x4 tiles of 4x4 pixels (like above) each, all in row- 316d8807b2fSmrg * major layout. 317d8807b2fSmrg * 318d8807b2fSmrg * For more information: see 319d8807b2fSmrg * https://github.com/etnaviv/etna_viv/blob/master/doc/hardware.md#texture-tiling 320d8807b2fSmrg */ 321d8807b2fSmrg#define DRM_FORMAT_MOD_VIVANTE_SUPER_TILED fourcc_mod_code(VIVANTE, 2) 322d8807b2fSmrg 323d8807b2fSmrg/* 324d8807b2fSmrg * Vivante 4x4 tiling layout for dual-pipe 325d8807b2fSmrg * 326d8807b2fSmrg * Same as the 4x4 tiling layout, except every second 4x4 pixel tile starts at a 327d8807b2fSmrg * different base address. Offsets from the base addresses are therefore halved 328d8807b2fSmrg * compared to the non-split tiled layout. 329d8807b2fSmrg */ 330d8807b2fSmrg#define DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED fourcc_mod_code(VIVANTE, 3) 331d8807b2fSmrg 332d8807b2fSmrg/* 333d8807b2fSmrg * Vivante 64x64 super-tiling layout for dual-pipe 334d8807b2fSmrg * 335d8807b2fSmrg * Same as the 64x64 super-tiling layout, except every second 4x4 pixel tile 336d8807b2fSmrg * starts at a different base address. Offsets from the base addresses are 337d8807b2fSmrg * therefore halved compared to the non-split super-tiled layout. 338d8807b2fSmrg */ 339d8807b2fSmrg#define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4) 340d8807b2fSmrg 341d8807b2fSmrg/* NVIDIA Tegra frame buffer modifiers */ 342d8807b2fSmrg 343d8807b2fSmrg/* 344d8807b2fSmrg * Some modifiers take parameters, for example the number of vertical GOBs in 345d8807b2fSmrg * a block. Reserve the lower 32 bits for parameters 346d8807b2fSmrg */ 347d8807b2fSmrg#define __fourcc_mod_tegra_mode_shift 32 348d8807b2fSmrg#define fourcc_mod_tegra_code(val, params) \ 349d8807b2fSmrg fourcc_mod_code(NV, ((((__u64)val) << __fourcc_mod_tegra_mode_shift) | params)) 350d8807b2fSmrg#define fourcc_mod_tegra_mod(m) \ 351d8807b2fSmrg (m & ~((1ULL << __fourcc_mod_tegra_mode_shift) - 1)) 352d8807b2fSmrg#define fourcc_mod_tegra_param(m) \ 353d8807b2fSmrg (m & ((1ULL << __fourcc_mod_tegra_mode_shift) - 1)) 354d8807b2fSmrg 355d8807b2fSmrg/* 356d8807b2fSmrg * Tegra Tiled Layout, used by Tegra 2, 3 and 4. 357d8807b2fSmrg * 358d8807b2fSmrg * Pixels are arranged in simple tiles of 16 x 16 bytes. 359d8807b2fSmrg */ 360d8807b2fSmrg#define NV_FORMAT_MOD_TEGRA_TILED fourcc_mod_tegra_code(1, 0) 361d8807b2fSmrg 362d8807b2fSmrg/* 363d8807b2fSmrg * Tegra 16Bx2 Block Linear layout, used by TK1/TX1 364d8807b2fSmrg * 365d8807b2fSmrg * Pixels are arranged in 64x8 Groups Of Bytes (GOBs). GOBs are then stacked 366d8807b2fSmrg * vertically by a power of 2 (1 to 32 GOBs) to form a block. 367d8807b2fSmrg * 368d8807b2fSmrg * Within a GOB, data is ordered as 16B x 2 lines sectors laid in Z-shape. 369d8807b2fSmrg * 370d8807b2fSmrg * Parameter 'v' is the log2 encoding of the number of GOBs stacked vertically. 371d8807b2fSmrg * Valid values are: 372d8807b2fSmrg * 373d8807b2fSmrg * 0 == ONE_GOB 374d8807b2fSmrg * 1 == TWO_GOBS 375d8807b2fSmrg * 2 == FOUR_GOBS 376d8807b2fSmrg * 3 == EIGHT_GOBS 377d8807b2fSmrg * 4 == SIXTEEN_GOBS 378d8807b2fSmrg * 5 == THIRTYTWO_GOBS 379d8807b2fSmrg * 380d8807b2fSmrg * Chapter 20 "Pixel Memory Formats" of the Tegra X1 TRM describes this format 381d8807b2fSmrg * in full detail. 382d8807b2fSmrg */ 383d8807b2fSmrg#define NV_FORMAT_MOD_TEGRA_16BX2_BLOCK(v) fourcc_mod_tegra_code(2, v) 384d8807b2fSmrg 385d8807b2fSmrg/* 386d8807b2fSmrg * Broadcom VC4 "T" format 387d8807b2fSmrg * 388d8807b2fSmrg * This is the primary layout that the V3D GPU can texture from (it 389d8807b2fSmrg * can't do linear). The T format has: 390d8807b2fSmrg * 391d8807b2fSmrg * - 64b utiles of pixels in a raster-order grid according to cpp. It's 4x4 392d8807b2fSmrg * pixels at 32 bit depth. 393d8807b2fSmrg * 394d8807b2fSmrg * - 1k subtiles made of a 4x4 raster-order grid of 64b utiles (so usually 395d8807b2fSmrg * 16x16 pixels). 396d8807b2fSmrg * 397d8807b2fSmrg * - 4k tiles made of a 2x2 grid of 1k subtiles (so usually 32x32 pixels). On 398d8807b2fSmrg * even 4k tile rows, they're arranged as (BL, TL, TR, BR), and on odd rows 399d8807b2fSmrg * they're (TR, BR, BL, TL), where bottom left is start of memory. 400d8807b2fSmrg * 401d8807b2fSmrg * - an image made of 4k tiles in rows either left-to-right (even rows of 4k 402d8807b2fSmrg * tiles) or right-to-left (odd rows of 4k tiles). 403d8807b2fSmrg */ 404d8807b2fSmrg#define DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED fourcc_mod_code(BROADCOM, 1) 405d8807b2fSmrg 406d8807b2fSmrg#if defined(__cplusplus) 407d8807b2fSmrg} 408d8807b2fSmrg#endif 409d8807b2fSmrg 410e88f27b3Smrg#endif /* DRM_FOURCC_H */ 411