169b9a
From c1da33afa02ed4978c34f16ec56d60dbfa5ac2c0 Mon Sep 17 00:00:00 2001
169b9a
From: Tarun Gupta <tgupta@redhat.com>
169b9a
Date: Wed, 20 Jun 2018 18:54:15 +0200
169b9a
Subject: [PATCH 07/17] headers: add drm_fourcc.h
169b9a
169b9a
RH-Author: Tarun Gupta <tgupta@redhat.com>
169b9a
Message-id: <1529520865-18127-2-git-send-email-tgupta@redhat.com>
169b9a
Patchwork-id: 80909
169b9a
O-Subject: [RHEL7.6 qemu-kvm PATCH v3 01/11] headers: add drm_fourcc.h
169b9a
Bugzilla: 1555246
169b9a
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
169b9a
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
169b9a
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
169b9a
169b9a
So we can use the drm fourcc codes without a dependency on libdrm-devel.
169b9a
169b9a
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
169b9a
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
169b9a
169b9a
(cherry picked from 8e8ee8509a0d2d5a65d7533e6e9179b6f3b0a0d4)
169b9a
169b9a
Conflict: qemu-kvm does not have the standard-headers directory.
169b9a
So, adding the drm_fourcc.h in include/ directory.
169b9a
169b9a
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
169b9a
---
169b9a
 include/drm_fourcc.h | 411 +++++++++++++++++++++++++++++++++++++++++++++++++++
169b9a
 1 file changed, 411 insertions(+)
169b9a
 create mode 100644 include/drm_fourcc.h
