drm_fourcc.h revision 53c12917
101e04c3fSmrg/* 201e04c3fSmrg * Copyright 2011 Intel Corporation 301e04c3fSmrg * 401e04c3fSmrg * Permission is hereby granted, free of charge, to any person obtaining a 501e04c3fSmrg * copy of this software and associated documentation files (the "Software"), 601e04c3fSmrg * to deal in the Software without restriction, including without limitation 701e04c3fSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 801e04c3fSmrg * and/or sell copies of the Software, and to permit persons to whom the 901e04c3fSmrg * Software is furnished to do so, subject to the following conditions: 1001e04c3fSmrg * 1101e04c3fSmrg * The above copyright notice and this permission notice (including the next 1201e04c3fSmrg * paragraph) shall be included in all copies or substantial portions of the 1301e04c3fSmrg * Software. 1401e04c3fSmrg * 1501e04c3fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1601e04c3fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1701e04c3fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1801e04c3fSmrg * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 1901e04c3fSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 2001e04c3fSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2101e04c3fSmrg * OTHER DEALINGS IN THE SOFTWARE. 2201e04c3fSmrg */ 2301e04c3fSmrg 2401e04c3fSmrg#ifndef DRM_FOURCC_H 2501e04c3fSmrg#define DRM_FOURCC_H 2601e04c3fSmrg 2701e04c3fSmrg#include "drm.h" 2801e04c3fSmrg 2901e04c3fSmrg#if defined(__cplusplus) 3001e04c3fSmrgextern "C" { 3101e04c3fSmrg#endif 3201e04c3fSmrg 3353c12917Smaya/** 3453c12917Smaya * DOC: overview 3553c12917Smaya * 3653c12917Smaya * In the DRM subsystem, framebuffer pixel formats are described using the 3753c12917Smaya * fourcc codes defined in `include/uapi/drm/drm_fourcc.h`. In addition to the 3853c12917Smaya * fourcc code, a Format Modifier may optionally be provided, in order to 3953c12917Smaya * further describe the buffer's format - for example tiling or compression. 4053c12917Smaya * 4153c12917Smaya * Format Modifiers 4253c12917Smaya * ---------------- 4353c12917Smaya * 4453c12917Smaya * Format modifiers are used in conjunction with a fourcc code, forming a 4553c12917Smaya * unique fourcc:modifier pair. This format:modifier pair must fully define the 4653c12917Smaya * format and data layout of the buffer, and should be the only way to describe 4753c12917Smaya * that particular buffer. 4853c12917Smaya * 4953c12917Smaya * Having multiple fourcc:modifier pairs which describe the same layout should 5053c12917Smaya * be avoided, as such aliases run the risk of different drivers exposing 5153c12917Smaya * different names for the same data format, forcing userspace to understand 5253c12917Smaya * that they are aliases. 5353c12917Smaya * 5453c12917Smaya * Format modifiers may change any property of the buffer, including the number 5553c12917Smaya * of planes and/or the required allocation size. Format modifiers are 5653c12917Smaya * vendor-namespaced, and as such the relationship between a fourcc code and a 5753c12917Smaya * modifier is specific to the modifer being used. For example, some modifiers 5853c12917Smaya * may preserve meaning - such as number of planes - from the fourcc code, 5953c12917Smaya * whereas others may not. 6053c12917Smaya * 6153c12917Smaya * Vendors should document their modifier usage in as much detail as 6253c12917Smaya * possible, to ensure maximum compatibility across devices, drivers and 6353c12917Smaya * applications. 6453c12917Smaya * 6553c12917Smaya * The authoritative list of format modifier codes is found in 6653c12917Smaya * `include/uapi/drm/drm_fourcc.h` 6753c12917Smaya */ 6853c12917Smaya 6901e04c3fSmrg#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \ 7001e04c3fSmrg ((__u32)(c) << 16) | ((__u32)(d) << 24)) 7101e04c3fSmrg 7201e04c3fSmrg#define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */ 7301e04c3fSmrg 7453c12917Smaya/* Reserve 0 for the invalid format specifier */ 7553c12917Smaya#define DRM_FORMAT_INVALID 0 7653c12917Smaya 7701e04c3fSmrg/* color index */ 7801e04c3fSmrg#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ 7901e04c3fSmrg 8001e04c3fSmrg/* 8 bpp Red */ 8101e04c3fSmrg#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */ 8201e04c3fSmrg 8301e04c3fSmrg/* 16 bpp Red */ 8401e04c3fSmrg#define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */ 8501e04c3fSmrg 8601e04c3fSmrg/* 16 bpp RG */ 8701e04c3fSmrg#define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */ 8801e04c3fSmrg#define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */ 8901e04c3fSmrg 9001e04c3fSmrg/* 32 bpp RG */ 9101e04c3fSmrg#define DRM_FORMAT_RG1616 fourcc_code('R', 'G', '3', '2') /* [31:0] R:G 16:16 little endian */ 9201e04c3fSmrg#define DRM_FORMAT_GR1616 fourcc_code('G', 'R', '3', '2') /* [31:0] G:R 16:16 little endian */ 9301e04c3fSmrg 9401e04c3fSmrg/* 8 bpp RGB */ 9501e04c3fSmrg#define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ 9601e04c3fSmrg#define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ 9701e04c3fSmrg 9801e04c3fSmrg/* 16 bpp RGB */ 9901e04c3fSmrg#define DRM_FORMAT_XRGB4444 fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */ 10001e04c3fSmrg#define DRM_FORMAT_XBGR4444 fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */ 10101e04c3fSmrg#define DRM_FORMAT_RGBX4444 fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */ 10201e04c3fSmrg#define DRM_FORMAT_BGRX4444 fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */ 10301e04c3fSmrg 10401e04c3fSmrg#define DRM_FORMAT_ARGB4444 fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */ 10501e04c3fSmrg#define DRM_FORMAT_ABGR4444 fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */ 10601e04c3fSmrg#define DRM_FORMAT_RGBA4444 fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */ 10701e04c3fSmrg#define DRM_FORMAT_BGRA4444 fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */ 10801e04c3fSmrg 10901e04c3fSmrg#define DRM_FORMAT_XRGB1555 fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */ 11001e04c3fSmrg#define DRM_FORMAT_XBGR1555 fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */ 11101e04c3fSmrg#define DRM_FORMAT_RGBX5551 fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */ 11201e04c3fSmrg#define DRM_FORMAT_BGRX5551 fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */ 11301e04c3fSmrg 11401e04c3fSmrg#define DRM_FORMAT_ARGB1555 fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */ 11501e04c3fSmrg#define DRM_FORMAT_ABGR1555 fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */ 11601e04c3fSmrg#define DRM_FORMAT_RGBA5551 fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */ 11701e04c3fSmrg#define DRM_FORMAT_BGRA5551 fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */ 11801e04c3fSmrg 11901e04c3fSmrg#define DRM_FORMAT_RGB565 fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */ 12001e04c3fSmrg#define DRM_FORMAT_BGR565 fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */ 12101e04c3fSmrg 12201e04c3fSmrg/* 24 bpp RGB */ 12301e04c3fSmrg#define DRM_FORMAT_RGB888 fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */ 12401e04c3fSmrg#define DRM_FORMAT_BGR888 fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */ 12501e04c3fSmrg 12601e04c3fSmrg/* 32 bpp RGB */ 12701e04c3fSmrg#define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */ 12801e04c3fSmrg#define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */ 12901e04c3fSmrg#define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */ 13001e04c3fSmrg#define DRM_FORMAT_BGRX8888 fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */ 13101e04c3fSmrg 13201e04c3fSmrg#define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */ 13301e04c3fSmrg#define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */ 13401e04c3fSmrg#define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */ 13501e04c3fSmrg#define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */ 13601e04c3fSmrg 13701e04c3fSmrg#define DRM_FORMAT_XRGB2101010 fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */ 13801e04c3fSmrg#define DRM_FORMAT_XBGR2101010 fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */ 13901e04c3fSmrg#define DRM_FORMAT_RGBX1010102 fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */ 14001e04c3fSmrg#define DRM_FORMAT_BGRX1010102 fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */ 14101e04c3fSmrg 14201e04c3fSmrg#define DRM_FORMAT_ARGB2101010 fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */ 14301e04c3fSmrg#define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */ 14401e04c3fSmrg#define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */ 14501e04c3fSmrg#define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */ 14601e04c3fSmrg 14701e04c3fSmrg/* packed YCbCr */ 14801e04c3fSmrg#define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */ 14901e04c3fSmrg#define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */ 15001e04c3fSmrg#define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */ 15101e04c3fSmrg#define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */ 15201e04c3fSmrg 15301e04c3fSmrg#define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ 15453c12917Smaya#define DRM_FORMAT_XYUV8888 fourcc_code('X', 'Y', 'U', 'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian */ 15553c12917Smaya 15653c12917Smaya/* 15753c12917Smaya * packed YCbCr420 2x2 tiled formats 15853c12917Smaya * first 64 bits will contain Y,Cb,Cr components for a 2x2 tile 15953c12917Smaya */ 16053c12917Smaya/* [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 */ 16153c12917Smaya#define DRM_FORMAT_Y0L0 fourcc_code('Y', '0', 'L', '0') 16253c12917Smaya/* [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 */ 16353c12917Smaya#define DRM_FORMAT_X0L0 fourcc_code('X', '0', 'L', '0') 16453c12917Smaya 16553c12917Smaya/* [63:0] A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian */ 16653c12917Smaya#define DRM_FORMAT_Y0L2 fourcc_code('Y', '0', 'L', '2') 16753c12917Smaya/* [63:0] X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian */ 16853c12917Smaya#define DRM_FORMAT_X0L2 fourcc_code('X', '0', 'L', '2') 16901e04c3fSmrg 17001e04c3fSmrg/* 17101e04c3fSmrg * 2 plane RGB + A 17201e04c3fSmrg * index 0 = RGB plane, same format as the corresponding non _A8 format has 17301e04c3fSmrg * index 1 = A plane, [7:0] A 17401e04c3fSmrg */ 17501e04c3fSmrg#define DRM_FORMAT_XRGB8888_A8 fourcc_code('X', 'R', 'A', '8') 17601e04c3fSmrg#define DRM_FORMAT_XBGR8888_A8 fourcc_code('X', 'B', 'A', '8') 17701e04c3fSmrg#define DRM_FORMAT_RGBX8888_A8 fourcc_code('R', 'X', 'A', '8') 17801e04c3fSmrg#define DRM_FORMAT_BGRX8888_A8 fourcc_code('B', 'X', 'A', '8') 17901e04c3fSmrg#define DRM_FORMAT_RGB888_A8 fourcc_code('R', '8', 'A', '8') 18001e04c3fSmrg#define DRM_FORMAT_BGR888_A8 fourcc_code('B', '8', 'A', '8') 18101e04c3fSmrg#define DRM_FORMAT_RGB565_A8 fourcc_code('R', '5', 'A', '8') 18201e04c3fSmrg#define DRM_FORMAT_BGR565_A8 fourcc_code('B', '5', 'A', '8') 18301e04c3fSmrg 18401e04c3fSmrg/* 18501e04c3fSmrg * 2 plane YCbCr 18601e04c3fSmrg * index 0 = Y plane, [7:0] Y 18701e04c3fSmrg * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian 18801e04c3fSmrg * or 18901e04c3fSmrg * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian 19001e04c3fSmrg */ 19101e04c3fSmrg#define DRM_FORMAT_NV12 fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */ 19201e04c3fSmrg#define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */ 19301e04c3fSmrg#define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ 19401e04c3fSmrg#define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ 19501e04c3fSmrg#define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */ 19601e04c3fSmrg#define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */ 19701e04c3fSmrg 19853c12917Smaya/* 19953c12917Smaya * 2 plane YCbCr MSB aligned 20053c12917Smaya * index 0 = Y plane, [15:0] Y:x [10:6] little endian 20153c12917Smaya * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian 20253c12917Smaya */ 20353c12917Smaya#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cr:Cb plane 10 bits per channel */ 20453c12917Smaya 20553c12917Smaya/* 20653c12917Smaya * 2 plane YCbCr MSB aligned 20753c12917Smaya * index 0 = Y plane, [15:0] Y:x [12:4] little endian 20853c12917Smaya * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [12:4:12:4] little endian 20953c12917Smaya */ 21053c12917Smaya#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cr:Cb plane 12 bits per channel */ 21153c12917Smaya 21253c12917Smaya/* 21353c12917Smaya * 2 plane YCbCr MSB aligned 21453c12917Smaya * index 0 = Y plane, [15:0] Y little endian 21553c12917Smaya * index 1 = Cr:Cb plane, [31:0] Cr:Cb [16:16] little endian 21653c12917Smaya */ 21753c12917Smaya#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */ 21853c12917Smaya 21901e04c3fSmrg/* 22001e04c3fSmrg * 3 plane YCbCr 22101e04c3fSmrg * index 0: Y plane, [7:0] Y 22201e04c3fSmrg * index 1: Cb plane, [7:0] Cb 22301e04c3fSmrg * index 2: Cr plane, [7:0] Cr 22401e04c3fSmrg * or 22501e04c3fSmrg * index 1: Cr plane, [7:0] Cr 22601e04c3fSmrg * index 2: Cb plane, [7:0] Cb 22701e04c3fSmrg */ 22801e04c3fSmrg#define DRM_FORMAT_YUV410 fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */ 22901e04c3fSmrg#define DRM_FORMAT_YVU410 fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */ 23001e04c3fSmrg#define DRM_FORMAT_YUV411 fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */ 23101e04c3fSmrg#define DRM_FORMAT_YVU411 fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */ 23201e04c3fSmrg#define DRM_FORMAT_YUV420 fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */ 23301e04c3fSmrg#define DRM_FORMAT_YVU420 fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */ 23401e04c3fSmrg#define DRM_FORMAT_YUV422 fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */ 23501e04c3fSmrg#define DRM_FORMAT_YVU422 fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */ 23601e04c3fSmrg#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ 23701e04c3fSmrg#define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ 23801e04c3fSmrg 23901e04c3fSmrg 24001e04c3fSmrg/* 24101e04c3fSmrg * Format Modifiers: 24201e04c3fSmrg * 24301e04c3fSmrg * Format modifiers describe, typically, a re-ordering or modification 24401e04c3fSmrg * of the data in a plane of an FB. This can be used to express tiled/ 24501e04c3fSmrg * swizzled formats, or compression, or a combination of the two. 24601e04c3fSmrg * 24701e04c3fSmrg * The upper 8 bits of the format modifier are a vendor-id as assigned 24801e04c3fSmrg * below. The lower 56 bits are assigned as vendor sees fit. 24901e04c3fSmrg */ 25001e04c3fSmrg 25101e04c3fSmrg/* Vendor Ids: */ 25201e04c3fSmrg#define DRM_FORMAT_MOD_NONE 0 25301e04c3fSmrg#define DRM_FORMAT_MOD_VENDOR_NONE 0 25401e04c3fSmrg#define DRM_FORMAT_MOD_VENDOR_INTEL 0x01 25501e04c3fSmrg#define DRM_FORMAT_MOD_VENDOR_AMD 0x02 25601e04c3fSmrg#define DRM_FORMAT_MOD_VENDOR_NVIDIA 0x03 25701e04c3fSmrg#define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 25801e04c3fSmrg#define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 25901e04c3fSmrg#define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06 26001e04c3fSmrg#define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07 26153c12917Smaya#define DRM_FORMAT_MOD_VENDOR_ARM 0x08 26253c12917Smaya#define DRM_FORMAT_MOD_VENDOR_ALLWINNER 0x09 26353c12917Smaya 26401e04c3fSmrg/* add more to the end as needed */ 26501e04c3fSmrg 26601e04c3fSmrg#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) 26701e04c3fSmrg 26801e04c3fSmrg#define fourcc_mod_code(vendor, val) \ 26901e04c3fSmrg ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL)) 27001e04c3fSmrg 27101e04c3fSmrg/* 27201e04c3fSmrg * Format Modifier tokens: 27301e04c3fSmrg * 27401e04c3fSmrg * When adding a new token please document the layout with a code comment, 27501e04c3fSmrg * similar to the fourcc codes above. drm_fourcc.h is considered the 27601e04c3fSmrg * authoritative source for all of these. 27701e04c3fSmrg */ 27801e04c3fSmrg 27901e04c3fSmrg/* 28001e04c3fSmrg * Invalid Modifier 28101e04c3fSmrg * 28201e04c3fSmrg * This modifier can be used as a sentinel to terminate the format modifiers 28301e04c3fSmrg * list, or to initialize a variable with an invalid modifier. It might also be 28401e04c3fSmrg * used to report an error back to userspace for certain APIs. 28501e04c3fSmrg */ 28601e04c3fSmrg#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED) 28701e04c3fSmrg 28801e04c3fSmrg/* 28901e04c3fSmrg * Linear Layout 29001e04c3fSmrg * 29101e04c3fSmrg * Just plain linear layout. Note that this is different from no specifying any 29201e04c3fSmrg * modifier (e.g. not setting DRM_MODE_FB_MODIFIERS in the DRM_ADDFB2 ioctl), 29301e04c3fSmrg * which tells the driver to also take driver-internal information into account 29401e04c3fSmrg * and so might actually result in a tiled framebuffer. 29501e04c3fSmrg */ 29601e04c3fSmrg#define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0) 29701e04c3fSmrg 29801e04c3fSmrg/* Intel framebuffer modifiers */ 29901e04c3fSmrg 30001e04c3fSmrg/* 30101e04c3fSmrg * Intel X-tiling layout 30201e04c3fSmrg * 30301e04c3fSmrg * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb) 30401e04c3fSmrg * in row-major layout. Within the tile bytes are laid out row-major, with 30501e04c3fSmrg * a platform-dependent stride. On top of that the memory can apply 30601e04c3fSmrg * platform-depending swizzling of some higher address bits into bit6. 30701e04c3fSmrg * 30801e04c3fSmrg * This format is highly platforms specific and not useful for cross-driver 30901e04c3fSmrg * sharing. It exists since on a given platform it does uniquely identify the 31001e04c3fSmrg * layout in a simple way for i915-specific userspace. 31101e04c3fSmrg */ 31201e04c3fSmrg#define I915_FORMAT_MOD_X_TILED fourcc_mod_code(INTEL, 1) 31301e04c3fSmrg 31401e04c3fSmrg/* 31501e04c3fSmrg * Intel Y-tiling layout 31601e04c3fSmrg * 31701e04c3fSmrg * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb) 31801e04c3fSmrg * in row-major layout. Within the tile bytes are laid out in OWORD (16 bytes) 31901e04c3fSmrg * chunks column-major, with a platform-dependent height. On top of that the 32001e04c3fSmrg * memory can apply platform-depending swizzling of some higher address bits 32101e04c3fSmrg * into bit6. 32201e04c3fSmrg * 32301e04c3fSmrg * This format is highly platforms specific and not useful for cross-driver 32401e04c3fSmrg * sharing. It exists since on a given platform it does uniquely identify the 32501e04c3fSmrg * layout in a simple way for i915-specific userspace. 32601e04c3fSmrg */ 32701e04c3fSmrg#define I915_FORMAT_MOD_Y_TILED fourcc_mod_code(INTEL, 2) 32801e04c3fSmrg 32901e04c3fSmrg/* 33001e04c3fSmrg * Intel Yf-tiling layout 33101e04c3fSmrg * 33201e04c3fSmrg * This is a tiled layout using 4Kb tiles in row-major layout. 33301e04c3fSmrg * Within the tile pixels are laid out in 16 256 byte units / sub-tiles which 33401e04c3fSmrg * are arranged in four groups (two wide, two high) with column-major layout. 33501e04c3fSmrg * Each group therefore consits out of four 256 byte units, which are also laid 33601e04c3fSmrg * out as 2x2 column-major. 33701e04c3fSmrg * 256 byte units are made out of four 64 byte blocks of pixels, producing 33801e04c3fSmrg * either a square block or a 2:1 unit. 33901e04c3fSmrg * 64 byte blocks of pixels contain four pixel rows of 16 bytes, where the width 34001e04c3fSmrg * in pixel depends on the pixel depth. 34101e04c3fSmrg */ 34201e04c3fSmrg#define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3) 34301e04c3fSmrg 34401e04c3fSmrg/* 34501e04c3fSmrg * Intel color control surface (CCS) for render compression 34601e04c3fSmrg * 34701e04c3fSmrg * The framebuffer format must be one of the 8:8:8:8 RGB formats. 34801e04c3fSmrg * The main surface will be plane index 0 and must be Y/Yf-tiled, 34901e04c3fSmrg * the CCS will be plane index 1. 35001e04c3fSmrg * 35101e04c3fSmrg * Each CCS tile matches a 1024x512 pixel area of the main surface. 35201e04c3fSmrg * To match certain aspects of the 3D hardware the CCS is 35301e04c3fSmrg * considered to be made up of normal 128Bx32 Y tiles, Thus 35401e04c3fSmrg * the CCS pitch must be specified in multiples of 128 bytes. 35501e04c3fSmrg * 35601e04c3fSmrg * In reality the CCS tile appears to be a 64Bx64 Y tile, composed 35701e04c3fSmrg * of QWORD (8 bytes) chunks instead of OWORD (16 bytes) chunks. 35801e04c3fSmrg * But that fact is not relevant unless the memory is accessed 35901e04c3fSmrg * directly. 36001e04c3fSmrg */ 36101e04c3fSmrg#define I915_FORMAT_MOD_Y_TILED_CCS fourcc_mod_code(INTEL, 4) 36201e04c3fSmrg#define I915_FORMAT_MOD_Yf_TILED_CCS fourcc_mod_code(INTEL, 5) 36301e04c3fSmrg 36401e04c3fSmrg/* 36501e04c3fSmrg * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks 36601e04c3fSmrg * 36701e04c3fSmrg * Macroblocks are laid in a Z-shape, and each pixel data is following the 36801e04c3fSmrg * standard NV12 style. 36901e04c3fSmrg * As for NV12, an image is the result of two frame buffers: one for Y, 37001e04c3fSmrg * one for the interleaved Cb/Cr components (1/2 the height of the Y buffer). 37101e04c3fSmrg * Alignment requirements are (for each buffer): 37201e04c3fSmrg * - multiple of 128 pixels for the width 37301e04c3fSmrg * - multiple of 32 pixels for the height 37401e04c3fSmrg * 37501e04c3fSmrg * For more information: see https://linuxtv.org/downloads/v4l-dvb-apis/re32.html 37601e04c3fSmrg */ 37701e04c3fSmrg#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) 37801e04c3fSmrg 37953c12917Smaya/* 38053c12917Smaya * Tiled, 16 (pixels) x 16 (lines) - sized macroblocks 38153c12917Smaya * 38253c12917Smaya * This is a simple tiled layout using tiles of 16x16 pixels in a row-major 38353c12917Smaya * layout. For YCbCr formats Cb/Cr components are taken in such a way that 38453c12917Smaya * they correspond to their 16x16 luma block. 38553c12917Smaya */ 38653c12917Smaya#define DRM_FORMAT_MOD_SAMSUNG_16_16_TILE fourcc_mod_code(SAMSUNG, 2) 38753c12917Smaya 38853c12917Smaya/* 38953c12917Smaya * Qualcomm Compressed Format 39053c12917Smaya * 39153c12917Smaya * Refers to a compressed variant of the base format that is compressed. 39253c12917Smaya * Implementation may be platform and base-format specific. 39353c12917Smaya * 39453c12917Smaya * Each macrotile consists of m x n (mostly 4 x 4) tiles. 39553c12917Smaya * Pixel data pitch/stride is aligned with macrotile width. 39653c12917Smaya * Pixel data height is aligned with macrotile height. 39753c12917Smaya * Entire pixel data buffer is aligned with 4k(bytes). 39853c12917Smaya */ 39953c12917Smaya#define DRM_FORMAT_MOD_QCOM_COMPRESSED fourcc_mod_code(QCOM, 1) 40053c12917Smaya 40101e04c3fSmrg/* Vivante framebuffer modifiers */ 40201e04c3fSmrg 40301e04c3fSmrg/* 40401e04c3fSmrg * Vivante 4x4 tiling layout 40501e04c3fSmrg * 40601e04c3fSmrg * This is a simple tiled layout using tiles of 4x4 pixels in a row-major 40701e04c3fSmrg * layout. 40801e04c3fSmrg */ 40901e04c3fSmrg#define DRM_FORMAT_MOD_VIVANTE_TILED fourcc_mod_code(VIVANTE, 1) 41001e04c3fSmrg 41101e04c3fSmrg/* 41201e04c3fSmrg * Vivante 64x64 super-tiling layout 41301e04c3fSmrg * 41401e04c3fSmrg * This is a tiled layout using 64x64 pixel super-tiles, where each super-tile 41501e04c3fSmrg * contains 8x4 groups of 2x4 tiles of 4x4 pixels (like above) each, all in row- 41601e04c3fSmrg * major layout. 41701e04c3fSmrg * 41801e04c3fSmrg * For more information: see 41901e04c3fSmrg * https://github.com/etnaviv/etna_viv/blob/master/doc/hardware.md#texture-tiling 42001e04c3fSmrg */ 42101e04c3fSmrg#define DRM_FORMAT_MOD_VIVANTE_SUPER_TILED fourcc_mod_code(VIVANTE, 2) 42201e04c3fSmrg 42301e04c3fSmrg/* 42401e04c3fSmrg * Vivante 4x4 tiling layout for dual-pipe 42501e04c3fSmrg * 42601e04c3fSmrg * Same as the 4x4 tiling layout, except every second 4x4 pixel tile starts at a 42701e04c3fSmrg * different base address. Offsets from the base addresses are therefore halved 42801e04c3fSmrg * compared to the non-split tiled layout. 42901e04c3fSmrg */ 43001e04c3fSmrg#define DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED fourcc_mod_code(VIVANTE, 3) 43101e04c3fSmrg 43201e04c3fSmrg/* 43301e04c3fSmrg * Vivante 64x64 super-tiling layout for dual-pipe 43401e04c3fSmrg * 43501e04c3fSmrg * Same as the 64x64 super-tiling layout, except every second 4x4 pixel tile 43601e04c3fSmrg * starts at a different base address. Offsets from the base addresses are 43701e04c3fSmrg * therefore halved compared to the non-split super-tiled layout. 43801e04c3fSmrg */ 43901e04c3fSmrg#define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4) 44001e04c3fSmrg 44101e04c3fSmrg/* NVIDIA frame buffer modifiers */ 44201e04c3fSmrg 44301e04c3fSmrg/* 44401e04c3fSmrg * Tegra Tiled Layout, used by Tegra 2, 3 and 4. 44501e04c3fSmrg * 44601e04c3fSmrg * Pixels are arranged in simple tiles of 16 x 16 bytes. 44701e04c3fSmrg */ 44801e04c3fSmrg#define DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED fourcc_mod_code(NVIDIA, 1) 44901e04c3fSmrg 45001e04c3fSmrg/* 45101e04c3fSmrg * 16Bx2 Block Linear layout, used by desktop GPUs, and Tegra K1 and later 45201e04c3fSmrg * 45301e04c3fSmrg * Pixels are arranged in 64x8 Groups Of Bytes (GOBs). GOBs are then stacked 45401e04c3fSmrg * vertically by a power of 2 (1 to 32 GOBs) to form a block. 45501e04c3fSmrg * 45601e04c3fSmrg * Within a GOB, data is ordered as 16B x 2 lines sectors laid in Z-shape. 45701e04c3fSmrg * 45801e04c3fSmrg * Parameter 'v' is the log2 encoding of the number of GOBs stacked vertically. 45901e04c3fSmrg * Valid values are: 46001e04c3fSmrg * 46101e04c3fSmrg * 0 == ONE_GOB 46201e04c3fSmrg * 1 == TWO_GOBS 46301e04c3fSmrg * 2 == FOUR_GOBS 46401e04c3fSmrg * 3 == EIGHT_GOBS 46501e04c3fSmrg * 4 == SIXTEEN_GOBS 46601e04c3fSmrg * 5 == THIRTYTWO_GOBS 46701e04c3fSmrg * 46801e04c3fSmrg * Chapter 20 "Pixel Memory Formats" of the Tegra X1 TRM describes this format 46901e04c3fSmrg * in full detail. 47001e04c3fSmrg */ 47101e04c3fSmrg#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(v) \ 47201e04c3fSmrg fourcc_mod_code(NVIDIA, 0x10 | ((v) & 0xf)) 47301e04c3fSmrg 47401e04c3fSmrg#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB \ 47501e04c3fSmrg fourcc_mod_code(NVIDIA, 0x10) 47601e04c3fSmrg#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB \ 47701e04c3fSmrg fourcc_mod_code(NVIDIA, 0x11) 47801e04c3fSmrg#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB \ 47901e04c3fSmrg fourcc_mod_code(NVIDIA, 0x12) 48001e04c3fSmrg#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB \ 48101e04c3fSmrg fourcc_mod_code(NVIDIA, 0x13) 48201e04c3fSmrg#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB \ 48301e04c3fSmrg fourcc_mod_code(NVIDIA, 0x14) 48401e04c3fSmrg#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB \ 48501e04c3fSmrg fourcc_mod_code(NVIDIA, 0x15) 48601e04c3fSmrg 48701e04c3fSmrg/* 48801e04c3fSmrg * Some Broadcom modifiers take parameters, for example the number of 48901e04c3fSmrg * vertical lines in the image. Reserve the lower 32 bits for modifier 49001e04c3fSmrg * type, and the next 24 bits for parameters. Top 8 bits are the 49101e04c3fSmrg * vendor code. 49201e04c3fSmrg */ 49301e04c3fSmrg#define __fourcc_mod_broadcom_param_shift 8 49401e04c3fSmrg#define __fourcc_mod_broadcom_param_bits 48 49501e04c3fSmrg#define fourcc_mod_broadcom_code(val, params) \ 49601e04c3fSmrg fourcc_mod_code(BROADCOM, ((((__u64)params) << __fourcc_mod_broadcom_param_shift) | val)) 49701e04c3fSmrg#define fourcc_mod_broadcom_param(m) \ 49801e04c3fSmrg ((int)(((m) >> __fourcc_mod_broadcom_param_shift) & \ 49901e04c3fSmrg ((1ULL << __fourcc_mod_broadcom_param_bits) - 1))) 50001e04c3fSmrg#define fourcc_mod_broadcom_mod(m) \ 50101e04c3fSmrg ((m) & ~(((1ULL << __fourcc_mod_broadcom_param_bits) - 1) << \ 50201e04c3fSmrg __fourcc_mod_broadcom_param_shift)) 50301e04c3fSmrg 50401e04c3fSmrg/* 50501e04c3fSmrg * Broadcom VC4 "T" format 50601e04c3fSmrg * 50701e04c3fSmrg * This is the primary layout that the V3D GPU can texture from (it 50801e04c3fSmrg * can't do linear). The T format has: 50901e04c3fSmrg * 51001e04c3fSmrg * - 64b utiles of pixels in a raster-order grid according to cpp. It's 4x4 51101e04c3fSmrg * pixels at 32 bit depth. 51201e04c3fSmrg * 51301e04c3fSmrg * - 1k subtiles made of a 4x4 raster-order grid of 64b utiles (so usually 51401e04c3fSmrg * 16x16 pixels). 51501e04c3fSmrg * 51601e04c3fSmrg * - 4k tiles made of a 2x2 grid of 1k subtiles (so usually 32x32 pixels). On 51701e04c3fSmrg * even 4k tile rows, they're arranged as (BL, TL, TR, BR), and on odd rows 51801e04c3fSmrg * they're (TR, BR, BL, TL), where bottom left is start of memory. 51901e04c3fSmrg * 52001e04c3fSmrg * - an image made of 4k tiles in rows either left-to-right (even rows of 4k 52101e04c3fSmrg * tiles) or right-to-left (odd rows of 4k tiles). 52201e04c3fSmrg */ 52301e04c3fSmrg#define DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED fourcc_mod_code(BROADCOM, 1) 52401e04c3fSmrg 52501e04c3fSmrg/* 52601e04c3fSmrg * Broadcom SAND format 52701e04c3fSmrg * 52801e04c3fSmrg * This is the native format that the H.264 codec block uses. For VC4 52901e04c3fSmrg * HVS, it is only valid for H.264 (NV12/21) and RGBA modes. 53001e04c3fSmrg * 53101e04c3fSmrg * The image can be considered to be split into columns, and the 53201e04c3fSmrg * columns are placed consecutively into memory. The width of those 53301e04c3fSmrg * columns can be either 32, 64, 128, or 256 pixels, but in practice 53401e04c3fSmrg * only 128 pixel columns are used. 53501e04c3fSmrg * 53601e04c3fSmrg * The pitch between the start of each column is set to optimally 53701e04c3fSmrg * switch between SDRAM banks. This is passed as the number of lines 53801e04c3fSmrg * of column width in the modifier (we can't use the stride value due 53901e04c3fSmrg * to various core checks that look at it , so you should set the 54001e04c3fSmrg * stride to width*cpp). 54101e04c3fSmrg * 54201e04c3fSmrg * Note that the column height for this format modifier is the same 54301e04c3fSmrg * for all of the planes, assuming that each column contains both Y 54401e04c3fSmrg * and UV. Some SAND-using hardware stores UV in a separate tiled 54501e04c3fSmrg * image from Y to reduce the column height, which is not supported 54601e04c3fSmrg * with these modifiers. 54701e04c3fSmrg */ 54801e04c3fSmrg 54901e04c3fSmrg#define DRM_FORMAT_MOD_BROADCOM_SAND32_COL_HEIGHT(v) \ 55001e04c3fSmrg fourcc_mod_broadcom_code(2, v) 55101e04c3fSmrg#define DRM_FORMAT_MOD_BROADCOM_SAND64_COL_HEIGHT(v) \ 55201e04c3fSmrg fourcc_mod_broadcom_code(3, v) 55301e04c3fSmrg#define DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT(v) \ 55401e04c3fSmrg fourcc_mod_broadcom_code(4, v) 55501e04c3fSmrg#define DRM_FORMAT_MOD_BROADCOM_SAND256_COL_HEIGHT(v) \ 55601e04c3fSmrg fourcc_mod_broadcom_code(5, v) 55701e04c3fSmrg 55801e04c3fSmrg#define DRM_FORMAT_MOD_BROADCOM_SAND32 \ 55901e04c3fSmrg DRM_FORMAT_MOD_BROADCOM_SAND32_COL_HEIGHT(0) 56001e04c3fSmrg#define DRM_FORMAT_MOD_BROADCOM_SAND64 \ 56101e04c3fSmrg DRM_FORMAT_MOD_BROADCOM_SAND64_COL_HEIGHT(0) 56201e04c3fSmrg#define DRM_FORMAT_MOD_BROADCOM_SAND128 \ 56301e04c3fSmrg DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT(0) 56401e04c3fSmrg#define DRM_FORMAT_MOD_BROADCOM_SAND256 \ 56501e04c3fSmrg DRM_FORMAT_MOD_BROADCOM_SAND256_COL_HEIGHT(0) 56601e04c3fSmrg 56701e04c3fSmrg/* Broadcom UIF format 56801e04c3fSmrg * 56901e04c3fSmrg * This is the common format for the current Broadcom multimedia 57001e04c3fSmrg * blocks, including V3D 3.x and newer, newer video codecs, and 57101e04c3fSmrg * displays. 57201e04c3fSmrg * 57301e04c3fSmrg * The image consists of utiles (64b blocks), UIF blocks (2x2 utiles), 57401e04c3fSmrg * and macroblocks (4x4 UIF blocks). Those 4x4 UIF block groups are 57501e04c3fSmrg * stored in columns, with padding between the columns to ensure that 57601e04c3fSmrg * moving from one column to the next doesn't hit the same SDRAM page 57701e04c3fSmrg * bank. 57801e04c3fSmrg * 57901e04c3fSmrg * To calculate the padding, it is assumed that each hardware block 58001e04c3fSmrg * and the software driving it knows the platform's SDRAM page size, 58101e04c3fSmrg * number of banks, and XOR address, and that it's identical between 58201e04c3fSmrg * all blocks using the format. This tiling modifier will use XOR as 58301e04c3fSmrg * necessary to reduce the padding. If a hardware block can't do XOR, 58401e04c3fSmrg * the assumption is that a no-XOR tiling modifier will be created. 58501e04c3fSmrg */ 58601e04c3fSmrg#define DRM_FORMAT_MOD_BROADCOM_UIF fourcc_mod_code(BROADCOM, 6) 58701e04c3fSmrg 58853c12917Smaya/* 58953c12917Smaya * Arm Framebuffer Compression (AFBC) modifiers 59053c12917Smaya * 59153c12917Smaya * AFBC is a proprietary lossless image compression protocol and format. 59253c12917Smaya * It provides fine-grained random access and minimizes the amount of data 59353c12917Smaya * transferred between IP blocks. 59453c12917Smaya * 59553c12917Smaya * AFBC has several features which may be supported and/or used, which are 59653c12917Smaya * represented using bits in the modifier. Not all combinations are valid, 59753c12917Smaya * and different devices or use-cases may support different combinations. 59853c12917Smaya * 59953c12917Smaya * Further information on the use of AFBC modifiers can be found in 60053c12917Smaya * Documentation/gpu/afbc.rst 60153c12917Smaya */ 60253c12917Smaya#define DRM_FORMAT_MOD_ARM_AFBC(__afbc_mode) fourcc_mod_code(ARM, __afbc_mode) 60353c12917Smaya 60453c12917Smaya/* 60553c12917Smaya * AFBC superblock size 60653c12917Smaya * 60753c12917Smaya * Indicates the superblock size(s) used for the AFBC buffer. The buffer 60853c12917Smaya * size (in pixels) must be aligned to a multiple of the superblock size. 60953c12917Smaya * Four lowest significant bits(LSBs) are reserved for block size. 61053c12917Smaya * 61153c12917Smaya * Where one superblock size is specified, it applies to all planes of the 61253c12917Smaya * buffer (e.g. 16x16, 32x8). When multiple superblock sizes are specified, 61353c12917Smaya * the first applies to the Luma plane and the second applies to the Chroma 61453c12917Smaya * plane(s). e.g. (32x8_64x4 means 32x8 Luma, with 64x4 Chroma). 61553c12917Smaya * Multiple superblock sizes are only valid for multi-plane YCbCr formats. 61653c12917Smaya */ 61753c12917Smaya#define AFBC_FORMAT_MOD_BLOCK_SIZE_MASK 0xf 61853c12917Smaya#define AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 (1ULL) 61953c12917Smaya#define AFBC_FORMAT_MOD_BLOCK_SIZE_32x8 (2ULL) 62053c12917Smaya#define AFBC_FORMAT_MOD_BLOCK_SIZE_64x4 (3ULL) 62153c12917Smaya#define AFBC_FORMAT_MOD_BLOCK_SIZE_32x8_64x4 (4ULL) 62253c12917Smaya 62353c12917Smaya/* 62453c12917Smaya * AFBC lossless colorspace transform 62553c12917Smaya * 62653c12917Smaya * Indicates that the buffer makes use of the AFBC lossless colorspace 62753c12917Smaya * transform. 62853c12917Smaya */ 62953c12917Smaya#define AFBC_FORMAT_MOD_YTR (1ULL << 4) 63053c12917Smaya 63153c12917Smaya/* 63253c12917Smaya * AFBC block-split 63353c12917Smaya * 63453c12917Smaya * Indicates that the payload of each superblock is split. The second 63553c12917Smaya * half of the payload is positioned at a predefined offset from the start 63653c12917Smaya * of the superblock payload. 63753c12917Smaya */ 63853c12917Smaya#define AFBC_FORMAT_MOD_SPLIT (1ULL << 5) 63953c12917Smaya 64053c12917Smaya/* 64153c12917Smaya * AFBC sparse layout 64253c12917Smaya * 64353c12917Smaya * This flag indicates that the payload of each superblock must be stored at a 64453c12917Smaya * predefined position relative to the other superblocks in the same AFBC 64553c12917Smaya * buffer. This order is the same order used by the header buffer. In this mode 64653c12917Smaya * each superblock is given the same amount of space as an uncompressed 64753c12917Smaya * superblock of the particular format would require, rounding up to the next 64853c12917Smaya * multiple of 128 bytes in size. 64953c12917Smaya */ 65053c12917Smaya#define AFBC_FORMAT_MOD_SPARSE (1ULL << 6) 65153c12917Smaya 65253c12917Smaya/* 65353c12917Smaya * AFBC copy-block restrict 65453c12917Smaya * 65553c12917Smaya * Buffers with this flag must obey the copy-block restriction. The restriction 65653c12917Smaya * is such that there are no copy-blocks referring across the border of 8x8 65753c12917Smaya * blocks. For the subsampled data the 8x8 limitation is also subsampled. 65853c12917Smaya */ 65953c12917Smaya#define AFBC_FORMAT_MOD_CBR (1ULL << 7) 66053c12917Smaya 66153c12917Smaya/* 66253c12917Smaya * AFBC tiled layout 66353c12917Smaya * 66453c12917Smaya * The tiled layout groups superblocks in 8x8 or 4x4 tiles, where all 66553c12917Smaya * superblocks inside a tile are stored together in memory. 8x8 tiles are used 66653c12917Smaya * for pixel formats up to and including 32 bpp while 4x4 tiles are used for 66753c12917Smaya * larger bpp formats. The order between the tiles is scan line. 66853c12917Smaya * When the tiled layout is used, the buffer size (in pixels) must be aligned 66953c12917Smaya * to the tile size. 67053c12917Smaya */ 67153c12917Smaya#define AFBC_FORMAT_MOD_TILED (1ULL << 8) 67253c12917Smaya 67353c12917Smaya/* 67453c12917Smaya * AFBC solid color blocks 67553c12917Smaya * 67653c12917Smaya * Indicates that the buffer makes use of solid-color blocks, whereby bandwidth 67753c12917Smaya * can be reduced if a whole superblock is a single color. 67853c12917Smaya */ 67953c12917Smaya#define AFBC_FORMAT_MOD_SC (1ULL << 9) 68053c12917Smaya 68153c12917Smaya/* 68253c12917Smaya * AFBC double-buffer 68353c12917Smaya * 68453c12917Smaya * Indicates that the buffer is allocated in a layout safe for front-buffer 68553c12917Smaya * rendering. 68653c12917Smaya */ 68753c12917Smaya#define AFBC_FORMAT_MOD_DB (1ULL << 10) 68853c12917Smaya 68953c12917Smaya/* 69053c12917Smaya * AFBC buffer content hints 69153c12917Smaya * 69253c12917Smaya * Indicates that the buffer includes per-superblock content hints. 69353c12917Smaya */ 69453c12917Smaya#define AFBC_FORMAT_MOD_BCH (1ULL << 11) 69553c12917Smaya 69653c12917Smaya/* 69753c12917Smaya * Allwinner tiled modifier 69853c12917Smaya * 69953c12917Smaya * This tiling mode is implemented by the VPU found on all Allwinner platforms, 70053c12917Smaya * codenamed sunxi. It is associated with a YUV format that uses either 2 or 3 70153c12917Smaya * planes. 70253c12917Smaya * 70353c12917Smaya * With this tiling, the luminance samples are disposed in tiles representing 70453c12917Smaya * 32x32 pixels and the chrominance samples in tiles representing 32x64 pixels. 70553c12917Smaya * The pixel order in each tile is linear and the tiles are disposed linearly, 70653c12917Smaya * both in row-major order. 70753c12917Smaya */ 70853c12917Smaya#define DRM_FORMAT_MOD_ALLWINNER_TILED fourcc_mod_code(ALLWINNER, 1) 70953c12917Smaya 71001e04c3fSmrg#if defined(__cplusplus) 71101e04c3fSmrg} 71201e04c3fSmrg#endif 71301e04c3fSmrg 71401e04c3fSmrg#endif /* DRM_FOURCC_H */ 715