18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2011 Intel Corporation 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation 78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next 128c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 138c2ecf20Sopenharmony_ci * Software. 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 168c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 178c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 188c2ecf20Sopenharmony_ci * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 198c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 208c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 218c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 228c2ecf20Sopenharmony_ci */ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#ifndef DRM_FOURCC_H 258c2ecf20Sopenharmony_ci#define DRM_FOURCC_H 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#include "drm.h" 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#if defined(__cplusplus) 308c2ecf20Sopenharmony_ciextern "C" { 318c2ecf20Sopenharmony_ci#endif 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/** 348c2ecf20Sopenharmony_ci * DOC: overview 358c2ecf20Sopenharmony_ci * 368c2ecf20Sopenharmony_ci * In the DRM subsystem, framebuffer pixel formats are described using the 378c2ecf20Sopenharmony_ci * fourcc codes defined in `include/uapi/drm/drm_fourcc.h`. In addition to the 388c2ecf20Sopenharmony_ci * fourcc code, a Format Modifier may optionally be provided, in order to 398c2ecf20Sopenharmony_ci * further describe the buffer's format - for example tiling or compression. 408c2ecf20Sopenharmony_ci * 418c2ecf20Sopenharmony_ci * Format Modifiers 428c2ecf20Sopenharmony_ci * ---------------- 438c2ecf20Sopenharmony_ci * 448c2ecf20Sopenharmony_ci * Format modifiers are used in conjunction with a fourcc code, forming a 458c2ecf20Sopenharmony_ci * unique fourcc:modifier pair. This format:modifier pair must fully define the 468c2ecf20Sopenharmony_ci * format and data layout of the buffer, and should be the only way to describe 478c2ecf20Sopenharmony_ci * that particular buffer. 488c2ecf20Sopenharmony_ci * 498c2ecf20Sopenharmony_ci * Having multiple fourcc:modifier pairs which describe the same layout should 508c2ecf20Sopenharmony_ci * be avoided, as such aliases run the risk of different drivers exposing 518c2ecf20Sopenharmony_ci * different names for the same data format, forcing userspace to understand 528c2ecf20Sopenharmony_ci * that they are aliases. 538c2ecf20Sopenharmony_ci * 548c2ecf20Sopenharmony_ci * Format modifiers may change any property of the buffer, including the number 558c2ecf20Sopenharmony_ci * of planes and/or the required allocation size. Format modifiers are 568c2ecf20Sopenharmony_ci * vendor-namespaced, and as such the relationship between a fourcc code and a 578c2ecf20Sopenharmony_ci * modifier is specific to the modifer being used. For example, some modifiers 588c2ecf20Sopenharmony_ci * may preserve meaning - such as number of planes - from the fourcc code, 598c2ecf20Sopenharmony_ci * whereas others may not. 608c2ecf20Sopenharmony_ci * 618c2ecf20Sopenharmony_ci * Vendors should document their modifier usage in as much detail as 628c2ecf20Sopenharmony_ci * possible, to ensure maximum compatibility across devices, drivers and 638c2ecf20Sopenharmony_ci * applications. 648c2ecf20Sopenharmony_ci * 658c2ecf20Sopenharmony_ci * The authoritative list of format modifier codes is found in 668c2ecf20Sopenharmony_ci * `include/uapi/drm/drm_fourcc.h` 678c2ecf20Sopenharmony_ci */ 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \ 708c2ecf20Sopenharmony_ci ((__u32)(c) << 16) | ((__u32)(d) << 24)) 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci#define DRM_FORMAT_BIG_ENDIAN (1U<<31) /* format is big endian instead of little endian */ 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci/* Reserve 0 for the invalid format specifier */ 758c2ecf20Sopenharmony_ci#define DRM_FORMAT_INVALID 0 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci/* color index */ 788c2ecf20Sopenharmony_ci#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci/* 8 bpp Red */ 818c2ecf20Sopenharmony_ci#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */ 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci/* 16 bpp Red */ 848c2ecf20Sopenharmony_ci#define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */ 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci/* 16 bpp RG */ 878c2ecf20Sopenharmony_ci#define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */ 888c2ecf20Sopenharmony_ci#define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */ 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci/* 32 bpp RG */ 918c2ecf20Sopenharmony_ci#define DRM_FORMAT_RG1616 fourcc_code('R', 'G', '3', '2') /* [31:0] R:G 16:16 little endian */ 928c2ecf20Sopenharmony_ci#define DRM_FORMAT_GR1616 fourcc_code('G', 'R', '3', '2') /* [31:0] G:R 16:16 little endian */ 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci/* 8 bpp RGB */ 958c2ecf20Sopenharmony_ci#define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ 968c2ecf20Sopenharmony_ci#define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci/* 16 bpp RGB */ 998c2ecf20Sopenharmony_ci#define DRM_FORMAT_XRGB4444 fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */ 1008c2ecf20Sopenharmony_ci#define DRM_FORMAT_XBGR4444 fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */ 1018c2ecf20Sopenharmony_ci#define DRM_FORMAT_RGBX4444 fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */ 1028c2ecf20Sopenharmony_ci#define DRM_FORMAT_BGRX4444 fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */ 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#define DRM_FORMAT_ARGB4444 fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */ 1058c2ecf20Sopenharmony_ci#define DRM_FORMAT_ABGR4444 fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */ 1068c2ecf20Sopenharmony_ci#define DRM_FORMAT_RGBA4444 fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */ 1078c2ecf20Sopenharmony_ci#define DRM_FORMAT_BGRA4444 fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */ 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci#define DRM_FORMAT_XRGB1555 fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */ 1108c2ecf20Sopenharmony_ci#define DRM_FORMAT_XBGR1555 fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */ 1118c2ecf20Sopenharmony_ci#define DRM_FORMAT_RGBX5551 fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */ 1128c2ecf20Sopenharmony_ci#define DRM_FORMAT_BGRX5551 fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */ 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci#define DRM_FORMAT_ARGB1555 fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */ 1158c2ecf20Sopenharmony_ci#define DRM_FORMAT_ABGR1555 fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */ 1168c2ecf20Sopenharmony_ci#define DRM_FORMAT_RGBA5551 fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */ 1178c2ecf20Sopenharmony_ci#define DRM_FORMAT_BGRA5551 fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */ 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#define DRM_FORMAT_RGB565 fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */ 1208c2ecf20Sopenharmony_ci#define DRM_FORMAT_BGR565 fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */ 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci/* 24 bpp RGB */ 1238c2ecf20Sopenharmony_ci#define DRM_FORMAT_RGB888 fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */ 1248c2ecf20Sopenharmony_ci#define DRM_FORMAT_BGR888 fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */ 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci/* 32 bpp RGB */ 1278c2ecf20Sopenharmony_ci#define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */ 1288c2ecf20Sopenharmony_ci#define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */ 1298c2ecf20Sopenharmony_ci#define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */ 1308c2ecf20Sopenharmony_ci#define DRM_FORMAT_BGRX8888 fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */ 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci#define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */ 1338c2ecf20Sopenharmony_ci#define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */ 1348c2ecf20Sopenharmony_ci#define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */ 1358c2ecf20Sopenharmony_ci#define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */ 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci#define DRM_FORMAT_XRGB2101010 fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */ 1388c2ecf20Sopenharmony_ci#define DRM_FORMAT_XBGR2101010 fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */ 1398c2ecf20Sopenharmony_ci#define DRM_FORMAT_RGBX1010102 fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */ 1408c2ecf20Sopenharmony_ci#define DRM_FORMAT_BGRX1010102 fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */ 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci#define DRM_FORMAT_ARGB2101010 fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */ 1438c2ecf20Sopenharmony_ci#define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */ 1448c2ecf20Sopenharmony_ci#define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */ 1458c2ecf20Sopenharmony_ci#define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */ 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci/* 1488c2ecf20Sopenharmony_ci * Floating point 64bpp RGB 1498c2ecf20Sopenharmony_ci * IEEE 754-2008 binary16 half-precision float 1508c2ecf20Sopenharmony_ci * [15:0] sign:exponent:mantissa 1:5:10 1518c2ecf20Sopenharmony_ci */ 1528c2ecf20Sopenharmony_ci#define DRM_FORMAT_XRGB16161616F fourcc_code('X', 'R', '4', 'H') /* [63:0] x:R:G:B 16:16:16:16 little endian */ 1538c2ecf20Sopenharmony_ci#define DRM_FORMAT_XBGR16161616F fourcc_code('X', 'B', '4', 'H') /* [63:0] x:B:G:R 16:16:16:16 little endian */ 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci#define DRM_FORMAT_ARGB16161616F fourcc_code('A', 'R', '4', 'H') /* [63:0] A:R:G:B 16:16:16:16 little endian */ 1568c2ecf20Sopenharmony_ci#define DRM_FORMAT_ABGR16161616F fourcc_code('A', 'B', '4', 'H') /* [63:0] A:B:G:R 16:16:16:16 little endian */ 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci/* packed YCbCr */ 1598c2ecf20Sopenharmony_ci#define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */ 1608c2ecf20Sopenharmony_ci#define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */ 1618c2ecf20Sopenharmony_ci#define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */ 1628c2ecf20Sopenharmony_ci#define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */ 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci#define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ 1658c2ecf20Sopenharmony_ci#define DRM_FORMAT_XYUV8888 fourcc_code('X', 'Y', 'U', 'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian */ 1668c2ecf20Sopenharmony_ci#define DRM_FORMAT_VUY888 fourcc_code('V', 'U', '2', '4') /* [23:0] Cr:Cb:Y 8:8:8 little endian */ 1678c2ecf20Sopenharmony_ci#define DRM_FORMAT_VUY101010 fourcc_code('V', 'U', '3', '0') /* Y followed by U then V, 10:10:10. Non-linear modifier only */ 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci/* 1708c2ecf20Sopenharmony_ci * packed Y2xx indicate for each component, xx valid data occupy msb 1718c2ecf20Sopenharmony_ci * 16-xx padding occupy lsb 1728c2ecf20Sopenharmony_ci */ 1738c2ecf20Sopenharmony_ci#define DRM_FORMAT_Y210 fourcc_code('Y', '2', '1', '0') /* [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 10:6:10:6:10:6:10:6 little endian per 2 Y pixels */ 1748c2ecf20Sopenharmony_ci#define DRM_FORMAT_Y212 fourcc_code('Y', '2', '1', '2') /* [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 12:4:12:4:12:4:12:4 little endian per 2 Y pixels */ 1758c2ecf20Sopenharmony_ci#define DRM_FORMAT_Y216 fourcc_code('Y', '2', '1', '6') /* [63:0] Cr0:Y1:Cb0:Y0 16:16:16:16 little endian per 2 Y pixels */ 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci/* 1788c2ecf20Sopenharmony_ci * packed Y4xx indicate for each component, xx valid data occupy msb 1798c2ecf20Sopenharmony_ci * 16-xx padding occupy lsb except Y410 1808c2ecf20Sopenharmony_ci */ 1818c2ecf20Sopenharmony_ci#define DRM_FORMAT_Y410 fourcc_code('Y', '4', '1', '0') /* [31:0] A:Cr:Y:Cb 2:10:10:10 little endian */ 1828c2ecf20Sopenharmony_ci#define DRM_FORMAT_Y412 fourcc_code('Y', '4', '1', '2') /* [63:0] A:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian */ 1838c2ecf20Sopenharmony_ci#define DRM_FORMAT_Y416 fourcc_code('Y', '4', '1', '6') /* [63:0] A:Cr:Y:Cb 16:16:16:16 little endian */ 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci#define DRM_FORMAT_XVYU2101010 fourcc_code('X', 'V', '3', '0') /* [31:0] X:Cr:Y:Cb 2:10:10:10 little endian */ 1868c2ecf20Sopenharmony_ci#define DRM_FORMAT_XVYU12_16161616 fourcc_code('X', 'V', '3', '6') /* [63:0] X:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian */ 1878c2ecf20Sopenharmony_ci#define DRM_FORMAT_XVYU16161616 fourcc_code('X', 'V', '4', '8') /* [63:0] X:Cr:Y:Cb 16:16:16:16 little endian */ 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci/* 1908c2ecf20Sopenharmony_ci * packed YCbCr420 2x2 tiled formats 1918c2ecf20Sopenharmony_ci * first 64 bits will contain Y,Cb,Cr components for a 2x2 tile 1928c2ecf20Sopenharmony_ci */ 1938c2ecf20Sopenharmony_ci/* [63:0] A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian */ 1948c2ecf20Sopenharmony_ci#define DRM_FORMAT_Y0L0 fourcc_code('Y', '0', 'L', '0') 1958c2ecf20Sopenharmony_ci/* [63:0] X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian */ 1968c2ecf20Sopenharmony_ci#define DRM_FORMAT_X0L0 fourcc_code('X', '0', 'L', '0') 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ci/* [63:0] A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian */ 1998c2ecf20Sopenharmony_ci#define DRM_FORMAT_Y0L2 fourcc_code('Y', '0', 'L', '2') 2008c2ecf20Sopenharmony_ci/* [63:0] X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian */ 2018c2ecf20Sopenharmony_ci#define DRM_FORMAT_X0L2 fourcc_code('X', '0', 'L', '2') 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci/* 2048c2ecf20Sopenharmony_ci * 1-plane YUV 4:2:0 2058c2ecf20Sopenharmony_ci * In these formats, the component ordering is specified (Y, followed by U 2068c2ecf20Sopenharmony_ci * then V), but the exact Linear layout is undefined. 2078c2ecf20Sopenharmony_ci * These formats can only be used with a non-Linear modifier. 2088c2ecf20Sopenharmony_ci */ 2098c2ecf20Sopenharmony_ci#define DRM_FORMAT_YUV420_8BIT fourcc_code('Y', 'U', '0', '8') 2108c2ecf20Sopenharmony_ci#define DRM_FORMAT_YUV420_10BIT fourcc_code('Y', 'U', '1', '0') 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ci/* 2138c2ecf20Sopenharmony_ci * 2 plane RGB + A 2148c2ecf20Sopenharmony_ci * index 0 = RGB plane, same format as the corresponding non _A8 format has 2158c2ecf20Sopenharmony_ci * index 1 = A plane, [7:0] A 2168c2ecf20Sopenharmony_ci */ 2178c2ecf20Sopenharmony_ci#define DRM_FORMAT_XRGB8888_A8 fourcc_code('X', 'R', 'A', '8') 2188c2ecf20Sopenharmony_ci#define DRM_FORMAT_XBGR8888_A8 fourcc_code('X', 'B', 'A', '8') 2198c2ecf20Sopenharmony_ci#define DRM_FORMAT_RGBX8888_A8 fourcc_code('R', 'X', 'A', '8') 2208c2ecf20Sopenharmony_ci#define DRM_FORMAT_BGRX8888_A8 fourcc_code('B', 'X', 'A', '8') 2218c2ecf20Sopenharmony_ci#define DRM_FORMAT_RGB888_A8 fourcc_code('R', '8', 'A', '8') 2228c2ecf20Sopenharmony_ci#define DRM_FORMAT_BGR888_A8 fourcc_code('B', '8', 'A', '8') 2238c2ecf20Sopenharmony_ci#define DRM_FORMAT_RGB565_A8 fourcc_code('R', '5', 'A', '8') 2248c2ecf20Sopenharmony_ci#define DRM_FORMAT_BGR565_A8 fourcc_code('B', '5', 'A', '8') 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci/* 2278c2ecf20Sopenharmony_ci * 2 plane YCbCr 2288c2ecf20Sopenharmony_ci * index 0 = Y plane, [7:0] Y 2298c2ecf20Sopenharmony_ci * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian 2308c2ecf20Sopenharmony_ci * or 2318c2ecf20Sopenharmony_ci * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian 2328c2ecf20Sopenharmony_ci */ 2338c2ecf20Sopenharmony_ci#define DRM_FORMAT_NV12 fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */ 2348c2ecf20Sopenharmony_ci#define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */ 2358c2ecf20Sopenharmony_ci#define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ 2368c2ecf20Sopenharmony_ci#define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ 2378c2ecf20Sopenharmony_ci#define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */ 2388c2ecf20Sopenharmony_ci#define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */ 2398c2ecf20Sopenharmony_ci/* 2408c2ecf20Sopenharmony_ci * 2 plane YCbCr 2418c2ecf20Sopenharmony_ci * index 0 = Y plane, [39:0] Y3:Y2:Y1:Y0 little endian 2428c2ecf20Sopenharmony_ci * index 1 = Cr:Cb plane, [39:0] Cr1:Cb1:Cr0:Cb0 little endian 2438c2ecf20Sopenharmony_ci */ 2448c2ecf20Sopenharmony_ci#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') /* 2x2 subsampled Cr:Cb plane */ 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_ci/* 2478c2ecf20Sopenharmony_ci * 2 plane YCbCr MSB aligned 2488c2ecf20Sopenharmony_ci * index 0 = Y plane, [15:0] Y:x [10:6] little endian 2498c2ecf20Sopenharmony_ci * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian 2508c2ecf20Sopenharmony_ci */ 2518c2ecf20Sopenharmony_ci#define DRM_FORMAT_P210 fourcc_code('P', '2', '1', '0') /* 2x1 subsampled Cr:Cb plane, 10 bit per channel */ 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci/* 2548c2ecf20Sopenharmony_ci * 2 plane YCbCr MSB aligned 2558c2ecf20Sopenharmony_ci * index 0 = Y plane, [15:0] Y:x [10:6] little endian 2568c2ecf20Sopenharmony_ci * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian 2578c2ecf20Sopenharmony_ci */ 2588c2ecf20Sopenharmony_ci#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cr:Cb plane 10 bits per channel */ 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ci/* 2618c2ecf20Sopenharmony_ci * 2 plane YCbCr MSB aligned 2628c2ecf20Sopenharmony_ci * index 0 = Y plane, [15:0] Y:x [12:4] little endian 2638c2ecf20Sopenharmony_ci * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [12:4:12:4] little endian 2648c2ecf20Sopenharmony_ci */ 2658c2ecf20Sopenharmony_ci#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cr:Cb plane 12 bits per channel */ 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci/* 2688c2ecf20Sopenharmony_ci * 2 plane YCbCr MSB aligned 2698c2ecf20Sopenharmony_ci * index 0 = Y plane, [15:0] Y little endian 2708c2ecf20Sopenharmony_ci * index 1 = Cr:Cb plane, [31:0] Cr:Cb [16:16] little endian 2718c2ecf20Sopenharmony_ci */ 2728c2ecf20Sopenharmony_ci#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */ 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci/* 2 plane YCbCr420. 2758c2ecf20Sopenharmony_ci * 3 10 bit components and 2 padding bits packed into 4 bytes. 2768c2ecf20Sopenharmony_ci * index 0 = Y plane, [31:0] x:Y2:Y1:Y0 2:10:10:10 little endian 2778c2ecf20Sopenharmony_ci * 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 2788c2ecf20Sopenharmony_ci */ 2798c2ecf20Sopenharmony_ci#define DRM_FORMAT_P030 fourcc_code('P', '0', '3', '0') /* 2x2 subsampled Cr:Cb plane 10 bits per channel packed */ 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci/* 3 plane non-subsampled (444) YCbCr 2828c2ecf20Sopenharmony_ci * 16 bits per component, but only 10 bits are used and 6 bits are padded 2838c2ecf20Sopenharmony_ci * index 0: Y plane, [15:0] Y:x [10:6] little endian 2848c2ecf20Sopenharmony_ci * index 1: Cb plane, [15:0] Cb:x [10:6] little endian 2858c2ecf20Sopenharmony_ci * index 2: Cr plane, [15:0] Cr:x [10:6] little endian 2868c2ecf20Sopenharmony_ci */ 2878c2ecf20Sopenharmony_ci#define DRM_FORMAT_Q410 fourcc_code('Q', '4', '1', '0') 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci/* 3 plane non-subsampled (444) YCrCb 2908c2ecf20Sopenharmony_ci * 16 bits per component, but only 10 bits are used and 6 bits are padded 2918c2ecf20Sopenharmony_ci * index 0: Y plane, [15:0] Y:x [10:6] little endian 2928c2ecf20Sopenharmony_ci * index 1: Cr plane, [15:0] Cr:x [10:6] little endian 2938c2ecf20Sopenharmony_ci * index 2: Cb plane, [15:0] Cb:x [10:6] little endian 2948c2ecf20Sopenharmony_ci */ 2958c2ecf20Sopenharmony_ci#define DRM_FORMAT_Q401 fourcc_code('Q', '4', '0', '1') 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci/* 2988c2ecf20Sopenharmony_ci * 3 plane YCbCr 2998c2ecf20Sopenharmony_ci * index 0: Y plane, [7:0] Y 3008c2ecf20Sopenharmony_ci * index 1: Cb plane, [7:0] Cb 3018c2ecf20Sopenharmony_ci * index 2: Cr plane, [7:0] Cr 3028c2ecf20Sopenharmony_ci * or 3038c2ecf20Sopenharmony_ci * index 1: Cr plane, [7:0] Cr 3048c2ecf20Sopenharmony_ci * index 2: Cb plane, [7:0] Cb 3058c2ecf20Sopenharmony_ci */ 3068c2ecf20Sopenharmony_ci#define DRM_FORMAT_YUV410 fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */ 3078c2ecf20Sopenharmony_ci#define DRM_FORMAT_YVU410 fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */ 3088c2ecf20Sopenharmony_ci#define DRM_FORMAT_YUV411 fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */ 3098c2ecf20Sopenharmony_ci#define DRM_FORMAT_YVU411 fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */ 3108c2ecf20Sopenharmony_ci#define DRM_FORMAT_YUV420 fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */ 3118c2ecf20Sopenharmony_ci#define DRM_FORMAT_YVU420 fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */ 3128c2ecf20Sopenharmony_ci#define DRM_FORMAT_YUV422 fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */ 3138c2ecf20Sopenharmony_ci#define DRM_FORMAT_YVU422 fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */ 3148c2ecf20Sopenharmony_ci#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ 3158c2ecf20Sopenharmony_ci#define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci/* 3198c2ecf20Sopenharmony_ci * Format Modifiers: 3208c2ecf20Sopenharmony_ci * 3218c2ecf20Sopenharmony_ci * Format modifiers describe, typically, a re-ordering or modification 3228c2ecf20Sopenharmony_ci * of the data in a plane of an FB. This can be used to express tiled/ 3238c2ecf20Sopenharmony_ci * swizzled formats, or compression, or a combination of the two. 3248c2ecf20Sopenharmony_ci * 3258c2ecf20Sopenharmony_ci * The upper 8 bits of the format modifier are a vendor-id as assigned 3268c2ecf20Sopenharmony_ci * below. The lower 56 bits are assigned as vendor sees fit. 3278c2ecf20Sopenharmony_ci */ 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ci/* Vendor Ids: */ 3308c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_NONE 0 3318c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VENDOR_NONE 0 3328c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VENDOR_INTEL 0x01 3338c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VENDOR_AMD 0x02 3348c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VENDOR_NVIDIA 0x03 3358c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 3368c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 3378c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06 3388c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07 3398c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VENDOR_ARM 0x08 3408c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VENDOR_ALLWINNER 0x09 3418c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VENDOR_AMLOGIC 0x0a 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_ci/* add more to the end as needed */ 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_ci#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) 3468c2ecf20Sopenharmony_ci 3478c2ecf20Sopenharmony_ci#define fourcc_mod_code(vendor, val) \ 3488c2ecf20Sopenharmony_ci ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL)) 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_ci/* 3518c2ecf20Sopenharmony_ci * Format Modifier tokens: 3528c2ecf20Sopenharmony_ci * 3538c2ecf20Sopenharmony_ci * When adding a new token please document the layout with a code comment, 3548c2ecf20Sopenharmony_ci * similar to the fourcc codes above. drm_fourcc.h is considered the 3558c2ecf20Sopenharmony_ci * authoritative source for all of these. 3568c2ecf20Sopenharmony_ci * 3578c2ecf20Sopenharmony_ci * Generic modifier names: 3588c2ecf20Sopenharmony_ci * 3598c2ecf20Sopenharmony_ci * DRM_FORMAT_MOD_GENERIC_* definitions are used to provide vendor-neutral names 3608c2ecf20Sopenharmony_ci * for layouts which are common across multiple vendors. To preserve 3618c2ecf20Sopenharmony_ci * compatibility, in cases where a vendor-specific definition already exists and 3628c2ecf20Sopenharmony_ci * a generic name for it is desired, the common name is a purely symbolic alias 3638c2ecf20Sopenharmony_ci * and must use the same numerical value as the original definition. 3648c2ecf20Sopenharmony_ci * 3658c2ecf20Sopenharmony_ci * Note that generic names should only be used for modifiers which describe 3668c2ecf20Sopenharmony_ci * generic layouts (such as pixel re-ordering), which may have 3678c2ecf20Sopenharmony_ci * independently-developed support across multiple vendors. 3688c2ecf20Sopenharmony_ci * 3698c2ecf20Sopenharmony_ci * In future cases where a generic layout is identified before merging with a 3708c2ecf20Sopenharmony_ci * vendor-specific modifier, a new 'GENERIC' vendor or modifier using vendor 3718c2ecf20Sopenharmony_ci * 'NONE' could be considered. This should only be for obvious, exceptional 3728c2ecf20Sopenharmony_ci * cases to avoid polluting the 'GENERIC' namespace with modifiers which only 3738c2ecf20Sopenharmony_ci * apply to a single vendor. 3748c2ecf20Sopenharmony_ci * 3758c2ecf20Sopenharmony_ci * Generic names should not be used for cases where multiple hardware vendors 3768c2ecf20Sopenharmony_ci * have implementations of the same standardised compression scheme (such as 3778c2ecf20Sopenharmony_ci * AFBC). In those cases, all implementations should use the same format 3788c2ecf20Sopenharmony_ci * modifier(s), reflecting the vendor of the standard. 3798c2ecf20Sopenharmony_ci */ 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_GENERIC_16_16_TILE DRM_FORMAT_MOD_SAMSUNG_16_16_TILE 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_ci/* 3848c2ecf20Sopenharmony_ci * Invalid Modifier 3858c2ecf20Sopenharmony_ci * 3868c2ecf20Sopenharmony_ci * This modifier can be used as a sentinel to terminate the format modifiers 3878c2ecf20Sopenharmony_ci * list, or to initialize a variable with an invalid modifier. It might also be 3888c2ecf20Sopenharmony_ci * used to report an error back to userspace for certain APIs. 3898c2ecf20Sopenharmony_ci */ 3908c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED) 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_ci/* 3938c2ecf20Sopenharmony_ci * Linear Layout 3948c2ecf20Sopenharmony_ci * 3958c2ecf20Sopenharmony_ci * Just plain linear layout. Note that this is different from no specifying any 3968c2ecf20Sopenharmony_ci * modifier (e.g. not setting DRM_MODE_FB_MODIFIERS in the DRM_ADDFB2 ioctl), 3978c2ecf20Sopenharmony_ci * which tells the driver to also take driver-internal information into account 3988c2ecf20Sopenharmony_ci * and so might actually result in a tiled framebuffer. 3998c2ecf20Sopenharmony_ci */ 4008c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0) 4018c2ecf20Sopenharmony_ci 4028c2ecf20Sopenharmony_ci/* Intel framebuffer modifiers */ 4038c2ecf20Sopenharmony_ci 4048c2ecf20Sopenharmony_ci/* 4058c2ecf20Sopenharmony_ci * Intel X-tiling layout 4068c2ecf20Sopenharmony_ci * 4078c2ecf20Sopenharmony_ci * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb) 4088c2ecf20Sopenharmony_ci * in row-major layout. Within the tile bytes are laid out row-major, with 4098c2ecf20Sopenharmony_ci * a platform-dependent stride. On top of that the memory can apply 4108c2ecf20Sopenharmony_ci * platform-depending swizzling of some higher address bits into bit6. 4118c2ecf20Sopenharmony_ci * 4128c2ecf20Sopenharmony_ci * Note that this layout is only accurate on intel gen 8+ or valleyview chipsets. 4138c2ecf20Sopenharmony_ci * On earlier platforms the is highly platforms specific and not useful for 4148c2ecf20Sopenharmony_ci * cross-driver sharing. It exists since on a given platform it does uniquely 4158c2ecf20Sopenharmony_ci * identify the layout in a simple way for i915-specific userspace, which 4168c2ecf20Sopenharmony_ci * facilitated conversion of userspace to modifiers. Additionally the exact 4178c2ecf20Sopenharmony_ci * format on some really old platforms is not known. 4188c2ecf20Sopenharmony_ci */ 4198c2ecf20Sopenharmony_ci#define I915_FORMAT_MOD_X_TILED fourcc_mod_code(INTEL, 1) 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_ci/* 4228c2ecf20Sopenharmony_ci * Intel Y-tiling layout 4238c2ecf20Sopenharmony_ci * 4248c2ecf20Sopenharmony_ci * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb) 4258c2ecf20Sopenharmony_ci * in row-major layout. Within the tile bytes are laid out in OWORD (16 bytes) 4268c2ecf20Sopenharmony_ci * chunks column-major, with a platform-dependent height. On top of that the 4278c2ecf20Sopenharmony_ci * memory can apply platform-depending swizzling of some higher address bits 4288c2ecf20Sopenharmony_ci * into bit6. 4298c2ecf20Sopenharmony_ci * 4308c2ecf20Sopenharmony_ci * Note that this layout is only accurate on intel gen 8+ or valleyview chipsets. 4318c2ecf20Sopenharmony_ci * On earlier platforms the is highly platforms specific and not useful for 4328c2ecf20Sopenharmony_ci * cross-driver sharing. It exists since on a given platform it does uniquely 4338c2ecf20Sopenharmony_ci * identify the layout in a simple way for i915-specific userspace, which 4348c2ecf20Sopenharmony_ci * facilitated conversion of userspace to modifiers. Additionally the exact 4358c2ecf20Sopenharmony_ci * format on some really old platforms is not known. 4368c2ecf20Sopenharmony_ci */ 4378c2ecf20Sopenharmony_ci#define I915_FORMAT_MOD_Y_TILED fourcc_mod_code(INTEL, 2) 4388c2ecf20Sopenharmony_ci 4398c2ecf20Sopenharmony_ci/* 4408c2ecf20Sopenharmony_ci * Intel Yf-tiling layout 4418c2ecf20Sopenharmony_ci * 4428c2ecf20Sopenharmony_ci * This is a tiled layout using 4Kb tiles in row-major layout. 4438c2ecf20Sopenharmony_ci * Within the tile pixels are laid out in 16 256 byte units / sub-tiles which 4448c2ecf20Sopenharmony_ci * are arranged in four groups (two wide, two high) with column-major layout. 4458c2ecf20Sopenharmony_ci * Each group therefore consits out of four 256 byte units, which are also laid 4468c2ecf20Sopenharmony_ci * out as 2x2 column-major. 4478c2ecf20Sopenharmony_ci * 256 byte units are made out of four 64 byte blocks of pixels, producing 4488c2ecf20Sopenharmony_ci * either a square block or a 2:1 unit. 4498c2ecf20Sopenharmony_ci * 64 byte blocks of pixels contain four pixel rows of 16 bytes, where the width 4508c2ecf20Sopenharmony_ci * in pixel depends on the pixel depth. 4518c2ecf20Sopenharmony_ci */ 4528c2ecf20Sopenharmony_ci#define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3) 4538c2ecf20Sopenharmony_ci 4548c2ecf20Sopenharmony_ci/* 4558c2ecf20Sopenharmony_ci * Intel color control surface (CCS) for render compression 4568c2ecf20Sopenharmony_ci * 4578c2ecf20Sopenharmony_ci * The framebuffer format must be one of the 8:8:8:8 RGB formats. 4588c2ecf20Sopenharmony_ci * The main surface will be plane index 0 and must be Y/Yf-tiled, 4598c2ecf20Sopenharmony_ci * the CCS will be plane index 1. 4608c2ecf20Sopenharmony_ci * 4618c2ecf20Sopenharmony_ci * Each CCS tile matches a 1024x512 pixel area of the main surface. 4628c2ecf20Sopenharmony_ci * To match certain aspects of the 3D hardware the CCS is 4638c2ecf20Sopenharmony_ci * considered to be made up of normal 128Bx32 Y tiles, Thus 4648c2ecf20Sopenharmony_ci * the CCS pitch must be specified in multiples of 128 bytes. 4658c2ecf20Sopenharmony_ci * 4668c2ecf20Sopenharmony_ci * In reality the CCS tile appears to be a 64Bx64 Y tile, composed 4678c2ecf20Sopenharmony_ci * of QWORD (8 bytes) chunks instead of OWORD (16 bytes) chunks. 4688c2ecf20Sopenharmony_ci * But that fact is not relevant unless the memory is accessed 4698c2ecf20Sopenharmony_ci * directly. 4708c2ecf20Sopenharmony_ci */ 4718c2ecf20Sopenharmony_ci#define I915_FORMAT_MOD_Y_TILED_CCS fourcc_mod_code(INTEL, 4) 4728c2ecf20Sopenharmony_ci#define I915_FORMAT_MOD_Yf_TILED_CCS fourcc_mod_code(INTEL, 5) 4738c2ecf20Sopenharmony_ci 4748c2ecf20Sopenharmony_ci/* 4758c2ecf20Sopenharmony_ci * Intel color control surfaces (CCS) for Gen-12 render compression. 4768c2ecf20Sopenharmony_ci * 4778c2ecf20Sopenharmony_ci * The main surface is Y-tiled and at plane index 0, the CCS is linear and 4788c2ecf20Sopenharmony_ci * at index 1. A 64B CCS cache line corresponds to an area of 4x1 tiles in 4798c2ecf20Sopenharmony_ci * main surface. In other words, 4 bits in CCS map to a main surface cache 4808c2ecf20Sopenharmony_ci * line pair. The main surface pitch is required to be a multiple of four 4818c2ecf20Sopenharmony_ci * Y-tile widths. 4828c2ecf20Sopenharmony_ci */ 4838c2ecf20Sopenharmony_ci#define I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS fourcc_mod_code(INTEL, 6) 4848c2ecf20Sopenharmony_ci 4858c2ecf20Sopenharmony_ci/* 4868c2ecf20Sopenharmony_ci * Intel color control surfaces (CCS) for Gen-12 media compression 4878c2ecf20Sopenharmony_ci * 4888c2ecf20Sopenharmony_ci * The main surface is Y-tiled and at plane index 0, the CCS is linear and 4898c2ecf20Sopenharmony_ci * at index 1. A 64B CCS cache line corresponds to an area of 4x1 tiles in 4908c2ecf20Sopenharmony_ci * main surface. In other words, 4 bits in CCS map to a main surface cache 4918c2ecf20Sopenharmony_ci * line pair. The main surface pitch is required to be a multiple of four 4928c2ecf20Sopenharmony_ci * Y-tile widths. For semi-planar formats like NV12, CCS planes follow the 4938c2ecf20Sopenharmony_ci * Y and UV planes i.e., planes 0 and 1 are used for Y and UV surfaces, 4948c2ecf20Sopenharmony_ci * planes 2 and 3 for the respective CCS. 4958c2ecf20Sopenharmony_ci */ 4968c2ecf20Sopenharmony_ci#define I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS fourcc_mod_code(INTEL, 7) 4978c2ecf20Sopenharmony_ci 4988c2ecf20Sopenharmony_ci/* 4998c2ecf20Sopenharmony_ci * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks 5008c2ecf20Sopenharmony_ci * 5018c2ecf20Sopenharmony_ci * Macroblocks are laid in a Z-shape, and each pixel data is following the 5028c2ecf20Sopenharmony_ci * standard NV12 style. 5038c2ecf20Sopenharmony_ci * As for NV12, an image is the result of two frame buffers: one for Y, 5048c2ecf20Sopenharmony_ci * one for the interleaved Cb/Cr components (1/2 the height of the Y buffer). 5058c2ecf20Sopenharmony_ci * Alignment requirements are (for each buffer): 5068c2ecf20Sopenharmony_ci * - multiple of 128 pixels for the width 5078c2ecf20Sopenharmony_ci * - multiple of 32 pixels for the height 5088c2ecf20Sopenharmony_ci * 5098c2ecf20Sopenharmony_ci * For more information: see https://linuxtv.org/downloads/v4l-dvb-apis/re32.html 5108c2ecf20Sopenharmony_ci */ 5118c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) 5128c2ecf20Sopenharmony_ci 5138c2ecf20Sopenharmony_ci/* 5148c2ecf20Sopenharmony_ci * Tiled, 16 (pixels) x 16 (lines) - sized macroblocks 5158c2ecf20Sopenharmony_ci * 5168c2ecf20Sopenharmony_ci * This is a simple tiled layout using tiles of 16x16 pixels in a row-major 5178c2ecf20Sopenharmony_ci * layout. For YCbCr formats Cb/Cr components are taken in such a way that 5188c2ecf20Sopenharmony_ci * they correspond to their 16x16 luma block. 5198c2ecf20Sopenharmony_ci */ 5208c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_SAMSUNG_16_16_TILE fourcc_mod_code(SAMSUNG, 2) 5218c2ecf20Sopenharmony_ci 5228c2ecf20Sopenharmony_ci/* 5238c2ecf20Sopenharmony_ci * Qualcomm Compressed Format 5248c2ecf20Sopenharmony_ci * 5258c2ecf20Sopenharmony_ci * Refers to a compressed variant of the base format that is compressed. 5268c2ecf20Sopenharmony_ci * Implementation may be platform and base-format specific. 5278c2ecf20Sopenharmony_ci * 5288c2ecf20Sopenharmony_ci * Each macrotile consists of m x n (mostly 4 x 4) tiles. 5298c2ecf20Sopenharmony_ci * Pixel data pitch/stride is aligned with macrotile width. 5308c2ecf20Sopenharmony_ci * Pixel data height is aligned with macrotile height. 5318c2ecf20Sopenharmony_ci * Entire pixel data buffer is aligned with 4k(bytes). 5328c2ecf20Sopenharmony_ci */ 5338c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_QCOM_COMPRESSED fourcc_mod_code(QCOM, 1) 5348c2ecf20Sopenharmony_ci 5358c2ecf20Sopenharmony_ci/* Vivante framebuffer modifiers */ 5368c2ecf20Sopenharmony_ci 5378c2ecf20Sopenharmony_ci/* 5388c2ecf20Sopenharmony_ci * Vivante 4x4 tiling layout 5398c2ecf20Sopenharmony_ci * 5408c2ecf20Sopenharmony_ci * This is a simple tiled layout using tiles of 4x4 pixels in a row-major 5418c2ecf20Sopenharmony_ci * layout. 5428c2ecf20Sopenharmony_ci */ 5438c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VIVANTE_TILED fourcc_mod_code(VIVANTE, 1) 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_ci/* 5468c2ecf20Sopenharmony_ci * Vivante 64x64 super-tiling layout 5478c2ecf20Sopenharmony_ci * 5488c2ecf20Sopenharmony_ci * This is a tiled layout using 64x64 pixel super-tiles, where each super-tile 5498c2ecf20Sopenharmony_ci * contains 8x4 groups of 2x4 tiles of 4x4 pixels (like above) each, all in row- 5508c2ecf20Sopenharmony_ci * major layout. 5518c2ecf20Sopenharmony_ci * 5528c2ecf20Sopenharmony_ci * For more information: see 5538c2ecf20Sopenharmony_ci * https://github.com/etnaviv/etna_viv/blob/master/doc/hardware.md#texture-tiling 5548c2ecf20Sopenharmony_ci */ 5558c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VIVANTE_SUPER_TILED fourcc_mod_code(VIVANTE, 2) 5568c2ecf20Sopenharmony_ci 5578c2ecf20Sopenharmony_ci/* 5588c2ecf20Sopenharmony_ci * Vivante 4x4 tiling layout for dual-pipe 5598c2ecf20Sopenharmony_ci * 5608c2ecf20Sopenharmony_ci * Same as the 4x4 tiling layout, except every second 4x4 pixel tile starts at a 5618c2ecf20Sopenharmony_ci * different base address. Offsets from the base addresses are therefore halved 5628c2ecf20Sopenharmony_ci * compared to the non-split tiled layout. 5638c2ecf20Sopenharmony_ci */ 5648c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED fourcc_mod_code(VIVANTE, 3) 5658c2ecf20Sopenharmony_ci 5668c2ecf20Sopenharmony_ci/* 5678c2ecf20Sopenharmony_ci * Vivante 64x64 super-tiling layout for dual-pipe 5688c2ecf20Sopenharmony_ci * 5698c2ecf20Sopenharmony_ci * Same as the 64x64 super-tiling layout, except every second 4x4 pixel tile 5708c2ecf20Sopenharmony_ci * starts at a different base address. Offsets from the base addresses are 5718c2ecf20Sopenharmony_ci * therefore halved compared to the non-split super-tiled layout. 5728c2ecf20Sopenharmony_ci */ 5738c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4) 5748c2ecf20Sopenharmony_ci 5758c2ecf20Sopenharmony_ci/* NVIDIA frame buffer modifiers */ 5768c2ecf20Sopenharmony_ci 5778c2ecf20Sopenharmony_ci/* 5788c2ecf20Sopenharmony_ci * Tegra Tiled Layout, used by Tegra 2, 3 and 4. 5798c2ecf20Sopenharmony_ci * 5808c2ecf20Sopenharmony_ci * Pixels are arranged in simple tiles of 16 x 16 bytes. 5818c2ecf20Sopenharmony_ci */ 5828c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED fourcc_mod_code(NVIDIA, 1) 5838c2ecf20Sopenharmony_ci 5848c2ecf20Sopenharmony_ci/* 5858c2ecf20Sopenharmony_ci * Generalized Block Linear layout, used by desktop GPUs starting with NV50/G80, 5868c2ecf20Sopenharmony_ci * and Tegra GPUs starting with Tegra K1. 5878c2ecf20Sopenharmony_ci * 5888c2ecf20Sopenharmony_ci * Pixels are arranged in Groups of Bytes (GOBs). GOB size and layout varies 5898c2ecf20Sopenharmony_ci * based on the architecture generation. GOBs themselves are then arranged in 5908c2ecf20Sopenharmony_ci * 3D blocks, with the block dimensions (in terms of GOBs) always being a power 5918c2ecf20Sopenharmony_ci * of two, and hence expressible as their log2 equivalent (E.g., "2" represents 5928c2ecf20Sopenharmony_ci * a block depth or height of "4"). 5938c2ecf20Sopenharmony_ci * 5948c2ecf20Sopenharmony_ci * Chapter 20 "Pixel Memory Formats" of the Tegra X1 TRM describes this format 5958c2ecf20Sopenharmony_ci * in full detail. 5968c2ecf20Sopenharmony_ci * 5978c2ecf20Sopenharmony_ci * Macro 5988c2ecf20Sopenharmony_ci * Bits Param Description 5998c2ecf20Sopenharmony_ci * ---- ----- ----------------------------------------------------------------- 6008c2ecf20Sopenharmony_ci * 6018c2ecf20Sopenharmony_ci * 3:0 h log2(height) of each block, in GOBs. Placed here for 6028c2ecf20Sopenharmony_ci * compatibility with the existing 6038c2ecf20Sopenharmony_ci * DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK()-based modifiers. 6048c2ecf20Sopenharmony_ci * 6058c2ecf20Sopenharmony_ci * 4:4 - Must be 1, to indicate block-linear layout. Necessary for 6068c2ecf20Sopenharmony_ci * compatibility with the existing 6078c2ecf20Sopenharmony_ci * DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK()-based modifiers. 6088c2ecf20Sopenharmony_ci * 6098c2ecf20Sopenharmony_ci * 8:5 - Reserved (To support 3D-surfaces with variable log2(depth) block 6108c2ecf20Sopenharmony_ci * size). Must be zero. 6118c2ecf20Sopenharmony_ci * 6128c2ecf20Sopenharmony_ci * Note there is no log2(width) parameter. Some portions of the 6138c2ecf20Sopenharmony_ci * hardware support a block width of two gobs, but it is impractical 6148c2ecf20Sopenharmony_ci * to use due to lack of support elsewhere, and has no known 6158c2ecf20Sopenharmony_ci * benefits. 6168c2ecf20Sopenharmony_ci * 6178c2ecf20Sopenharmony_ci * 11:9 - Reserved (To support 2D-array textures with variable array stride 6188c2ecf20Sopenharmony_ci * in blocks, specified via log2(tile width in blocks)). Must be 6198c2ecf20Sopenharmony_ci * zero. 6208c2ecf20Sopenharmony_ci * 6218c2ecf20Sopenharmony_ci * 19:12 k Page Kind. This value directly maps to a field in the page 6228c2ecf20Sopenharmony_ci * tables of all GPUs >= NV50. It affects the exact layout of bits 6238c2ecf20Sopenharmony_ci * in memory and can be derived from the tuple 6248c2ecf20Sopenharmony_ci * 6258c2ecf20Sopenharmony_ci * (format, GPU model, compression type, samples per pixel) 6268c2ecf20Sopenharmony_ci * 6278c2ecf20Sopenharmony_ci * Where compression type is defined below. If GPU model were 6288c2ecf20Sopenharmony_ci * implied by the format modifier, format, or memory buffer, page 6298c2ecf20Sopenharmony_ci * kind would not need to be included in the modifier itself, but 6308c2ecf20Sopenharmony_ci * since the modifier should define the layout of the associated 6318c2ecf20Sopenharmony_ci * memory buffer independent from any device or other context, it 6328c2ecf20Sopenharmony_ci * must be included here. 6338c2ecf20Sopenharmony_ci * 6348c2ecf20Sopenharmony_ci * 21:20 g GOB Height and Page Kind Generation. The height of a GOB changed 6358c2ecf20Sopenharmony_ci * starting with Fermi GPUs. Additionally, the mapping between page 6368c2ecf20Sopenharmony_ci * kind and bit layout has changed at various points. 6378c2ecf20Sopenharmony_ci * 6388c2ecf20Sopenharmony_ci * 0 = Gob Height 8, Fermi - Volta, Tegra K1+ Page Kind mapping 6398c2ecf20Sopenharmony_ci * 1 = Gob Height 4, G80 - GT2XX Page Kind mapping 6408c2ecf20Sopenharmony_ci * 2 = Gob Height 8, Turing+ Page Kind mapping 6418c2ecf20Sopenharmony_ci * 3 = Reserved for future use. 6428c2ecf20Sopenharmony_ci * 6438c2ecf20Sopenharmony_ci * 22:22 s Sector layout. On Tegra GPUs prior to Xavier, there is a further 6448c2ecf20Sopenharmony_ci * bit remapping step that occurs at an even lower level than the 6458c2ecf20Sopenharmony_ci * page kind and block linear swizzles. This causes the layout of 6468c2ecf20Sopenharmony_ci * surfaces mapped in those SOC's GPUs to be incompatible with the 6478c2ecf20Sopenharmony_ci * equivalent mapping on other GPUs in the same system. 6488c2ecf20Sopenharmony_ci * 6498c2ecf20Sopenharmony_ci * 0 = Tegra K1 - Tegra Parker/TX2 Layout. 6508c2ecf20Sopenharmony_ci * 1 = Desktop GPU and Tegra Xavier+ Layout 6518c2ecf20Sopenharmony_ci * 6528c2ecf20Sopenharmony_ci * 25:23 c Lossless Framebuffer Compression type. 6538c2ecf20Sopenharmony_ci * 6548c2ecf20Sopenharmony_ci * 0 = none 6558c2ecf20Sopenharmony_ci * 1 = ROP/3D, layout 1, exact compression format implied by Page 6568c2ecf20Sopenharmony_ci * Kind field 6578c2ecf20Sopenharmony_ci * 2 = ROP/3D, layout 2, exact compression format implied by Page 6588c2ecf20Sopenharmony_ci * Kind field 6598c2ecf20Sopenharmony_ci * 3 = CDE horizontal 6608c2ecf20Sopenharmony_ci * 4 = CDE vertical 6618c2ecf20Sopenharmony_ci * 5 = Reserved for future use 6628c2ecf20Sopenharmony_ci * 6 = Reserved for future use 6638c2ecf20Sopenharmony_ci * 7 = Reserved for future use 6648c2ecf20Sopenharmony_ci * 6658c2ecf20Sopenharmony_ci * 55:25 - Reserved for future use. Must be zero. 6668c2ecf20Sopenharmony_ci */ 6678c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(c, s, g, k, h) \ 6688c2ecf20Sopenharmony_ci fourcc_mod_code(NVIDIA, (0x10 | \ 6698c2ecf20Sopenharmony_ci ((h) & 0xf) | \ 6708c2ecf20Sopenharmony_ci (((k) & 0xff) << 12) | \ 6718c2ecf20Sopenharmony_ci (((g) & 0x3) << 20) | \ 6728c2ecf20Sopenharmony_ci (((s) & 0x1) << 22) | \ 6738c2ecf20Sopenharmony_ci (((c) & 0x7) << 23))) 6748c2ecf20Sopenharmony_ci 6758c2ecf20Sopenharmony_ci/* To grandfather in prior block linear format modifiers to the above layout, 6768c2ecf20Sopenharmony_ci * the page kind "0", which corresponds to "pitch/linear" and hence is unusable 6778c2ecf20Sopenharmony_ci * with block-linear layouts, is remapped within drivers to the value 0xfe, 6788c2ecf20Sopenharmony_ci * which corresponds to the "generic" kind used for simple single-sample 6798c2ecf20Sopenharmony_ci * uncompressed color formats on Fermi - Volta GPUs. 6808c2ecf20Sopenharmony_ci */ 6818c2ecf20Sopenharmony_cistatic inline __u64 6828c2ecf20Sopenharmony_cidrm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) 6838c2ecf20Sopenharmony_ci{ 6848c2ecf20Sopenharmony_ci if (!(modifier & 0x10) || (modifier & (0xff << 12))) 6858c2ecf20Sopenharmony_ci return modifier; 6868c2ecf20Sopenharmony_ci else 6878c2ecf20Sopenharmony_ci return modifier | (0xfe << 12); 6888c2ecf20Sopenharmony_ci} 6898c2ecf20Sopenharmony_ci 6908c2ecf20Sopenharmony_ci/* 6918c2ecf20Sopenharmony_ci * 16Bx2 Block Linear layout, used by Tegra K1 and later 6928c2ecf20Sopenharmony_ci * 6938c2ecf20Sopenharmony_ci * Pixels are arranged in 64x8 Groups Of Bytes (GOBs). GOBs are then stacked 6948c2ecf20Sopenharmony_ci * vertically by a power of 2 (1 to 32 GOBs) to form a block. 6958c2ecf20Sopenharmony_ci * 6968c2ecf20Sopenharmony_ci * Within a GOB, data is ordered as 16B x 2 lines sectors laid in Z-shape. 6978c2ecf20Sopenharmony_ci * 6988c2ecf20Sopenharmony_ci * Parameter 'v' is the log2 encoding of the number of GOBs stacked vertically. 6998c2ecf20Sopenharmony_ci * Valid values are: 7008c2ecf20Sopenharmony_ci * 7018c2ecf20Sopenharmony_ci * 0 == ONE_GOB 7028c2ecf20Sopenharmony_ci * 1 == TWO_GOBS 7038c2ecf20Sopenharmony_ci * 2 == FOUR_GOBS 7048c2ecf20Sopenharmony_ci * 3 == EIGHT_GOBS 7058c2ecf20Sopenharmony_ci * 4 == SIXTEEN_GOBS 7068c2ecf20Sopenharmony_ci * 5 == THIRTYTWO_GOBS 7078c2ecf20Sopenharmony_ci * 7088c2ecf20Sopenharmony_ci * Chapter 20 "Pixel Memory Formats" of the Tegra X1 TRM describes this format 7098c2ecf20Sopenharmony_ci * in full detail. 7108c2ecf20Sopenharmony_ci */ 7118c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(v) \ 7128c2ecf20Sopenharmony_ci DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(0, 0, 0, 0, (v)) 7138c2ecf20Sopenharmony_ci 7148c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB \ 7158c2ecf20Sopenharmony_ci DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(0) 7168c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB \ 7178c2ecf20Sopenharmony_ci DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(1) 7188c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB \ 7198c2ecf20Sopenharmony_ci DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(2) 7208c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB \ 7218c2ecf20Sopenharmony_ci DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(3) 7228c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB \ 7238c2ecf20Sopenharmony_ci DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(4) 7248c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB \ 7258c2ecf20Sopenharmony_ci DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(5) 7268c2ecf20Sopenharmony_ci 7278c2ecf20Sopenharmony_ci/* 7288c2ecf20Sopenharmony_ci * Some Broadcom modifiers take parameters, for example the number of 7298c2ecf20Sopenharmony_ci * vertical lines in the image. Reserve the lower 32 bits for modifier 7308c2ecf20Sopenharmony_ci * type, and the next 24 bits for parameters. Top 8 bits are the 7318c2ecf20Sopenharmony_ci * vendor code. 7328c2ecf20Sopenharmony_ci */ 7338c2ecf20Sopenharmony_ci#define __fourcc_mod_broadcom_param_shift 8 7348c2ecf20Sopenharmony_ci#define __fourcc_mod_broadcom_param_bits 48 7358c2ecf20Sopenharmony_ci#define fourcc_mod_broadcom_code(val, params) \ 7368c2ecf20Sopenharmony_ci fourcc_mod_code(BROADCOM, ((((__u64)params) << __fourcc_mod_broadcom_param_shift) | val)) 7378c2ecf20Sopenharmony_ci#define fourcc_mod_broadcom_param(m) \ 7388c2ecf20Sopenharmony_ci ((int)(((m) >> __fourcc_mod_broadcom_param_shift) & \ 7398c2ecf20Sopenharmony_ci ((1ULL << __fourcc_mod_broadcom_param_bits) - 1))) 7408c2ecf20Sopenharmony_ci#define fourcc_mod_broadcom_mod(m) \ 7418c2ecf20Sopenharmony_ci ((m) & ~(((1ULL << __fourcc_mod_broadcom_param_bits) - 1) << \ 7428c2ecf20Sopenharmony_ci __fourcc_mod_broadcom_param_shift)) 7438c2ecf20Sopenharmony_ci 7448c2ecf20Sopenharmony_ci/* 7458c2ecf20Sopenharmony_ci * Broadcom VC4 "T" format 7468c2ecf20Sopenharmony_ci * 7478c2ecf20Sopenharmony_ci * This is the primary layout that the V3D GPU can texture from (it 7488c2ecf20Sopenharmony_ci * can't do linear). The T format has: 7498c2ecf20Sopenharmony_ci * 7508c2ecf20Sopenharmony_ci * - 64b utiles of pixels in a raster-order grid according to cpp. It's 4x4 7518c2ecf20Sopenharmony_ci * pixels at 32 bit depth. 7528c2ecf20Sopenharmony_ci * 7538c2ecf20Sopenharmony_ci * - 1k subtiles made of a 4x4 raster-order grid of 64b utiles (so usually 7548c2ecf20Sopenharmony_ci * 16x16 pixels). 7558c2ecf20Sopenharmony_ci * 7568c2ecf20Sopenharmony_ci * - 4k tiles made of a 2x2 grid of 1k subtiles (so usually 32x32 pixels). On 7578c2ecf20Sopenharmony_ci * even 4k tile rows, they're arranged as (BL, TL, TR, BR), and on odd rows 7588c2ecf20Sopenharmony_ci * they're (TR, BR, BL, TL), where bottom left is start of memory. 7598c2ecf20Sopenharmony_ci * 7608c2ecf20Sopenharmony_ci * - an image made of 4k tiles in rows either left-to-right (even rows of 4k 7618c2ecf20Sopenharmony_ci * tiles) or right-to-left (odd rows of 4k tiles). 7628c2ecf20Sopenharmony_ci */ 7638c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED fourcc_mod_code(BROADCOM, 1) 7648c2ecf20Sopenharmony_ci 7658c2ecf20Sopenharmony_ci/* 7668c2ecf20Sopenharmony_ci * Broadcom SAND format 7678c2ecf20Sopenharmony_ci * 7688c2ecf20Sopenharmony_ci * This is the native format that the H.264 codec block uses. For VC4 7698c2ecf20Sopenharmony_ci * HVS, it is only valid for H.264 (NV12/21) and RGBA modes. 7708c2ecf20Sopenharmony_ci * 7718c2ecf20Sopenharmony_ci * The image can be considered to be split into columns, and the 7728c2ecf20Sopenharmony_ci * columns are placed consecutively into memory. The width of those 7738c2ecf20Sopenharmony_ci * columns can be either 32, 64, 128, or 256 pixels, but in practice 7748c2ecf20Sopenharmony_ci * only 128 pixel columns are used. 7758c2ecf20Sopenharmony_ci * 7768c2ecf20Sopenharmony_ci * The pitch between the start of each column is set to optimally 7778c2ecf20Sopenharmony_ci * switch between SDRAM banks. This is passed as the number of lines 7788c2ecf20Sopenharmony_ci * of column width in the modifier (we can't use the stride value due 7798c2ecf20Sopenharmony_ci * to various core checks that look at it , so you should set the 7808c2ecf20Sopenharmony_ci * stride to width*cpp). 7818c2ecf20Sopenharmony_ci * 7828c2ecf20Sopenharmony_ci * Note that the column height for this format modifier is the same 7838c2ecf20Sopenharmony_ci * for all of the planes, assuming that each column contains both Y 7848c2ecf20Sopenharmony_ci * and UV. Some SAND-using hardware stores UV in a separate tiled 7858c2ecf20Sopenharmony_ci * image from Y to reduce the column height, which is not supported 7868c2ecf20Sopenharmony_ci * with these modifiers. 7878c2ecf20Sopenharmony_ci * 7888c2ecf20Sopenharmony_ci * The DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT modifier is also 7898c2ecf20Sopenharmony_ci * supported for DRM_FORMAT_P030 where the columns remain as 128 bytes 7908c2ecf20Sopenharmony_ci * wide, but as this is a 10 bpp format that translates to 96 pixels. 7918c2ecf20Sopenharmony_ci */ 7928c2ecf20Sopenharmony_ci 7938c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_BROADCOM_SAND32_COL_HEIGHT(v) \ 7948c2ecf20Sopenharmony_ci fourcc_mod_broadcom_code(2, v) 7958c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_BROADCOM_SAND64_COL_HEIGHT(v) \ 7968c2ecf20Sopenharmony_ci fourcc_mod_broadcom_code(3, v) 7978c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT(v) \ 7988c2ecf20Sopenharmony_ci fourcc_mod_broadcom_code(4, v) 7998c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_BROADCOM_SAND256_COL_HEIGHT(v) \ 8008c2ecf20Sopenharmony_ci fourcc_mod_broadcom_code(5, v) 8018c2ecf20Sopenharmony_ci 8028c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_BROADCOM_SAND32 \ 8038c2ecf20Sopenharmony_ci DRM_FORMAT_MOD_BROADCOM_SAND32_COL_HEIGHT(0) 8048c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_BROADCOM_SAND64 \ 8058c2ecf20Sopenharmony_ci DRM_FORMAT_MOD_BROADCOM_SAND64_COL_HEIGHT(0) 8068c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_BROADCOM_SAND128 \ 8078c2ecf20Sopenharmony_ci DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT(0) 8088c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_BROADCOM_SAND256 \ 8098c2ecf20Sopenharmony_ci DRM_FORMAT_MOD_BROADCOM_SAND256_COL_HEIGHT(0) 8108c2ecf20Sopenharmony_ci 8118c2ecf20Sopenharmony_ci/* Broadcom UIF format 8128c2ecf20Sopenharmony_ci * 8138c2ecf20Sopenharmony_ci * This is the common format for the current Broadcom multimedia 8148c2ecf20Sopenharmony_ci * blocks, including V3D 3.x and newer, newer video codecs, and 8158c2ecf20Sopenharmony_ci * displays. 8168c2ecf20Sopenharmony_ci * 8178c2ecf20Sopenharmony_ci * The image consists of utiles (64b blocks), UIF blocks (2x2 utiles), 8188c2ecf20Sopenharmony_ci * and macroblocks (4x4 UIF blocks). Those 4x4 UIF block groups are 8198c2ecf20Sopenharmony_ci * stored in columns, with padding between the columns to ensure that 8208c2ecf20Sopenharmony_ci * moving from one column to the next doesn't hit the same SDRAM page 8218c2ecf20Sopenharmony_ci * bank. 8228c2ecf20Sopenharmony_ci * 8238c2ecf20Sopenharmony_ci * To calculate the padding, it is assumed that each hardware block 8248c2ecf20Sopenharmony_ci * and the software driving it knows the platform's SDRAM page size, 8258c2ecf20Sopenharmony_ci * number of banks, and XOR address, and that it's identical between 8268c2ecf20Sopenharmony_ci * all blocks using the format. This tiling modifier will use XOR as 8278c2ecf20Sopenharmony_ci * necessary to reduce the padding. If a hardware block can't do XOR, 8288c2ecf20Sopenharmony_ci * the assumption is that a no-XOR tiling modifier will be created. 8298c2ecf20Sopenharmony_ci */ 8308c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_BROADCOM_UIF fourcc_mod_code(BROADCOM, 6) 8318c2ecf20Sopenharmony_ci 8328c2ecf20Sopenharmony_ci/* 8338c2ecf20Sopenharmony_ci * Arm Framebuffer Compression (AFBC) modifiers 8348c2ecf20Sopenharmony_ci * 8358c2ecf20Sopenharmony_ci * AFBC is a proprietary lossless image compression protocol and format. 8368c2ecf20Sopenharmony_ci * It provides fine-grained random access and minimizes the amount of data 8378c2ecf20Sopenharmony_ci * transferred between IP blocks. 8388c2ecf20Sopenharmony_ci * 8398c2ecf20Sopenharmony_ci * AFBC has several features which may be supported and/or used, which are 8408c2ecf20Sopenharmony_ci * represented using bits in the modifier. Not all combinations are valid, 8418c2ecf20Sopenharmony_ci * and different devices or use-cases may support different combinations. 8428c2ecf20Sopenharmony_ci * 8438c2ecf20Sopenharmony_ci * Further information on the use of AFBC modifiers can be found in 8448c2ecf20Sopenharmony_ci * Documentation/gpu/afbc.rst 8458c2ecf20Sopenharmony_ci */ 8468c2ecf20Sopenharmony_ci 8478c2ecf20Sopenharmony_ci/* 8488c2ecf20Sopenharmony_ci * The top 4 bits (out of the 56 bits alloted for specifying vendor specific 8498c2ecf20Sopenharmony_ci * modifiers) denote the category for modifiers. Currently we have only two 8508c2ecf20Sopenharmony_ci * categories of modifiers ie AFBC and MISC. We can have a maximum of sixteen 8518c2ecf20Sopenharmony_ci * different categories. 8528c2ecf20Sopenharmony_ci */ 8538c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_ARM_CODE(__type, __val) \ 8548c2ecf20Sopenharmony_ci fourcc_mod_code(ARM, ((__u64)(__type) << 52) | ((__val) & 0x000fffffffffffffULL)) 8558c2ecf20Sopenharmony_ci 8568c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_ARM_TYPE_AFBC 0x00 8578c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_ARM_TYPE_MISC 0x01 8588c2ecf20Sopenharmony_ci 8598c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_ARM_AFBC(__afbc_mode) \ 8608c2ecf20Sopenharmony_ci DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_AFBC, __afbc_mode) 8618c2ecf20Sopenharmony_ci 8628c2ecf20Sopenharmony_ci/* 8638c2ecf20Sopenharmony_ci * AFBC superblock size 8648c2ecf20Sopenharmony_ci * 8658c2ecf20Sopenharmony_ci * Indicates the superblock size(s) used for the AFBC buffer. The buffer 8668c2ecf20Sopenharmony_ci * size (in pixels) must be aligned to a multiple of the superblock size. 8678c2ecf20Sopenharmony_ci * Four lowest significant bits(LSBs) are reserved for block size. 8688c2ecf20Sopenharmony_ci * 8698c2ecf20Sopenharmony_ci * Where one superblock size is specified, it applies to all planes of the 8708c2ecf20Sopenharmony_ci * buffer (e.g. 16x16, 32x8). When multiple superblock sizes are specified, 8718c2ecf20Sopenharmony_ci * the first applies to the Luma plane and the second applies to the Chroma 8728c2ecf20Sopenharmony_ci * plane(s). e.g. (32x8_64x4 means 32x8 Luma, with 64x4 Chroma). 8738c2ecf20Sopenharmony_ci * Multiple superblock sizes are only valid for multi-plane YCbCr formats. 8748c2ecf20Sopenharmony_ci */ 8758c2ecf20Sopenharmony_ci#define AFBC_FORMAT_MOD_BLOCK_SIZE_MASK 0xf 8768c2ecf20Sopenharmony_ci#define AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 (1ULL) 8778c2ecf20Sopenharmony_ci#define AFBC_FORMAT_MOD_BLOCK_SIZE_32x8 (2ULL) 8788c2ecf20Sopenharmony_ci#define AFBC_FORMAT_MOD_BLOCK_SIZE_64x4 (3ULL) 8798c2ecf20Sopenharmony_ci#define AFBC_FORMAT_MOD_BLOCK_SIZE_32x8_64x4 (4ULL) 8808c2ecf20Sopenharmony_ci 8818c2ecf20Sopenharmony_ci/* 8828c2ecf20Sopenharmony_ci * AFBC lossless colorspace transform 8838c2ecf20Sopenharmony_ci * 8848c2ecf20Sopenharmony_ci * Indicates that the buffer makes use of the AFBC lossless colorspace 8858c2ecf20Sopenharmony_ci * transform. 8868c2ecf20Sopenharmony_ci */ 8878c2ecf20Sopenharmony_ci#define AFBC_FORMAT_MOD_YTR (1ULL << 4) 8888c2ecf20Sopenharmony_ci 8898c2ecf20Sopenharmony_ci/* 8908c2ecf20Sopenharmony_ci * AFBC block-split 8918c2ecf20Sopenharmony_ci * 8928c2ecf20Sopenharmony_ci * Indicates that the payload of each superblock is split. The second 8938c2ecf20Sopenharmony_ci * half of the payload is positioned at a predefined offset from the start 8948c2ecf20Sopenharmony_ci * of the superblock payload. 8958c2ecf20Sopenharmony_ci */ 8968c2ecf20Sopenharmony_ci#define AFBC_FORMAT_MOD_SPLIT (1ULL << 5) 8978c2ecf20Sopenharmony_ci 8988c2ecf20Sopenharmony_ci/* 8998c2ecf20Sopenharmony_ci * AFBC sparse layout 9008c2ecf20Sopenharmony_ci * 9018c2ecf20Sopenharmony_ci * This flag indicates that the payload of each superblock must be stored at a 9028c2ecf20Sopenharmony_ci * predefined position relative to the other superblocks in the same AFBC 9038c2ecf20Sopenharmony_ci * buffer. This order is the same order used by the header buffer. In this mode 9048c2ecf20Sopenharmony_ci * each superblock is given the same amount of space as an uncompressed 9058c2ecf20Sopenharmony_ci * superblock of the particular format would require, rounding up to the next 9068c2ecf20Sopenharmony_ci * multiple of 128 bytes in size. 9078c2ecf20Sopenharmony_ci */ 9088c2ecf20Sopenharmony_ci#define AFBC_FORMAT_MOD_SPARSE (1ULL << 6) 9098c2ecf20Sopenharmony_ci 9108c2ecf20Sopenharmony_ci/* 9118c2ecf20Sopenharmony_ci * AFBC copy-block restrict 9128c2ecf20Sopenharmony_ci * 9138c2ecf20Sopenharmony_ci * Buffers with this flag must obey the copy-block restriction. The restriction 9148c2ecf20Sopenharmony_ci * is such that there are no copy-blocks referring across the border of 8x8 9158c2ecf20Sopenharmony_ci * blocks. For the subsampled data the 8x8 limitation is also subsampled. 9168c2ecf20Sopenharmony_ci */ 9178c2ecf20Sopenharmony_ci#define AFBC_FORMAT_MOD_CBR (1ULL << 7) 9188c2ecf20Sopenharmony_ci 9198c2ecf20Sopenharmony_ci/* 9208c2ecf20Sopenharmony_ci * AFBC tiled layout 9218c2ecf20Sopenharmony_ci * 9228c2ecf20Sopenharmony_ci * The tiled layout groups superblocks in 8x8 or 4x4 tiles, where all 9238c2ecf20Sopenharmony_ci * superblocks inside a tile are stored together in memory. 8x8 tiles are used 9248c2ecf20Sopenharmony_ci * for pixel formats up to and including 32 bpp while 4x4 tiles are used for 9258c2ecf20Sopenharmony_ci * larger bpp formats. The order between the tiles is scan line. 9268c2ecf20Sopenharmony_ci * When the tiled layout is used, the buffer size (in pixels) must be aligned 9278c2ecf20Sopenharmony_ci * to the tile size. 9288c2ecf20Sopenharmony_ci */ 9298c2ecf20Sopenharmony_ci#define AFBC_FORMAT_MOD_TILED (1ULL << 8) 9308c2ecf20Sopenharmony_ci 9318c2ecf20Sopenharmony_ci/* 9328c2ecf20Sopenharmony_ci * AFBC solid color blocks 9338c2ecf20Sopenharmony_ci * 9348c2ecf20Sopenharmony_ci * Indicates that the buffer makes use of solid-color blocks, whereby bandwidth 9358c2ecf20Sopenharmony_ci * can be reduced if a whole superblock is a single color. 9368c2ecf20Sopenharmony_ci */ 9378c2ecf20Sopenharmony_ci#define AFBC_FORMAT_MOD_SC (1ULL << 9) 9388c2ecf20Sopenharmony_ci 9398c2ecf20Sopenharmony_ci/* 9408c2ecf20Sopenharmony_ci * AFBC double-buffer 9418c2ecf20Sopenharmony_ci * 9428c2ecf20Sopenharmony_ci * Indicates that the buffer is allocated in a layout safe for front-buffer 9438c2ecf20Sopenharmony_ci * rendering. 9448c2ecf20Sopenharmony_ci */ 9458c2ecf20Sopenharmony_ci#define AFBC_FORMAT_MOD_DB (1ULL << 10) 9468c2ecf20Sopenharmony_ci 9478c2ecf20Sopenharmony_ci/* 9488c2ecf20Sopenharmony_ci * AFBC buffer content hints 9498c2ecf20Sopenharmony_ci * 9508c2ecf20Sopenharmony_ci * Indicates that the buffer includes per-superblock content hints. 9518c2ecf20Sopenharmony_ci */ 9528c2ecf20Sopenharmony_ci#define AFBC_FORMAT_MOD_BCH (1ULL << 11) 9538c2ecf20Sopenharmony_ci 9548c2ecf20Sopenharmony_ci/* AFBC uncompressed storage mode 9558c2ecf20Sopenharmony_ci * 9568c2ecf20Sopenharmony_ci * Indicates that the buffer is using AFBC uncompressed storage mode. 9578c2ecf20Sopenharmony_ci * In this mode all superblock payloads in the buffer use the uncompressed 9588c2ecf20Sopenharmony_ci * storage mode, which is usually only used for data which cannot be compressed. 9598c2ecf20Sopenharmony_ci * The buffer layout is the same as for AFBC buffers without USM set, this only 9608c2ecf20Sopenharmony_ci * affects the storage mode of the individual superblocks. Note that even a 9618c2ecf20Sopenharmony_ci * buffer without USM set may use uncompressed storage mode for some or all 9628c2ecf20Sopenharmony_ci * superblocks, USM just guarantees it for all. 9638c2ecf20Sopenharmony_ci */ 9648c2ecf20Sopenharmony_ci#define AFBC_FORMAT_MOD_USM (1ULL << 12) 9658c2ecf20Sopenharmony_ci 9668c2ecf20Sopenharmony_ci/* 9678c2ecf20Sopenharmony_ci * Arm 16x16 Block U-Interleaved modifier 9688c2ecf20Sopenharmony_ci * 9698c2ecf20Sopenharmony_ci * This is used by Arm Mali Utgard and Midgard GPUs. It divides the image 9708c2ecf20Sopenharmony_ci * into 16x16 pixel blocks. Blocks are stored linearly in order, but pixels 9718c2ecf20Sopenharmony_ci * in the block are reordered. 9728c2ecf20Sopenharmony_ci */ 9738c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \ 9748c2ecf20Sopenharmony_ci DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 1ULL) 9758c2ecf20Sopenharmony_ci 9768c2ecf20Sopenharmony_ci/* 9778c2ecf20Sopenharmony_ci * Allwinner tiled modifier 9788c2ecf20Sopenharmony_ci * 9798c2ecf20Sopenharmony_ci * This tiling mode is implemented by the VPU found on all Allwinner platforms, 9808c2ecf20Sopenharmony_ci * codenamed sunxi. It is associated with a YUV format that uses either 2 or 3 9818c2ecf20Sopenharmony_ci * planes. 9828c2ecf20Sopenharmony_ci * 9838c2ecf20Sopenharmony_ci * With this tiling, the luminance samples are disposed in tiles representing 9848c2ecf20Sopenharmony_ci * 32x32 pixels and the chrominance samples in tiles representing 32x64 pixels. 9858c2ecf20Sopenharmony_ci * The pixel order in each tile is linear and the tiles are disposed linearly, 9868c2ecf20Sopenharmony_ci * both in row-major order. 9878c2ecf20Sopenharmony_ci */ 9888c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_ALLWINNER_TILED fourcc_mod_code(ALLWINNER, 1) 9898c2ecf20Sopenharmony_ci 9908c2ecf20Sopenharmony_ci/* 9918c2ecf20Sopenharmony_ci * Amlogic Video Framebuffer Compression modifiers 9928c2ecf20Sopenharmony_ci * 9938c2ecf20Sopenharmony_ci * Amlogic uses a proprietary lossless image compression protocol and format 9948c2ecf20Sopenharmony_ci * for their hardware video codec accelerators, either video decoders or 9958c2ecf20Sopenharmony_ci * video input encoders. 9968c2ecf20Sopenharmony_ci * 9978c2ecf20Sopenharmony_ci * It considerably reduces memory bandwidth while writing and reading 9988c2ecf20Sopenharmony_ci * frames in memory. 9998c2ecf20Sopenharmony_ci * 10008c2ecf20Sopenharmony_ci * The underlying storage is considered to be 3 components, 8bit or 10-bit 10018c2ecf20Sopenharmony_ci * per component YCbCr 420, single plane : 10028c2ecf20Sopenharmony_ci * - DRM_FORMAT_YUV420_8BIT 10038c2ecf20Sopenharmony_ci * - DRM_FORMAT_YUV420_10BIT 10048c2ecf20Sopenharmony_ci * 10058c2ecf20Sopenharmony_ci * The first 8 bits of the mode defines the layout, then the following 8 bits 10068c2ecf20Sopenharmony_ci * defines the options changing the layout. 10078c2ecf20Sopenharmony_ci * 10088c2ecf20Sopenharmony_ci * Not all combinations are valid, and different SoCs may support different 10098c2ecf20Sopenharmony_ci * combinations of layout and options. 10108c2ecf20Sopenharmony_ci */ 10118c2ecf20Sopenharmony_ci#define __fourcc_mod_amlogic_layout_mask 0xff 10128c2ecf20Sopenharmony_ci#define __fourcc_mod_amlogic_options_shift 8 10138c2ecf20Sopenharmony_ci#define __fourcc_mod_amlogic_options_mask 0xff 10148c2ecf20Sopenharmony_ci 10158c2ecf20Sopenharmony_ci#define DRM_FORMAT_MOD_AMLOGIC_FBC(__layout, __options) \ 10168c2ecf20Sopenharmony_ci fourcc_mod_code(AMLOGIC, \ 10178c2ecf20Sopenharmony_ci ((__layout) & __fourcc_mod_amlogic_layout_mask) | \ 10188c2ecf20Sopenharmony_ci (((__options) & __fourcc_mod_amlogic_options_mask) \ 10198c2ecf20Sopenharmony_ci << __fourcc_mod_amlogic_options_shift)) 10208c2ecf20Sopenharmony_ci 10218c2ecf20Sopenharmony_ci/* Amlogic FBC Layouts */ 10228c2ecf20Sopenharmony_ci 10238c2ecf20Sopenharmony_ci/* 10248c2ecf20Sopenharmony_ci * Amlogic FBC Basic Layout 10258c2ecf20Sopenharmony_ci * 10268c2ecf20Sopenharmony_ci * The basic layout is composed of: 10278c2ecf20Sopenharmony_ci * - a body content organized in 64x32 superblocks with 4096 bytes per 10288c2ecf20Sopenharmony_ci * superblock in default mode. 10298c2ecf20Sopenharmony_ci * - a 32 bytes per 128x64 header block 10308c2ecf20Sopenharmony_ci * 10318c2ecf20Sopenharmony_ci * This layout is transferrable between Amlogic SoCs supporting this modifier. 10328c2ecf20Sopenharmony_ci */ 10338c2ecf20Sopenharmony_ci#define AMLOGIC_FBC_LAYOUT_BASIC (1ULL) 10348c2ecf20Sopenharmony_ci 10358c2ecf20Sopenharmony_ci/* 10368c2ecf20Sopenharmony_ci * Amlogic FBC Scatter Memory layout 10378c2ecf20Sopenharmony_ci * 10388c2ecf20Sopenharmony_ci * Indicates the header contains IOMMU references to the compressed 10398c2ecf20Sopenharmony_ci * frames content to optimize memory access and layout. 10408c2ecf20Sopenharmony_ci * 10418c2ecf20Sopenharmony_ci * In this mode, only the header memory address is needed, thus the 10428c2ecf20Sopenharmony_ci * content memory organization is tied to the current producer 10438c2ecf20Sopenharmony_ci * execution and cannot be saved/dumped neither transferrable between 10448c2ecf20Sopenharmony_ci * Amlogic SoCs supporting this modifier. 10458c2ecf20Sopenharmony_ci * 10468c2ecf20Sopenharmony_ci * Due to the nature of the layout, these buffers are not expected to 10478c2ecf20Sopenharmony_ci * be accessible by the user-space clients, but only accessible by the 10488c2ecf20Sopenharmony_ci * hardware producers and consumers. 10498c2ecf20Sopenharmony_ci * 10508c2ecf20Sopenharmony_ci * The user-space clients should expect a failure while trying to mmap 10518c2ecf20Sopenharmony_ci * the DMA-BUF handle returned by the producer. 10528c2ecf20Sopenharmony_ci */ 10538c2ecf20Sopenharmony_ci#define AMLOGIC_FBC_LAYOUT_SCATTER (2ULL) 10548c2ecf20Sopenharmony_ci 10558c2ecf20Sopenharmony_ci/* Amlogic FBC Layout Options Bit Mask */ 10568c2ecf20Sopenharmony_ci 10578c2ecf20Sopenharmony_ci/* 10588c2ecf20Sopenharmony_ci * Amlogic FBC Memory Saving mode 10598c2ecf20Sopenharmony_ci * 10608c2ecf20Sopenharmony_ci * Indicates the storage is packed when pixel size is multiple of word 10618c2ecf20Sopenharmony_ci * boudaries, i.e. 8bit should be stored in this mode to save allocation 10628c2ecf20Sopenharmony_ci * memory. 10638c2ecf20Sopenharmony_ci * 10648c2ecf20Sopenharmony_ci * This mode reduces body layout to 3072 bytes per 64x32 superblock with 10658c2ecf20Sopenharmony_ci * the basic layout and 3200 bytes per 64x32 superblock combined with 10668c2ecf20Sopenharmony_ci * the scatter layout. 10678c2ecf20Sopenharmony_ci */ 10688c2ecf20Sopenharmony_ci#define AMLOGIC_FBC_OPTION_MEM_SAVING (1ULL << 0) 10698c2ecf20Sopenharmony_ci 10708c2ecf20Sopenharmony_ci#if defined(__cplusplus) 10718c2ecf20Sopenharmony_ci} 10728c2ecf20Sopenharmony_ci#endif 10738c2ecf20Sopenharmony_ci 10748c2ecf20Sopenharmony_ci#endif /* DRM_FOURCC_H */ 1075