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
24 #ifndef VC4_QPU_DEFINES_H
25 #define VC4_QPU_DEFINES_H
66 QPU_R_FRAG_PAYLOAD_ZW
= 15, /* W for A file, Z for B file */
67 /* 0-31 are the plain regfile a or b fields */
72 QPU_R_XY_PIXEL_COORD
= 41,
73 QPU_R_MS_REV_FLAGS
= 42,
81 /* 0-31 are the plain regfile a or b fields */
82 QPU_W_ACC0
= 32, /* aka r0 */
90 QPU_W_UNIFORMS_ADDRESS
,
91 QPU_W_QUAD_XY
, /* X for regfile a, Y for regfile b */
94 QPU_W_TLB_STENCIL_SETUP
= 43,
100 QPU_W_VPMVCD_SETUP
, /* LD for regfile a, ST for regfile b */
101 QPU_W_VPM_ADDR
, /* LD for regfile a, ST for regfile b */
118 QPU_SIG_SW_BREAKPOINT
,
120 QPU_SIG_THREAD_SWITCH
,
122 QPU_SIG_WAIT_FOR_SCOREBOARD
,
123 QPU_SIG_SCOREBOARD_UNLOCK
,
124 QPU_SIG_LAST_THREAD_SWITCH
,
125 QPU_SIG_COVERAGE_LOAD
,
127 QPU_SIG_COLOR_LOAD_END
,
130 QPU_SIG_ALPHA_MASK_LOAD
,
137 /* hardware mux values */
147 /* non-hardware mux values */
164 /* replicated to each 8 bits of the 32-bit dst. */
165 QPU_PACK_MUL_8888
= 3,
174 /* convert to 16 bit float if float input, or to int16. */
177 /* replicated to each 8 bits of the 32-bit dst. */
179 /* Convert to 8-bit unsigned int. */
185 /* Saturating variants of the previous instructions. */
186 QPU_PACK_A_32_SAT
, /* int-only */
187 QPU_PACK_A_16A_SAT
, /* int or float */
198 QPU_UNPACK_R4_F16A_TO_F32
,
199 QPU_UNPACK_R4_F16B_TO_F32
,
200 QPU_UNPACK_R4_8D_REP
,
207 #define QPU_MASK(high, low) \
208 ((((uint64_t)1 << ((high) - (low) + 1)) - 1) << (low))
210 #define QPU_GET_FIELD(word, field) \
211 ((uint32_t)(((word) & field ## _MASK) >> field ## _SHIFT))
213 #define QPU_SIG_SHIFT 60
214 #define QPU_SIG_MASK QPU_MASK(63, 60)
216 #define QPU_UNPACK_SHIFT 57
217 #define QPU_UNPACK_MASK QPU_MASK(59, 57)
220 * If set, the pack field means PACK_MUL or R4 packing, instead of normal
223 #define QPU_PM ((uint64_t)1 << 56)
225 #define QPU_PACK_SHIFT 52
226 #define QPU_PACK_MASK QPU_MASK(55, 52)
228 #define QPU_COND_ADD_SHIFT 49
229 #define QPU_COND_ADD_MASK QPU_MASK(51, 49)
230 #define QPU_COND_MUL_SHIFT 46
231 #define QPU_COND_MUL_MASK QPU_MASK(48, 46)
233 #define QPU_BRANCH_COND_SHIFT 52
234 #define QPU_BRANCH_COND_MASK QPU_MASK(55, 52)
236 #define QPU_BRANCH_REL ((uint64_t)1 << 51)
237 #define QPU_BRANCH_REG ((uint64_t)1 << 50)
239 #define QPU_BRANCH_RADDR_A_SHIFT 45
240 #define QPU_BRANCH_RADDR_A_MASK QPU_MASK(49, 45)
242 #define QPU_SF ((uint64_t)1 << 45)
244 #define QPU_WADDR_ADD_SHIFT 38
245 #define QPU_WADDR_ADD_MASK QPU_MASK(43, 38)
246 #define QPU_WADDR_MUL_SHIFT 32
247 #define QPU_WADDR_MUL_MASK QPU_MASK(37, 32)
249 #define QPU_OP_MUL_SHIFT 29
250 #define QPU_OP_MUL_MASK QPU_MASK(31, 29)
252 #define QPU_RADDR_A_SHIFT 18
253 #define QPU_RADDR_A_MASK QPU_MASK(23, 18)
254 #define QPU_RADDR_B_SHIFT 12
255 #define QPU_RADDR_B_MASK QPU_MASK(17, 12)
256 #define QPU_SMALL_IMM_SHIFT 12
257 #define QPU_SMALL_IMM_MASK QPU_MASK(17, 12)
259 #define QPU_ADD_A_SHIFT 9
260 #define QPU_ADD_A_MASK QPU_MASK(11, 9)
261 #define QPU_ADD_B_SHIFT 6
262 #define QPU_ADD_B_MASK QPU_MASK(8, 6)
263 #define QPU_MUL_A_SHIFT 3
264 #define QPU_MUL_A_MASK QPU_MASK(5, 3)
265 #define QPU_MUL_B_SHIFT 0
266 #define QPU_MUL_B_MASK QPU_MASK(2, 0)
268 #define QPU_WS ((uint64_t)1 << 44)
270 #define QPU_OP_ADD_SHIFT 24
271 #define QPU_OP_ADD_MASK QPU_MASK(28, 24)
273 #define QPU_LOAD_IMM_SHIFT 0
274 #define QPU_LOAD_IMM_MASK QPU_MASK(31, 0)
276 #define QPU_BRANCH_TARGET_SHIFT 0
277 #define QPU_BRANCH_TARGET_MASK QPU_MASK(31, 0)
279 #endif /* VC4_QPU_DEFINES_H */