2 * Copyright © 2014 Broadcom
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
32 VC4_PACKET_FLUSH_ALL
= 5,
33 VC4_PACKET_START_TILE_BINNING
= 6,
34 VC4_PACKET_INCREMENT_SEMAPHORE
= 7,
35 VC4_PACKET_WAIT_ON_SEMAPHORE
= 8,
37 VC4_PACKET_BRANCH
= 16,
38 VC4_PACKET_BRANCH_TO_SUB_LIST
= 17,
40 VC4_PACKET_STORE_MS_TILE_BUFFER
= 24,
41 VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF
= 25,
42 VC4_PACKET_STORE_FULL_RES_TILE_BUFFER
= 26,
43 VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER
= 27,
44 VC4_PACKET_STORE_TILE_BUFFER_GENERAL
= 28,
45 VC4_PACKET_LOAD_TILE_BUFFER_GENERAL
= 29,
47 VC4_PACKET_GL_INDEXED_PRIMITIVE
= 32,
48 VC4_PACKET_GL_ARRAY_PRIMITIVE
= 33,
50 VC4_PACKET_COMPRESSED_PRIMITIVE
= 48,
51 VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE
= 49,
53 VC4_PACKET_PRIMITIVE_LIST_FORMAT
= 56,
55 VC4_PACKET_GL_SHADER_STATE
= 64,
56 VC4_PACKET_NV_SHADER_STATE
= 65,
57 VC4_PACKET_VG_SHADER_STATE
= 66,
59 VC4_PACKET_CONFIGURATION_BITS
= 96,
60 VC4_PACKET_FLAT_SHADE_FLAGS
= 97,
61 VC4_PACKET_POINT_SIZE
= 98,
62 VC4_PACKET_LINE_WIDTH
= 99,
63 VC4_PACKET_RHT_X_BOUNDARY
= 100,
64 VC4_PACKET_DEPTH_OFFSET
= 101,
65 VC4_PACKET_CLIP_WINDOW
= 102,
66 VC4_PACKET_VIEWPORT_OFFSET
= 103,
67 VC4_PACKET_Z_CLIPPING
= 104,
68 VC4_PACKET_CLIPPER_XY_SCALING
= 105,
69 VC4_PACKET_CLIPPER_Z_SCALING
= 106,
71 VC4_PACKET_TILE_BINNING_MODE_CONFIG
= 112,
72 VC4_PACKET_TILE_RENDERING_MODE_CONFIG
= 113,
73 VC4_PACKET_CLEAR_COLORS
= 114,
74 VC4_PACKET_TILE_COORDINATES
= 115,
76 /* Not an actual hardware packet -- this is what we use to put
77 * references to GEM bos in the command stream, since we need the u32
78 * int the actual address packet in order to store the offset from the
81 VC4_PACKET_GEM_HANDLES
= 254,
82 } __attribute__ ((__packed__
));
85 * Bits used by packets like VC4_PACKET_STORE_TILE_BUFFER_GENERAL and
86 * VC4_PACKET_TILE_RENDERING_MODE_CONFIG.
88 #define VC4_TILING_FORMAT_LINEAR 0
89 #define VC4_TILING_FORMAT_T 1
90 #define VC4_TILING_FORMAT_LT 2
95 * byte 2 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and
96 * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL (low bits of the address)
99 #define VC4_LOADSTORE_TILE_BUFFER_EOF (1 << 3)
100 #define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_VG_MASK (1 << 2)
101 #define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_ZS (1 << 1)
102 #define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_COLOR (1 << 0)
108 * byte 1 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and
109 * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL
111 #define VC4_STORE_TILE_BUFFER_DISABLE_VG_MASK_CLEAR (1 << 7)
112 #define VC4_STORE_TILE_BUFFER_DISABLE_ZS_CLEAR (1 << 6)
113 #define VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR (1 << 5)
114 #define VC4_STORE_TILE_BUFFER_DISABLE_SWAP (1 << 4)
116 #define VC4_LOADSTORE_TILE_BUFFER_RGBA8888 (0 << 0)
117 #define VC4_LOADSTORE_TILE_BUFFER_BGR565_DITHER (1 << 0)
118 #define VC4_LOADSTORE_TILE_BUFFER_BGR565 (2 << 0)
119 #define VC4_LOADSTORE_TILE_BUFFER_MASK (3 << 0)
124 * byte 0 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and
125 * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL
127 #define VC4_STORE_TILE_BUFFER_MODE_SAMPLE0 (0 << 6)
128 #define VC4_STORE_TILE_BUFFER_MODE_DECIMATE_X4 (1 << 6)
129 #define VC4_STORE_TILE_BUFFER_MODE_DECIMATE_X16 (2 << 6)
131 /** The values of the field are VC4_TILING_FORMAT_* */
132 #define VC4_LOADSTORE_TILE_BUFFER_FORMAT_MASK (3 << 4)
133 #define VC4_LOADSTORE_TILE_BUFFER_FORMAT_SHIFT 4
136 #define VC4_LOADSTORE_TILE_BUFFER_NONE (0 << 0)
137 #define VC4_LOADSTORE_TILE_BUFFER_COLOR (1 << 0)
138 #define VC4_LOADSTORE_TILE_BUFFER_ZS (2 << 0)
139 #define VC4_LOADSTORE_TILE_BUFFER_Z (3 << 0)
140 #define VC4_LOADSTORE_TILE_BUFFER_VG_MASK (4 << 0)
141 #define VC4_LOADSTORE_TILE_BUFFER_FULL (5 << 0)
144 #define VC4_INDEX_BUFFER_U8 (0 << 4)
145 #define VC4_INDEX_BUFFER_U16 (1 << 4)
147 /* This flag is only present in NV shader state. */
148 #define VC4_SHADER_FLAG_SHADED_CLIP_COORDS (1 << 3)
149 #define VC4_SHADER_FLAG_ENABLE_CLIPPING (1 << 2)
150 #define VC4_SHADER_FLAG_VS_POINT_SIZE (1 << 1)
151 #define VC4_SHADER_FLAG_FS_SINGLE_THREAD (1 << 0)
153 /** @{ byte 2 of config bits. */
154 #define VC4_CONFIG_BITS_EARLY_Z_UPDATE (1 << 1)
155 #define VC4_CONFIG_BITS_EARLY_Z (1 << 0)
158 /** @{ byte 1 of config bits. */
159 #define VC4_CONFIG_BITS_Z_UPDATE (1 << 7)
160 /** same values in this 3-bit field as PIPE_FUNC_* */
161 #define VC4_CONFIG_BITS_DEPTH_FUNC_SHIFT 4
162 #define VC4_CONFIG_BITS_COVERAGE_READ_LEAVE (1 << 3)
164 #define VC4_CONFIG_BITS_COVERAGE_UPDATE_NONZERO (0 << 1)
165 #define VC4_CONFIG_BITS_COVERAGE_UPDATE_ODD (1 << 1)
166 #define VC4_CONFIG_BITS_COVERAGE_UPDATE_OR (2 << 1)
167 #define VC4_CONFIG_BITS_COVERAGE_UPDATE_ZERO (3 << 1)
169 #define VC4_CONFIG_BITS_COVERAGE_PIPE_SELECT (1 << 0)
172 /** @{ byte 0 of config bits. */
173 #define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_NONE (0 << 6)
174 #define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_4X (1 << 6)
175 #define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_16X (2 << 6)
177 #define VC4_CONFIG_BITS_AA_POINTS_AND_LINES (1 << 4)
178 #define VC4_CONFIG_BITS_ENABLE_DEPTH_OFFSET (1 << 3)
179 #define VC4_CONFIG_BITS_CW_PRIMITIVES (1 << 2)
180 #define VC4_CONFIG_BITS_ENABLE_PRIM_BACK (1 << 1)
181 #define VC4_CONFIG_BITS_ENABLE_PRIM_FRONT (1 << 0)
184 /** @{ bits in the last u8 of VC4_PACKET_TILE_BINNING_MODE_CONFIG */
185 #define VC4_BIN_CONFIG_DB_NON_MS (1 << 7)
187 #define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_32 (0 << 5)
188 #define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_64 (1 << 5)
189 #define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_128 (2 << 5)
190 #define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_256 (3 << 5)
192 #define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_32 (0 << 3)
193 #define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_64 (1 << 3)
194 #define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_128 (2 << 3)
195 #define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_256 (3 << 3)
197 #define VC4_BIN_CONFIG_AUTO_INIT_TSDA (1 << 2)
198 #define VC4_BIN_CONFIG_TILE_BUFFER_64BIT (1 << 1)
199 #define VC4_BIN_CONFIG_MS_MODE_4X (1 << 0)
202 /** @{ bits in the last u16 of VC4_PACKET_TILE_RENDERING_MODE_CONFIG */
203 #define VC4_RENDER_CONFIG_DB_NON_MS (1 << 12)
204 #define VC4_RENDER_CONFIG_EARLY_Z_COVERAGE_DISABLE (1 << 11)
205 #define VC4_RENDER_CONFIG_EARLY_Z_DIRECTION_G (1 << 10)
206 #define VC4_RENDER_CONFIG_COVERAGE_MODE (1 << 9)
207 #define VC4_RENDER_CONFIG_ENABLE_VG_MASK (1 << 8)
209 /** The values of the field are VC4_TILING_FORMAT_* */
210 #define VC4_RENDER_CONFIG_MEMORY_FORMAT_MASK (3 << 6)
211 #define VC4_RENDER_CONFIG_MEMORY_FORMAT_SHIFT 6
213 #define VC4_RENDER_CONFIG_DECIMATE_MODE_1X (0 << 4)
214 #define VC4_RENDER_CONFIG_DECIMATE_MODE_4X (1 << 4)
215 #define VC4_RENDER_CONFIG_DECIMATE_MODE_16X (2 << 4)
217 #define VC4_RENDER_CONFIG_FORMAT_BGR565 (0 << 2)
218 #define VC4_RENDER_CONFIG_FORMAT_RGBA8888 (1 << 2)
219 #define VC4_RENDER_CONFIG_FORMAT_BGR565_DITHERED (2 << 2)
220 #define VC4_RENDER_CONFIG_FORMAT_MASK (3 << 2)
222 #define VC4_RENDER_CONFIG_TILE_BUFFER_64BIT (1 << 1)
223 #define VC4_RENDER_CONFIG_MS_MODE_4X (1 << 0)
226 enum vc4_texture_data_type
{
227 VC4_TEXTURE_TYPE_RGBA8888
= 0,
228 VC4_TEXTURE_TYPE_RGBX8888
= 1,
229 VC4_TEXTURE_TYPE_RGBA4444
= 2,
230 VC4_TEXTURE_TYPE_RGBA5551
= 3,
231 VC4_TEXTURE_TYPE_RGB565
= 4,
232 VC4_TEXTURE_TYPE_LUMINANCE
= 5,
233 VC4_TEXTURE_TYPE_ALPHA
= 6,
234 VC4_TEXTURE_TYPE_LUMALPHA
= 7,
235 VC4_TEXTURE_TYPE_ETC1
= 8,
236 VC4_TEXTURE_TYPE_S16F
= 9,
237 VC4_TEXTURE_TYPE_S8
= 10,
238 VC4_TEXTURE_TYPE_S16
= 11,
239 VC4_TEXTURE_TYPE_BW1
= 12,
240 VC4_TEXTURE_TYPE_A4
= 13,
241 VC4_TEXTURE_TYPE_A1
= 14,
242 VC4_TEXTURE_TYPE_RGBA64
= 15,
243 VC4_TEXTURE_TYPE_RGBA32R
= 16,
244 VC4_TEXTURE_TYPE_YUV422R
= 17,
247 #endif /* VC4_PACKET_H */