Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4358 | Serge | 1 | /* |
2 | * Copyright 2013 Vadim Girlin |
||
3 | * |
||
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 | * on the rights to use, copy, modify, merge, publish, distribute, sub |
||
8 | * license, and/or sell copies of the Software, and to permit persons to whom |
||
9 | * the Software is furnished to do so, subject to the following conditions: |
||
10 | * |
||
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 |
||
13 | * Software. |
||
14 | * |
||
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 NON-INFRINGEMENT. IN NO EVENT SHALL |
||
18 | * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, |
||
19 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
||
20 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
||
21 | * USE OR OTHER DEALINGS IN THE SOFTWARE. |
||
22 | * |
||
23 | * Authors: |
||
24 | * Vadim Girlin |
||
25 | */ |
||
26 | |||
27 | #include "sb_bc.h" |
||
28 | |||
29 | namespace r600_sb { |
||
30 | |||
31 | int bc_decoder::decode_cf(unsigned &i, bc_cf& bc) { |
||
32 | int r = 0; |
||
33 | uint32_t dw0 = dw[i]; |
||
34 | uint32_t dw1 = dw[i+1]; |
||
35 | |||
36 | if ((dw1 >> 29) & 1) { // CF_ALU |
||
37 | return decode_cf_alu(i, bc); |
||
38 | } else { |
||
39 | // CF_INST field encoding on cayman is the same as on evergreen |
||
40 | unsigned opcode = ctx.is_egcm() ? |
||
41 | CF_WORD1_EG(dw1).get_CF_INST() : |
||
42 | CF_WORD1_R6R7(dw1).get_CF_INST(); |
||
43 | |||
44 | bc.set_op(r600_isa_cf_by_opcode(ctx.isa, opcode, 0)); |
||
45 | |||
46 | if (bc.op_ptr->flags & CF_EXP) { |
||
47 | return decode_cf_exp(i, bc); |
||
48 | } else if (bc.op_ptr->flags & CF_MEM) { |
||
49 | return decode_cf_mem(i, bc); |
||
50 | } |
||
51 | |||
52 | if (ctx.is_egcm()) { |
||
53 | CF_WORD0_EGCM w0(dw0); |
||
54 | bc.addr = w0.get_ADDR(); |
||
55 | bc.jumptable_sel = w0.get_JUMPTABLE_SEL(); |
||
56 | |||
57 | if (ctx.is_evergreen()) { |
||
58 | CF_WORD1_EG w1(dw1); |
||
59 | |||
60 | bc.barrier = w1.get_BARRIER(); |
||
61 | bc.cf_const = w1.get_CF_CONST(); |
||
62 | bc.cond = w1.get_COND(); |
||
63 | bc.count = w1.get_COUNT(); |
||
64 | bc.end_of_program = w1.get_END_OF_PROGRAM(); |
||
65 | bc.pop_count = w1.get_POP_COUNT(); |
||
66 | bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE(); |
||
67 | bc.whole_quad_mode = w1.get_WHOLE_QUAD_MODE(); |
||
68 | |||
69 | } else { // cayman |
||
70 | CF_WORD1_CM w1(dw1); |
||
71 | |||
72 | bc.barrier = w1.get_BARRIER(); |
||
73 | bc.cf_const = w1.get_CF_CONST(); |
||
74 | bc.cond = w1.get_COND(); |
||
75 | bc.count = w1.get_COUNT(); |
||
76 | bc.pop_count = w1.get_POP_COUNT(); |
||
77 | bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE(); |
||
78 | } |
||
79 | |||
80 | |||
81 | } else { |
||
82 | CF_WORD0_R6R7 w0(dw0); |
||
83 | bc.addr = w0.get_ADDR(); |
||
84 | |||
85 | CF_WORD1_R6R7 w1(dw1); |
||
86 | bc.barrier = w1.get_BARRIER(); |
||
87 | bc.cf_const = w1.get_CF_CONST(); |
||
88 | bc.cond = w1.get_COND(); |
||
89 | |||
90 | if (ctx.is_r600()) |
||
91 | bc.count = w1.get_COUNT(); |
||
92 | else |
||
93 | bc.count = w1.get_COUNT() + (w1.get_COUNT_3() << 3); |
||
94 | |||
95 | bc.end_of_program = w1.get_END_OF_PROGRAM(); |
||
96 | bc.pop_count = w1.get_POP_COUNT(); |
||
97 | bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE(); |
||
98 | bc.whole_quad_mode = w1.get_WHOLE_QUAD_MODE(); |
||
99 | bc.call_count = w1.get_CALL_COUNT(); |
||
100 | } |
||
101 | } |
||
102 | |||
103 | i += 2; |
||
104 | |||
105 | return r; |
||
106 | } |
||
107 | |||
108 | int bc_decoder::decode_cf_alu(unsigned & i, bc_cf& bc) { |
||
109 | int r = 0; |
||
110 | uint32_t dw0 = dw[i++]; |
||
111 | uint32_t dw1 = dw[i++]; |
||
112 | |||
113 | assert(i <= ndw); |
||
114 | |||
115 | CF_ALU_WORD0_ALL w0(dw0); |
||
116 | |||
117 | bc.kc[0].bank = w0.get_KCACHE_BANK0(); |
||
118 | bc.kc[1].bank = w0.get_KCACHE_BANK1(); |
||
119 | bc.kc[0].mode = w0.get_KCACHE_MODE0(); |
||
120 | |||
121 | bc.addr = w0.get_ADDR(); |
||
122 | |||
123 | if (ctx.is_r600()) { |
||
124 | CF_ALU_WORD1_R6 w1(dw1); |
||
125 | |||
126 | bc.set_op(r600_isa_cf_by_opcode(ctx.isa, w1.get_CF_INST(), 1)); |
||
127 | |||
128 | bc.kc[0].addr = w1.get_KCACHE_ADDR0(); |
||
129 | bc.kc[1].mode = w1.get_KCACHE_MODE1(); |
||
130 | bc.kc[1].addr = w1.get_KCACHE_ADDR1(); |
||
131 | |||
132 | bc.barrier = w1.get_BARRIER(); |
||
133 | bc.count = w1.get_COUNT(); |
||
134 | bc.whole_quad_mode = w1.get_WHOLE_QUAD_MODE(); |
||
135 | |||
136 | bc.uses_waterfall = w1.get_USES_WATERFALL(); |
||
137 | } else { |
||
138 | CF_ALU_WORD1_R7EGCM w1(dw1); |
||
139 | |||
140 | bc.set_op(r600_isa_cf_by_opcode(ctx.isa, w1.get_CF_INST(), 1)); |
||
141 | |||
142 | if (bc.op == CF_OP_ALU_EXT) { |
||
143 | CF_ALU_WORD0_EXT_EGCM w0(dw0); |
||
144 | CF_ALU_WORD1_EXT_EGCM w1(dw1); |
||
145 | |||
146 | bc.kc[0].index_mode = w0.get_KCACHE_BANK_INDEX_MODE0(); |
||
147 | bc.kc[1].index_mode = w0.get_KCACHE_BANK_INDEX_MODE1(); |
||
148 | bc.kc[2].index_mode = w0.get_KCACHE_BANK_INDEX_MODE2(); |
||
149 | bc.kc[3].index_mode = w0.get_KCACHE_BANK_INDEX_MODE3(); |
||
150 | bc.kc[2].bank = w0.get_KCACHE_BANK2(); |
||
151 | bc.kc[3].bank = w0.get_KCACHE_BANK3(); |
||
152 | bc.kc[2].mode = w0.get_KCACHE_MODE2(); |
||
153 | bc.kc[3].mode = w1.get_KCACHE_MODE3(); |
||
154 | bc.kc[2].addr = w1.get_KCACHE_ADDR2(); |
||
155 | bc.kc[3].addr = w1.get_KCACHE_ADDR3(); |
||
156 | |||
157 | r = decode_cf_alu(i, bc); |
||
158 | |||
159 | } else { |
||
160 | |||
161 | bc.kc[0].addr = w1.get_KCACHE_ADDR0(); |
||
162 | bc.kc[1].mode = w1.get_KCACHE_MODE1(); |
||
163 | bc.kc[1].addr = w1.get_KCACHE_ADDR1(); |
||
164 | bc.barrier = w1.get_BARRIER(); |
||
165 | bc.count = w1.get_COUNT(); |
||
166 | bc.whole_quad_mode = w1.get_WHOLE_QUAD_MODE(); |
||
167 | |||
168 | bc.alt_const = w1.get_ALT_CONST(); |
||
169 | } |
||
170 | } |
||
171 | return r; |
||
172 | } |
||
173 | |||
174 | int bc_decoder::decode_cf_exp(unsigned & i, bc_cf& bc) { |
||
175 | int r = 0; |
||
176 | uint32_t dw0 = dw[i++]; |
||
177 | uint32_t dw1 = dw[i++]; |
||
178 | assert(i <= ndw); |
||
179 | |||
180 | CF_ALLOC_EXPORT_WORD0_ALL w0(dw0); |
||
181 | bc.array_base = w0.get_ARRAY_BASE(); |
||
182 | bc.elem_size = w0.get_ELEM_SIZE(); |
||
183 | bc.index_gpr = w0.get_INDEX_GPR(); |
||
184 | bc.rw_gpr = w0.get_RW_GPR(); |
||
185 | bc.rw_rel = w0.get_RW_REL(); |
||
186 | bc.type = w0.get_TYPE(); |
||
187 | |||
188 | if (ctx.is_evergreen()) { |
||
189 | CF_ALLOC_EXPORT_WORD1_SWIZ_EG w1(dw1); |
||
190 | bc.barrier = w1.get_BARRIER(); |
||
191 | bc.burst_count = w1.get_BURST_COUNT(); |
||
192 | bc.end_of_program = w1.get_END_OF_PROGRAM(); |
||
193 | bc.sel[0] = w1.get_SEL_X(); |
||
194 | bc.sel[1] = w1.get_SEL_Y(); |
||
195 | bc.sel[2] = w1.get_SEL_Z(); |
||
196 | bc.sel[3] = w1.get_SEL_W(); |
||
197 | bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE(); |
||
198 | bc.mark = w1.get_MARK(); |
||
199 | |||
200 | } else if (ctx.is_cayman()) { |
||
201 | CF_ALLOC_EXPORT_WORD1_SWIZ_CM w1(dw1); |
||
202 | bc.barrier = w1.get_BARRIER(); |
||
203 | bc.burst_count = w1.get_BURST_COUNT(); |
||
204 | bc.mark = w1.get_MARK(); |
||
205 | bc.sel[0] = w1.get_SEL_X(); |
||
206 | bc.sel[1] = w1.get_SEL_Y(); |
||
207 | bc.sel[2] = w1.get_SEL_Z(); |
||
208 | bc.sel[3] = w1.get_SEL_W(); |
||
209 | bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE(); |
||
210 | |||
211 | } else { // r67 |
||
212 | CF_ALLOC_EXPORT_WORD1_SWIZ_R6R7 w1(dw1); |
||
213 | bc.barrier = w1.get_BARRIER(); |
||
214 | bc.burst_count = w1.get_BURST_COUNT(); |
||
215 | bc.end_of_program = w1.get_END_OF_PROGRAM(); |
||
216 | bc.sel[0] = w1.get_SEL_X(); |
||
217 | bc.sel[1] = w1.get_SEL_Y(); |
||
218 | bc.sel[2] = w1.get_SEL_Z(); |
||
219 | bc.sel[3] = w1.get_SEL_W(); |
||
220 | bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE(); |
||
221 | bc.whole_quad_mode = w1.get_WHOLE_QUAD_MODE(); |
||
222 | } |
||
223 | |||
224 | return r; |
||
225 | } |
||
226 | |||
227 | |||
228 | int bc_decoder::decode_cf_mem(unsigned & i, bc_cf& bc) { |
||
229 | int r = 0; |
||
230 | uint32_t dw0 = dw[i++]; |
||
231 | uint32_t dw1 = dw[i++]; |
||
232 | assert(i <= ndw); |
||
233 | |||
234 | if (!(bc.op_ptr->flags & CF_RAT)) { |
||
235 | CF_ALLOC_EXPORT_WORD0_ALL w0(dw0); |
||
236 | bc.array_base = w0.get_ARRAY_BASE(); |
||
237 | bc.elem_size = w0.get_ELEM_SIZE(); |
||
238 | bc.index_gpr = w0.get_INDEX_GPR(); |
||
239 | bc.rw_gpr = w0.get_RW_GPR(); |
||
240 | bc.rw_rel = w0.get_RW_REL(); |
||
241 | bc.type = w0.get_TYPE(); |
||
242 | } else { |
||
243 | assert(ctx.is_egcm()); |
||
244 | CF_ALLOC_EXPORT_WORD0_RAT_EGCM w0(dw0); |
||
245 | bc.elem_size = w0.get_ELEM_SIZE(); |
||
246 | bc.index_gpr = w0.get_INDEX_GPR(); |
||
247 | bc.rw_gpr = w0.get_RW_GPR(); |
||
248 | bc.rw_rel = w0.get_RW_REL(); |
||
249 | bc.type = w0.get_TYPE(); |
||
250 | bc.rat_id = w0.get_RAT_ID(); |
||
251 | bc.rat_inst = w0.get_RAT_INST(); |
||
252 | bc.rat_index_mode = w0.get_RAT_INDEX_MODE(); |
||
253 | } |
||
254 | |||
255 | if (ctx.is_evergreen()) { |
||
256 | CF_ALLOC_EXPORT_WORD1_BUF_EG w1(dw1); |
||
257 | bc.barrier = w1.get_BARRIER(); |
||
258 | bc.burst_count = w1.get_BURST_COUNT(); |
||
259 | bc.end_of_program = w1.get_END_OF_PROGRAM(); |
||
260 | bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE(); |
||
261 | bc.mark = w1.get_MARK(); |
||
262 | bc.array_size = w1.get_ARRAY_SIZE(); |
||
263 | bc.comp_mask = w1.get_COMP_MASK(); |
||
264 | |||
265 | } else if (ctx.is_cayman()) { |
||
266 | CF_ALLOC_EXPORT_WORD1_BUF_CM w1(dw1); |
||
267 | bc.barrier = w1.get_BARRIER(); |
||
268 | bc.burst_count = w1.get_BURST_COUNT(); |
||
269 | bc.mark = w1.get_MARK(); |
||
270 | bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE(); |
||
271 | bc.array_size = w1.get_ARRAY_SIZE(); |
||
272 | bc.comp_mask = w1.get_COMP_MASK(); |
||
273 | |||
274 | } else { // r67 |
||
275 | CF_ALLOC_EXPORT_WORD1_BUF_R6R7 w1(dw1); |
||
276 | bc.barrier = w1.get_BARRIER(); |
||
277 | bc.burst_count = w1.get_BURST_COUNT(); |
||
278 | bc.end_of_program = w1.get_END_OF_PROGRAM(); |
||
279 | bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE(); |
||
280 | bc.whole_quad_mode = w1.get_WHOLE_QUAD_MODE(); |
||
281 | bc.array_size = w1.get_ARRAY_SIZE(); |
||
282 | bc.comp_mask = w1.get_COMP_MASK(); |
||
283 | bc.whole_quad_mode = w1.get_WHOLE_QUAD_MODE(); |
||
284 | } |
||
285 | |||
286 | return r; |
||
287 | } |
||
288 | |||
289 | int bc_decoder::decode_alu(unsigned & i, bc_alu& bc) { |
||
290 | int r = 0; |
||
291 | uint32_t dw0 = dw[i++]; |
||
292 | uint32_t dw1 = dw[i++]; |
||
293 | assert(i <= ndw); |
||
294 | |||
295 | ALU_WORD0_ALL w0(dw0); |
||
296 | bc.index_mode = w0.get_INDEX_MODE(); |
||
297 | bc.last = w0.get_LAST(); |
||
298 | bc.pred_sel = w0.get_PRED_SEL(); |
||
299 | bc.src[0].chan = w0.get_SRC0_CHAN(); |
||
300 | bc.src[0].sel = w0.get_SRC0_SEL(); |
||
301 | bc.src[0].neg = w0.get_SRC0_NEG(); |
||
302 | bc.src[0].rel = w0.get_SRC0_REL(); |
||
303 | bc.src[1].chan = w0.get_SRC1_CHAN(); |
||
304 | bc.src[1].sel = w0.get_SRC1_SEL(); |
||
305 | bc.src[1].neg = w0.get_SRC1_NEG(); |
||
306 | bc.src[1].rel = w0.get_SRC1_REL(); |
||
307 | |||
308 | if ((dw1 >> 15) & 7) { // op3 |
||
309 | ALU_WORD1_OP3_ALL w1(dw1); |
||
310 | bc.set_op(r600_isa_alu_by_opcode(ctx.isa, w1.get_ALU_INST(), 1)); |
||
311 | |||
312 | bc.bank_swizzle = w1.get_BANK_SWIZZLE(); |
||
313 | bc.clamp = w1.get_CLAMP(); |
||
314 | bc.dst_chan = w1.get_DST_CHAN(); |
||
315 | bc.dst_gpr = w1.get_DST_GPR(); |
||
316 | bc.dst_rel = w1.get_DST_REL(); |
||
317 | |||
318 | bc.src[2].chan = w1.get_SRC2_CHAN(); |
||
319 | bc.src[2].sel = w1.get_SRC2_SEL(); |
||
320 | bc.src[2].neg = w1.get_SRC2_NEG(); |
||
321 | bc.src[2].rel = w1.get_SRC2_REL(); |
||
322 | |||
323 | } else { // op2 |
||
324 | if (ctx.is_r600()) { |
||
325 | ALU_WORD1_OP2_R6 w1(dw1); |
||
326 | bc.set_op(r600_isa_alu_by_opcode(ctx.isa, w1.get_ALU_INST(), 0)); |
||
327 | |||
328 | bc.bank_swizzle = w1.get_BANK_SWIZZLE(); |
||
329 | bc.clamp = w1.get_CLAMP(); |
||
330 | bc.dst_chan = w1.get_DST_CHAN(); |
||
331 | bc.dst_gpr = w1.get_DST_GPR(); |
||
332 | bc.dst_rel = w1.get_DST_REL(); |
||
333 | |||
334 | bc.omod = w1.get_OMOD(); |
||
335 | bc.src[0].abs = w1.get_SRC0_ABS(); |
||
336 | bc.src[1].abs = w1.get_SRC1_ABS(); |
||
337 | bc.write_mask = w1.get_WRITE_MASK(); |
||
338 | bc.update_exec_mask = w1.get_UPDATE_EXEC_MASK(); |
||
339 | bc.update_pred = w1.get_UPDATE_PRED(); |
||
340 | |||
341 | bc.fog_merge = w1.get_FOG_MERGE(); |
||
342 | |||
343 | } else { |
||
344 | ALU_WORD1_OP2_R7EGCM w1(dw1); |
||
345 | bc.set_op(r600_isa_alu_by_opcode(ctx.isa, w1.get_ALU_INST(), 0)); |
||
346 | |||
347 | bc.bank_swizzle = w1.get_BANK_SWIZZLE(); |
||
348 | bc.clamp = w1.get_CLAMP(); |
||
349 | bc.dst_chan = w1.get_DST_CHAN(); |
||
350 | bc.dst_gpr = w1.get_DST_GPR(); |
||
351 | bc.dst_rel = w1.get_DST_REL(); |
||
352 | |||
353 | bc.omod = w1.get_OMOD(); |
||
354 | bc.src[0].abs = w1.get_SRC0_ABS(); |
||
355 | bc.src[1].abs = w1.get_SRC1_ABS(); |
||
356 | bc.write_mask = w1.get_WRITE_MASK(); |
||
357 | bc.update_exec_mask = w1.get_UPDATE_EXEC_MASK(); |
||
358 | bc.update_pred = w1.get_UPDATE_PRED(); |
||
359 | } |
||
360 | } |
||
361 | |||
362 | bc.slot_flags = (alu_op_flags)bc.op_ptr->slots[ctx.isa->hw_class]; |
||
363 | return r; |
||
364 | } |
||
365 | |||
366 | int bc_decoder::decode_fetch(unsigned & i, bc_fetch& bc) { |
||
367 | int r = 0; |
||
368 | uint32_t dw0 = dw[i]; |
||
369 | uint32_t dw1 = dw[i+1]; |
||
370 | uint32_t dw2 = dw[i+2]; |
||
371 | assert(i + 4 <= ndw); |
||
372 | |||
373 | unsigned fetch_opcode = dw0 & 0x1F; |
||
374 | |||
375 | bc.set_op(r600_isa_fetch_by_opcode(ctx.isa, fetch_opcode)); |
||
376 | |||
377 | if (bc.op_ptr->flags & FF_VTX) |
||
378 | return decode_fetch_vtx(i, bc); |
||
379 | |||
380 | // tex |
||
381 | |||
382 | if (ctx.is_r600()) { |
||
383 | TEX_WORD0_R6 w0(dw0); |
||
384 | |||
385 | bc.bc_frac_mode = w0.get_BC_FRAC_MODE(); |
||
386 | bc.fetch_whole_quad = w0.get_FETCH_WHOLE_QUAD(); |
||
387 | bc.resource_id = w0.get_RESOURCE_ID(); |
||
388 | bc.src_gpr = w0.get_SRC_GPR(); |
||
389 | bc.src_rel = w0.get_SRC_REL(); |
||
390 | |||
391 | } else if (ctx.is_r600()) { |
||
392 | TEX_WORD0_R7 w0(dw0); |
||
393 | |||
394 | bc.bc_frac_mode = w0.get_BC_FRAC_MODE(); |
||
395 | bc.fetch_whole_quad = w0.get_FETCH_WHOLE_QUAD(); |
||
396 | bc.resource_id = w0.get_RESOURCE_ID(); |
||
397 | bc.src_gpr = w0.get_SRC_GPR(); |
||
398 | bc.src_rel = w0.get_SRC_REL(); |
||
399 | bc.alt_const = w0.get_ALT_CONST(); |
||
400 | |||
401 | } else { // eg/cm |
||
402 | TEX_WORD0_EGCM w0(dw0); |
||
403 | |||
404 | bc.fetch_whole_quad = w0.get_FETCH_WHOLE_QUAD(); |
||
405 | bc.resource_id = w0.get_RESOURCE_ID(); |
||
406 | bc.src_gpr = w0.get_SRC_GPR(); |
||
407 | bc.src_rel = w0.get_SRC_REL(); |
||
408 | bc.alt_const = w0.get_ALT_CONST(); |
||
409 | bc.inst_mod = w0.get_INST_MOD(); |
||
410 | bc.resource_index_mode = w0.get_RESOURCE_INDEX_MODE(); |
||
411 | bc.sampler_index_mode = w0.get_SAMPLER_INDEX_MODE(); |
||
412 | } |
||
413 | |||
414 | TEX_WORD1_ALL w1(dw1); |
||
415 | bc.coord_type[0] = w1.get_COORD_TYPE_X(); |
||
416 | bc.coord_type[1] = w1.get_COORD_TYPE_Y(); |
||
417 | bc.coord_type[2] = w1.get_COORD_TYPE_Z(); |
||
418 | bc.coord_type[3] = w1.get_COORD_TYPE_W(); |
||
419 | bc.dst_gpr = w1.get_DST_GPR(); |
||
420 | bc.dst_rel = w1.get_DST_REL(); |
||
421 | bc.dst_sel[0] = w1.get_DST_SEL_X(); |
||
422 | bc.dst_sel[1] = w1.get_DST_SEL_Y(); |
||
423 | bc.dst_sel[2] = w1.get_DST_SEL_Z(); |
||
424 | bc.dst_sel[3] = w1.get_DST_SEL_W(); |
||
425 | bc.lod_bias = w1.get_LOD_BIAS(); |
||
426 | |||
427 | TEX_WORD2_ALL w2(dw2); |
||
428 | bc.offset[0] = w2.get_OFFSET_X(); |
||
429 | bc.offset[1] = w2.get_OFFSET_Y(); |
||
430 | bc.offset[2] = w2.get_OFFSET_Z(); |
||
431 | bc.sampler_id = w2.get_SAMPLER_ID(); |
||
432 | bc.src_sel[0] = w2.get_SRC_SEL_X(); |
||
433 | bc.src_sel[1] = w2.get_SRC_SEL_Y(); |
||
434 | bc.src_sel[2] = w2.get_SRC_SEL_Z(); |
||
435 | bc.src_sel[3] = w2.get_SRC_SEL_W(); |
||
436 | |||
437 | i += 4; |
||
438 | return r; |
||
439 | } |
||
440 | |||
441 | int bc_decoder::decode_fetch_vtx(unsigned & i, bc_fetch& bc) { |
||
442 | int r = 0; |
||
443 | uint32_t dw0 = dw[i]; |
||
444 | uint32_t dw1 = dw[i+1]; |
||
445 | uint32_t dw2 = dw[i+2]; |
||
446 | i+= 4; |
||
447 | assert(i <= ndw); |
||
448 | |||
449 | if (ctx.is_cayman()) { |
||
450 | VTX_WORD0_CM w0(dw0); |
||
451 | bc.resource_id = w0.get_BUFFER_ID(); |
||
452 | bc.fetch_type = w0.get_FETCH_TYPE(); |
||
453 | bc.fetch_whole_quad = w0.get_FETCH_WHOLE_QUAD(); |
||
454 | bc.src_gpr = w0.get_SRC_GPR(); |
||
455 | bc.src_rel = w0.get_SRC_REL(); |
||
456 | bc.src_sel[0] = w0.get_SRC_SEL_X(); |
||
457 | bc.coalesced_read = w0.get_COALESCED_READ(); |
||
458 | bc.lds_req = w0.get_LDS_REQ(); |
||
459 | bc.structured_read = w0.get_STRUCTURED_READ(); |
||
460 | |||
461 | } else { |
||
462 | VTX_WORD0_R6R7EG w0(dw0); |
||
463 | bc.resource_id = w0.get_BUFFER_ID(); |
||
464 | bc.fetch_type = w0.get_FETCH_TYPE(); |
||
465 | bc.fetch_whole_quad = w0.get_FETCH_WHOLE_QUAD(); |
||
466 | bc.mega_fetch_count = w0.get_MEGA_FETCH_COUNT(); |
||
467 | bc.src_gpr = w0.get_SRC_GPR(); |
||
468 | bc.src_rel = w0.get_SRC_REL(); |
||
469 | bc.src_sel[0] = w0.get_SRC_SEL_X(); |
||
470 | } |
||
471 | |||
472 | if (bc.op == FETCH_OP_SEMFETCH) { |
||
473 | VTX_WORD1_SEM_ALL w1(dw1); |
||
474 | bc.data_format = w1.get_DATA_FORMAT(); |
||
475 | bc.dst_sel[0] = w1.get_DST_SEL_X(); |
||
476 | bc.dst_sel[1] = w1.get_DST_SEL_Y(); |
||
477 | bc.dst_sel[2] = w1.get_DST_SEL_Z(); |
||
478 | bc.dst_sel[3] = w1.get_DST_SEL_W(); |
||
479 | bc.format_comp_all = w1.get_FORMAT_COMP_ALL(); |
||
480 | bc.num_format_all = w1.get_NUM_FORMAT_ALL(); |
||
481 | bc.srf_mode_all = w1.get_SRF_MODE_ALL(); |
||
482 | bc.use_const_fields = w1.get_USE_CONST_FIELDS(); |
||
483 | |||
484 | bc.semantic_id = w1.get_SEMANTIC_ID(); |
||
485 | |||
486 | } else { |
||
487 | VTX_WORD1_GPR_ALL w1(dw1); |
||
488 | bc.data_format = w1.get_DATA_FORMAT(); |
||
489 | bc.dst_sel[0] = w1.get_DST_SEL_X(); |
||
490 | bc.dst_sel[1] = w1.get_DST_SEL_Y(); |
||
491 | bc.dst_sel[2] = w1.get_DST_SEL_Z(); |
||
492 | bc.dst_sel[3] = w1.get_DST_SEL_W(); |
||
493 | bc.format_comp_all = w1.get_FORMAT_COMP_ALL(); |
||
494 | bc.num_format_all = w1.get_NUM_FORMAT_ALL(); |
||
495 | bc.srf_mode_all = w1.get_SRF_MODE_ALL(); |
||
496 | bc.use_const_fields = w1.get_USE_CONST_FIELDS(); |
||
497 | |||
498 | bc.dst_gpr = w1.get_DST_GPR(); |
||
499 | bc.dst_rel = w1.get_DST_REL(); |
||
500 | } |
||
501 | |||
502 | switch (ctx.hw_class) { |
||
503 | case HW_CLASS_R600: |
||
504 | { |
||
505 | VTX_WORD2_R6 w2(dw2); |
||
506 | bc.const_buf_no_stride = w2.get_CONST_BUF_NO_STRIDE(); |
||
507 | bc.endian_swap = w2.get_ENDIAN_SWAP(); |
||
508 | bc.mega_fetch = w2.get_MEGA_FETCH(); |
||
509 | bc.offset[0] = w2.get_OFFSET(); |
||
510 | break; |
||
511 | } |
||
512 | case HW_CLASS_R700: |
||
513 | { |
||
514 | VTX_WORD2_R7 w2(dw2); |
||
515 | bc.const_buf_no_stride = w2.get_CONST_BUF_NO_STRIDE(); |
||
516 | bc.endian_swap = w2.get_ENDIAN_SWAP(); |
||
517 | bc.mega_fetch = w2.get_MEGA_FETCH(); |
||
518 | bc.offset[0] = w2.get_OFFSET(); |
||
519 | bc.alt_const = w2.get_ALT_CONST(); |
||
520 | break; |
||
521 | } |
||
522 | case HW_CLASS_EVERGREEN: |
||
523 | { |
||
524 | VTX_WORD2_EG w2(dw2); |
||
525 | bc.const_buf_no_stride = w2.get_CONST_BUF_NO_STRIDE(); |
||
526 | bc.endian_swap = w2.get_ENDIAN_SWAP(); |
||
527 | bc.mega_fetch = w2.get_MEGA_FETCH(); |
||
528 | bc.offset[0] = w2.get_OFFSET(); |
||
529 | bc.alt_const = w2.get_ALT_CONST(); |
||
530 | bc.resource_index_mode = w2.get_BUFFER_INDEX_MODE(); |
||
531 | break; |
||
532 | } |
||
533 | case HW_CLASS_CAYMAN: |
||
534 | { |
||
535 | VTX_WORD2_CM w2(dw2); |
||
536 | bc.const_buf_no_stride = w2.get_CONST_BUF_NO_STRIDE(); |
||
537 | bc.endian_swap = w2.get_ENDIAN_SWAP(); |
||
538 | bc.offset[0] = w2.get_OFFSET(); |
||
539 | bc.alt_const = w2.get_ALT_CONST(); |
||
540 | bc.resource_index_mode = w2.get_BUFFER_INDEX_MODE(); |
||
541 | break; |
||
542 | } |
||
543 | default: |
||
544 | assert(!"unknown hw class"); |
||
545 | return -1; |
||
546 | } |
||
547 | |||
548 | return r; |
||
549 | } |
||
550 | |||
551 | }=>=>=>=>=>=>><> |