169b9a
169b9a
diff --git a/include/drm_fourcc.h b/include/drm_fourcc.h
169b9a
new file mode 100644
169b9a
index 0000000..11912fd
169b9a
--- /dev/null
169b9a
+++ b/include/drm_fourcc.h
169b9a
@@ -0,0 +1,411 @@
169b9a
+/*
169b9a
+ * Copyright 2011 Intel Corporation
169b9a
+ *
169b9a
+ * Permission is hereby granted, free of charge, to any person obtaining a
169b9a
+ * copy of this software and associated documentation files (the "Software"),
169b9a
+ * to deal in the Software without restriction, including without limitation
169b9a
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
169b9a
+ * and/or sell copies of the Software, and to permit persons to whom the
169b9a
+ * Software is furnished to do so, subject to the following conditions:
169b9a
+ *
169b9a
+ * The above copyright notice and this permission notice (including the next
169b9a
+ * paragraph) shall be included in all copies or substantial portions of the
169b9a
+ * Software.
169b9a
+ *
169b9a
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
169b9a
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
169b9a
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
169b9a
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
169b9a
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
169b9a
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
169b9a
+ * OTHER DEALINGS IN THE SOFTWARE.
169b9a
+ */
169b9a
+
169b9a
+#ifndef DRM_FOURCC_H
169b9a
+#define DRM_FOURCC_H
169b9a
+
169b9a
+
169b9a
+#if defined(__cplusplus)
169b9a
+extern "C" {
169b9a
+#endif
169b9a
+
169b9a
+#define fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
169b9a
+				 ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
169b9a
+
169b9a
+#define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */
169b9a
+
169b9a
+/* color index */
169b9a
+#define DRM_FORMAT_C8		fourcc_code('C', '8', ' ', ' ') /* [7:0] C */
169b9a
+
169b9a
+/* 8 bpp Red */
169b9a
+#define DRM_FORMAT_R8		fourcc_code('R', '8', ' ', ' ') /* [7:0] R */
169b9a
+
169b9a
+/* 16 bpp Red */
169b9a
+#define DRM_FORMAT_R16		fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */
169b9a
+
169b9a
+/* 16 bpp RG */
169b9a
+#define DRM_FORMAT_RG88		fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */
169b9a
+#define DRM_FORMAT_GR88		fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */
169b9a
+
169b9a
+/* 32 bpp RG */
169b9a
+#define DRM_FORMAT_RG1616	fourcc_code('R', 'G', '3', '2') /* [31:0] R:G 16:16 little endian */
169b9a
+#define DRM_FORMAT_GR1616	fourcc_code('G', 'R', '3', '2') /* [31:0] G:R 16:16 little endian */
169b9a
+
169b9a
+/* 8 bpp RGB */
169b9a
+#define DRM_FORMAT_RGB332	fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */
169b9a
+#define DRM_FORMAT_BGR233	fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */
169b9a
+
169b9a
+/* 16 bpp RGB */
169b9a
+#define DRM_FORMAT_XRGB4444	fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */
169b9a
+#define DRM_FORMAT_XBGR4444	fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */
169b9a
+#define DRM_FORMAT_RGBX4444	fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */
169b9a
+#define DRM_FORMAT_BGRX4444	fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */
169b9a
+
169b9a
+#define DRM_FORMAT_ARGB4444	fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */
169b9a
+#define DRM_FORMAT_ABGR4444	fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */
169b9a
+#define DRM_FORMAT_RGBA4444	fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */
169b9a
+#define DRM_FORMAT_BGRA4444	fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */
169b9a
+
169b9a
+#define DRM_FORMAT_XRGB1555	fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */
169b9a
+#define DRM_FORMAT_XBGR1555	fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */
169b9a
+#define DRM_FORMAT_RGBX5551	fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */
169b9a
+#define DRM_FORMAT_BGRX5551	fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */
169b9a
+
169b9a
+#define DRM_FORMAT_ARGB1555	fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */
169b9a
+#define DRM_FORMAT_ABGR1555	fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */
169b9a
+#define DRM_FORMAT_RGBA5551	fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */
169b9a
+#define DRM_FORMAT_BGRA5551	fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */
169b9a
+
169b9a
+#define DRM_FORMAT_RGB565	fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */
169b9a
+#define DRM_FORMAT_BGR565	fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */
169b9a
+
169b9a
+/* 24 bpp RGB */
169b9a
+#define DRM_FORMAT_RGB888	fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */
169b9a
+#define DRM_FORMAT_BGR888	fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */
169b9a
+
169b9a
+/* 32 bpp RGB */
169b9a
+#define DRM_FORMAT_XRGB8888	fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */
169b9a
+#define DRM_FORMAT_XBGR8888	fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */
169b9a
+#define DRM_FORMAT_RGBX8888	fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */
169b9a
+#define DRM_FORMAT_BGRX8888	fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */
169b9a
+
169b9a
+#define DRM_FORMAT_ARGB8888	fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */
169b9a
+#define DRM_FORMAT_ABGR8888	fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */
169b9a
+#define DRM_FORMAT_RGBA8888	fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */
169b9a
+#define DRM_FORMAT_BGRA8888	fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */
169b9a
+
169b9a
+#define DRM_FORMAT_XRGB2101010	fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */
169b9a
+#define DRM_FORMAT_XBGR2101010	fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */
169b9a
+#define DRM_FORMAT_RGBX1010102	fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */
169b9a
+#define DRM_FORMAT_BGRX1010102	fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */
169b9a
+
169b9a
+#define DRM_FORMAT_ARGB2101010	fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */
169b9a
+#define DRM_FORMAT_ABGR2101010	fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */
169b9a
+#define DRM_FORMAT_RGBA1010102	fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */
169b9a
+#define DRM_FORMAT_BGRA1010102	fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */
169b9a
+
169b9a
+/* packed YCbCr */
169b9a
+#define DRM_FORMAT_YUYV		fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */
169b9a
+#define DRM_FORMAT_YVYU		fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */
169b9a
+#define DRM_FORMAT_UYVY		fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */
169b9a
+#define DRM_FORMAT_VYUY		fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
169b9a
+
169b9a
+#define DRM_FORMAT_AYUV		fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
169b9a
+
169b9a
+/*
169b9a
+ * 2 plane RGB + A
169b9a
+ * index 0 = RGB plane, same format as the corresponding non _A8 format has
169b9a
+ * index 1 = A plane, [7:0] A
169b9a
+ */
169b9a
+#define DRM_FORMAT_XRGB8888_A8	fourcc_code('X', 'R', 'A', '8')
169b9a
+#define DRM_FORMAT_XBGR8888_A8	fourcc_code('X', 'B', 'A', '8')
169b9a
+#define DRM_FORMAT_RGBX8888_A8	fourcc_code('R', 'X', 'A', '8')
169b9a
+#define DRM_FORMAT_BGRX8888_A8	fourcc_code('B', 'X', 'A', '8')
169b9a
+#define DRM_FORMAT_RGB888_A8	fourcc_code('R', '8', 'A', '8')
169b9a
+#define DRM_FORMAT_BGR888_A8	fourcc_code('B', '8', 'A', '8')
169b9a
+#define DRM_FORMAT_RGB565_A8	fourcc_code('R', '5', 'A', '8')
169b9a
+#define DRM_FORMAT_BGR565_A8	fourcc_code('B', '5', 'A', '8')
169b9a
+
169b9a
+/*
169b9a
+ * 2 plane YCbCr
169b9a
+ * index 0 = Y plane, [7:0] Y
169b9a
+ * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
169b9a
+ * or
169b9a
+ * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
169b9a
+ */
169b9a
+#define DRM_FORMAT_NV12		fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */
169b9a
+#define DRM_FORMAT_NV21		fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */
169b9a
+#define DRM_FORMAT_NV16		fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */
169b9a
+#define DRM_FORMAT_NV61		fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */
169b9a
+#define DRM_FORMAT_NV24		fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */
169b9a
+#define DRM_FORMAT_NV42		fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
169b9a
+
169b9a
+/*
169b9a
+ * 3 plane YCbCr
169b9a
+ * index 0: Y plane, [7:0] Y
169b9a
+ * index 1: Cb plane, [7:0] Cb
169b9a
+ * index 2: Cr plane, [7:0] Cr
169b9a
+ * or
169b9a
+ * index 1: Cr plane, [7:0] Cr
169b9a
+ * index 2: Cb plane, [7:0] Cb
169b9a
+ */
169b9a
+#define DRM_FORMAT_YUV410	fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */
169b9a
+#define DRM_FORMAT_YVU410	fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */
169b9a
+#define DRM_FORMAT_YUV411	fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */
169b9a
+#define DRM_FORMAT_YVU411	fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */
169b9a
+#define DRM_FORMAT_YUV420	fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */
169b9a
+#define DRM_FORMAT_YVU420	fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */
169b9a
+#define DRM_FORMAT_YUV422	fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */
169b9a
+#define DRM_FORMAT_YVU422	fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */
169b9a
+#define DRM_FORMAT_YUV444	fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */
169b9a
+#define DRM_FORMAT_YVU444	fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
169b9a
+
169b9a
+
169b9a
+/*
169b9a
+ * Format Modifiers:
169b9a
+ *
169b9a
+ * Format modifiers describe, typically, a re-ordering or modification
169b9a
+ * of the data in a plane of an FB.  This can be used to express tiled/
169b9a
+ * swizzled formats, or compression, or a combination of the two.
169b9a
+ *
169b9a
+ * The upper 8 bits of the format modifier are a vendor-id as assigned
169b9a
+ * below.  The lower 56 bits are assigned as vendor sees fit.
169b9a
+ */
169b9a
+
169b9a
+/* Vendor Ids: */
169b9a
+#define DRM_FORMAT_MOD_NONE           0
169b9a
+#define DRM_FORMAT_MOD_VENDOR_NONE    0
169b9a
+#define DRM_FORMAT_MOD_VENDOR_INTEL   0x01
169b9a
+#define DRM_FORMAT_MOD_VENDOR_AMD     0x02
169b9a
+#define DRM_FORMAT_MOD_VENDOR_NVIDIA  0x03
169b9a
+#define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04
169b9a
+#define DRM_FORMAT_MOD_VENDOR_QCOM    0x05
169b9a
+#define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06
169b9a
+#define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07
169b9a
+/* add more to the end as needed */
169b9a
+
169b9a
+#define DRM_FORMAT_RESERVED	      ((1ULL << 56) - 1)
169b9a
+
169b9a
+#define fourcc_mod_code(vendor, val) \
169b9a
+	((((uint64_t)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL))
169b9a
+
169b9a
+/*
169b9a
+ * Format Modifier tokens:
169b9a
+ *
169b9a
+ * When adding a new token please document the layout with a code comment,
169b9a
+ * similar to the fourcc codes above. drm_fourcc.h is considered the
169b9a
+ * authoritative source for all of these.
169b9a
+ */
169b9a
+
169b9a
+/*
169b9a
+ * Invalid Modifier
169b9a
+ *
169b9a
+ * This modifier can be used as a sentinel to terminate the format modifiers
169b9a
+ * list, or to initialize a variable with an invalid modifier. It might also be
169b9a
+ * used to report an error back to userspace for certain APIs.
169b9a
+ */
169b9a
+#define DRM_FORMAT_MOD_INVALID	fourcc_mod_code(NONE, DRM_FORMAT_RESERVED)
169b9a
+
169b9a
+/*
169b9a
+ * Linear Layout
169b9a
+ *
169b9a
+ * Just plain linear layout. Note that this is different from no specifying any
169b9a
+ * modifier (e.g. not setting DRM_MODE_FB_MODIFIERS in the DRM_ADDFB2 ioctl),
169b9a
+ * which tells the driver to also take driver-internal information into account
169b9a
+ * and so might actually result in a tiled framebuffer.
169b9a
+ */
169b9a
+#define DRM_FORMAT_MOD_LINEAR	fourcc_mod_code(NONE, 0)
169b9a
+
169b9a
+/* Intel framebuffer modifiers */
169b9a
+
169b9a
+/*
169b9a
+ * Intel X-tiling layout
169b9a
+ *
169b9a
+ * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb)
169b9a
+ * in row-major layout. Within the tile bytes are laid out row-major, with
169b9a
+ * a platform-dependent stride. On top of that the memory can apply
169b9a
+ * platform-depending swizzling of some higher address bits into bit6.
169b9a
+ *
169b9a
+ * This format is highly platforms specific and not useful for cross-driver
169b9a
+ * sharing. It exists since on a given platform it does uniquely identify the
169b9a
+ * layout in a simple way for i915-specific userspace.
169b9a
+ */
169b9a
+#define I915_FORMAT_MOD_X_TILED	fourcc_mod_code(INTEL, 1)
169b9a
+
169b9a
+/*
169b9a
+ * Intel Y-tiling layout
169b9a
+ *
169b9a
+ * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb)
169b9a
+ * in row-major layout. Within the tile bytes are laid out in OWORD (16 bytes)
169b9a
+ * chunks column-major, with a platform-dependent height. On top of that the
169b9a
+ * memory can apply platform-depending swizzling of some higher address bits
169b9a
+ * into bit6.
169b9a
+ *
169b9a
+ * This format is highly platforms specific and not useful for cross-driver
169b9a
+ * sharing. It exists since on a given platform it does uniquely identify the
169b9a
+ * layout in a simple way for i915-specific userspace.
169b9a
+ */
169b9a
+#define I915_FORMAT_MOD_Y_TILED	fourcc_mod_code(INTEL, 2)
169b9a
+
169b9a
+/*
169b9a
+ * Intel Yf-tiling layout
169b9a
+ *
169b9a
+ * This is a tiled layout using 4Kb tiles in row-major layout.
169b9a
+ * Within the tile pixels are laid out in 16 256 byte units / sub-tiles which
169b9a
+ * are arranged in four groups (two wide, two high) with column-major layout.
169b9a
+ * Each group therefore consits out of four 256 byte units, which are also laid
169b9a
+ * out as 2x2 column-major.
169b9a
+ * 256 byte units are made out of four 64 byte blocks of pixels, producing
169b9a
+ * either a square block or a 2:1 unit.
169b9a
+ * 64 byte blocks of pixels contain four pixel rows of 16 bytes, where the width
169b9a
+ * in pixel depends on the pixel depth.
169b9a
+ */
169b9a
+#define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3)
169b9a
+
169b9a
+/*
169b9a
+ * Intel color control surface (CCS) for render compression
169b9a
+ *
169b9a
+ * The framebuffer format must be one of the 8:8:8:8 RGB formats.
169b9a
+ * The main surface will be plane index 0 and must be Y/Yf-tiled,
169b9a
+ * the CCS will be plane index 1.
169b9a
+ *
169b9a
+ * Each CCS tile matches a 1024x512 pixel area of the main surface.
169b9a
+ * To match certain aspects of the 3D hardware the CCS is
169b9a
+ * considered to be made up of normal 128Bx32 Y tiles, Thus
169b9a
+ * the CCS pitch must be specified in multiples of 128 bytes.
169b9a
+ *
169b9a
+ * In reality the CCS tile appears to be a 64Bx64 Y tile, composed
169b9a
+ * of QWORD (8 bytes) chunks instead of OWORD (16 bytes) chunks.
169b9a
+ * But that fact is not relevant unless the memory is accessed
169b9a
+ * directly.
169b9a
+ */
169b9a
+#define I915_FORMAT_MOD_Y_TILED_CCS	fourcc_mod_code(INTEL, 4)
169b9a
+#define I915_FORMAT_MOD_Yf_TILED_CCS	fourcc_mod_code(INTEL, 5)
169b9a
+
169b9a
+/*
169b9a
+ * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks
169b9a
+ *
169b9a
+ * Macroblocks are laid in a Z-shape, and each pixel data is following the
169b9a
+ * standard NV12 style.
169b9a
+ * As for NV12, an image is the result of two frame buffers: one for Y,
169b9a
+ * one for the interleaved Cb/Cr components (1/2 the height of the Y buffer).
169b9a
+ * Alignment requirements are (for each buffer):
169b9a
+ * - multiple of 128 pixels for the width
169b9a
+ * - multiple of  32 pixels for the height
169b9a
+ *
169b9a
+ * For more information: see https://linuxtv.org/downloads/v4l-dvb-apis/re32.html
169b9a
+ */
169b9a
+#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE	fourcc_mod_code(SAMSUNG, 1)
169b9a
+
169b9a
+/* Vivante framebuffer modifiers */
169b9a
+
169b9a
+/*
169b9a
+ * Vivante 4x4 tiling layout
169b9a
+ *
169b9a
+ * This is a simple tiled layout using tiles of 4x4 pixels in a row-major
169b9a
+ * layout.
169b9a
+ */
169b9a
+#define DRM_FORMAT_MOD_VIVANTE_TILED		fourcc_mod_code(VIVANTE, 1)
169b9a
+
169b9a
+/*
169b9a
+ * Vivante 64x64 super-tiling layout
169b9a
+ *
169b9a
+ * This is a tiled layout using 64x64 pixel super-tiles, where each super-tile
169b9a
+ * contains 8x4 groups of 2x4 tiles of 4x4 pixels (like above) each, all in row-
169b9a
+ * major layout.
169b9a
+ *
169b9a
+ * For more information: see
169b9a
+ * https://github.com/etnaviv/etna_viv/blob/master/doc/hardware.md#texture-tiling
169b9a
+ */
169b9a
+#define DRM_FORMAT_MOD_VIVANTE_SUPER_TILED	fourcc_mod_code(VIVANTE, 2)
169b9a
+
169b9a
+/*
169b9a
+ * Vivante 4x4 tiling layout for dual-pipe
169b9a
+ *
169b9a
+ * Same as the 4x4 tiling layout, except every second 4x4 pixel tile starts at a
169b9a
+ * different base address. Offsets from the base addresses are therefore halved
169b9a
+ * compared to the non-split tiled layout.
169b9a
+ */
169b9a
+#define DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED	fourcc_mod_code(VIVANTE, 3)
169b9a
+
169b9a
+/*
169b9a
+ * Vivante 64x64 super-tiling layout for dual-pipe
169b9a
+ *
169b9a
+ * Same as the 64x64 super-tiling layout, except every second 4x4 pixel tile
169b9a
+ * starts at a different base address. Offsets from the base addresses are
169b9a
+ * therefore halved compared to the non-split super-tiled layout.
169b9a
+ */
169b9a
+#define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4)
169b9a
+
169b9a
+/* NVIDIA frame buffer modifiers */
169b9a
+
169b9a
+/*
169b9a
+ * Tegra Tiled Layout, used by Tegra 2, 3 and 4.
169b9a
+ *
169b9a
+ * Pixels are arranged in simple tiles of 16 x 16 bytes.
169b9a
+ */
169b9a
+#define DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED fourcc_mod_code(NVIDIA, 1)
169b9a
+
169b9a
+/*
169b9a
+ * 16Bx2 Block Linear layout, used by desktop GPUs, and Tegra K1 and later
169b9a
+ *
169b9a
+ * Pixels are arranged in 64x8 Groups Of Bytes (GOBs). GOBs are then stacked
169b9a
+ * vertically by a power of 2 (1 to 32 GOBs) to form a block.
169b9a
+ *
169b9a
+ * Within a GOB, data is ordered as 16B x 2 lines sectors laid in Z-shape.
169b9a
+ *
169b9a
+ * Parameter 'v' is the log2 encoding of the number of GOBs stacked vertically.
169b9a
+ * Valid values are:
169b9a
+ *
169b9a
+ * 0 == ONE_GOB
169b9a
+ * 1 == TWO_GOBS
169b9a
+ * 2 == FOUR_GOBS
169b9a
+ * 3 == EIGHT_GOBS
169b9a
+ * 4 == SIXTEEN_GOBS
169b9a
+ * 5 == THIRTYTWO_GOBS
169b9a
+ *
169b9a
+ * Chapter 20 "Pixel Memory Formats" of the Tegra X1 TRM describes this format
169b9a
+ * in full detail.
169b9a
+ */
169b9a
+#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(v) \
169b9a
+	fourcc_mod_code(NVIDIA, 0x10 | ((v) & 0xf))
169b9a
+
169b9a
+#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB \
169b9a
+	fourcc_mod_code(NVIDIA, 0x10)
169b9a
+#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB \
169b9a
+	fourcc_mod_code(NVIDIA, 0x11)
169b9a
+#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB \
169b9a
+	fourcc_mod_code(NVIDIA, 0x12)
169b9a
+#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB \
169b9a
+	fourcc_mod_code(NVIDIA, 0x13)
169b9a
+#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB \
169b9a
+	fourcc_mod_code(NVIDIA, 0x14)
169b9a
+#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB \
169b9a
+	fourcc_mod_code(NVIDIA, 0x15)
169b9a
+
169b9a
+/*
169b9a
+ * Broadcom VC4 "T" format
169b9a
+ *
169b9a
+ * This is the primary layout that the V3D GPU can texture from (it
169b9a
+ * can't do linear).  The T format has:
169b9a
+ *
169b9a
+ * - 64b utiles of pixels in a raster-order grid according to cpp.  It's 4x4
169b9a
+ *   pixels at 32 bit depth.
169b9a
+ *
169b9a
+ * - 1k subtiles made of a 4x4 raster-order grid of 64b utiles (so usually
169b9a
+ *   16x16 pixels).
169b9a
+ *
169b9a
+ * - 4k tiles made of a 2x2 grid of 1k subtiles (so usually 32x32 pixels).  On
169b9a
+ *   even 4k tile rows, they're arranged as (BL, TL, TR, BR), and on odd rows
169b9a
+ *   they're (TR, BR, BL, TL), where bottom left is start of memory.
169b9a
+ *
169b9a
+ * - an image made of 4k tiles in rows either left-to-right (even rows of 4k
169b9a
+ *   tiles) or right-to-left (odd rows of 4k tiles).
169b9a
+ */
169b9a
+#define DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED fourcc_mod_code(BROADCOM, 1)
169b9a
+
169b9a
+#if defined(__cplusplus)
169b9a
+}
169b9a
+#endif
169b9a
+
169b9a
+#endif /* DRM_FOURCC_H */
169b9a
-- 
169b9a
1.8.3.1
169b9a