2 * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
3 * Copyright 2018 Advanced Micro Devices, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * on the rights to use, copy, modify, merge, publish, distribute, sub
10 * license, and/or sell copies of the Software, and to permit persons to whom
11 * the Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
23 * USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #include "si_public.h"
28 #include "si_shader_internal.h"
31 #include "ac_llvm_util.h"
32 #include "radeon/radeon_uvd.h"
33 #include "gallivm/lp_bld_misc.h"
34 #include "util/disk_cache.h"
35 #include "util/u_log.h"
36 #include "util/u_memory.h"
37 #include "util/u_suballoc.h"
38 #include "util/u_tests.h"
39 #include "util/u_upload_mgr.h"
40 #include "util/xmlconfig.h"
41 #include "vl/vl_decoder.h"
42 #include "driver_ddebug/dd_util.h"
44 #include <llvm-c/Transforms/IPO.h>
45 #include <llvm-c/Transforms/Scalar.h>
46 #if HAVE_LLVM >= 0x0700
47 #include <llvm-c/Transforms/Utils.h>
50 static const struct debug_named_value debug_options
[] = {
51 /* Shader logging options: */
52 { "vs", DBG(VS
), "Print vertex shaders" },
53 { "ps", DBG(PS
), "Print pixel shaders" },
54 { "gs", DBG(GS
), "Print geometry shaders" },
55 { "tcs", DBG(TCS
), "Print tessellation control shaders" },
56 { "tes", DBG(TES
), "Print tessellation evaluation shaders" },
57 { "cs", DBG(CS
), "Print compute shaders" },
58 { "noir", DBG(NO_IR
), "Don't print the LLVM IR"},
59 { "notgsi", DBG(NO_TGSI
), "Don't print the TGSI"},
60 { "noasm", DBG(NO_ASM
), "Don't print disassembled shaders"},
61 { "preoptir", DBG(PREOPT_IR
), "Print the LLVM IR before initial optimizations" },
63 /* Shader compiler options the shader cache should be aware of: */
64 { "unsafemath", DBG(UNSAFE_MATH
), "Enable unsafe math shader optimizations" },
65 { "sisched", DBG(SI_SCHED
), "Enable LLVM SI Machine Instruction Scheduler." },
67 /* Shader compiler options (with no effect on the shader cache): */
68 { "checkir", DBG(CHECK_IR
), "Enable additional sanity checks on shader IR" },
69 { "nir", DBG(NIR
), "Enable experimental NIR shaders" },
70 { "mono", DBG(MONOLITHIC_SHADERS
), "Use old-style monolithic shaders compiled on demand" },
71 { "nooptvariant", DBG(NO_OPT_VARIANT
), "Disable compiling optimized shader variants." },
73 /* Information logging options: */
74 { "info", DBG(INFO
), "Print driver information" },
75 { "tex", DBG(TEX
), "Print texture info" },
76 { "compute", DBG(COMPUTE
), "Print compute info" },
77 { "vm", DBG(VM
), "Print virtual addresses when creating resources" },
80 { "forcedma", DBG(FORCE_DMA
), "Use asynchronous DMA for all operations when possible." },
81 { "nodma", DBG(NO_ASYNC_DMA
), "Disable asynchronous DMA" },
82 { "nowc", DBG(NO_WC
), "Disable GTT write combining" },
83 { "check_vm", DBG(CHECK_VM
), "Check VM faults and dump debug info." },
84 { "reserve_vmid", DBG(RESERVE_VMID
), "Force VMID reservation per context." },
85 { "zerovram", DBG(ZERO_VRAM
), "Clear VRAM allocations." },
87 /* 3D engine options: */
88 { "switch_on_eop", DBG(SWITCH_ON_EOP
), "Program WD/IA to switch on end-of-packet." },
89 { "nooutoforder", DBG(NO_OUT_OF_ORDER
), "Disable out-of-order rasterization" },
90 { "nodpbb", DBG(NO_DPBB
), "Disable DPBB." },
91 { "nodfsm", DBG(NO_DFSM
), "Disable DFSM." },
92 { "dpbb", DBG(DPBB
), "Enable DPBB." },
93 { "dfsm", DBG(DFSM
), "Enable DFSM." },
94 { "nohyperz", DBG(NO_HYPERZ
), "Disable Hyper-Z" },
95 { "norbplus", DBG(NO_RB_PLUS
), "Disable RB+." },
96 { "no2d", DBG(NO_2D_TILING
), "Disable 2D tiling" },
97 { "notiling", DBG(NO_TILING
), "Disable tiling" },
98 { "nodcc", DBG(NO_DCC
), "Disable DCC." },
99 { "nodccclear", DBG(NO_DCC_CLEAR
), "Disable DCC fast clear." },
100 { "nodccfb", DBG(NO_DCC_FB
), "Disable separate DCC on the main framebuffer" },
101 { "nodccmsaa", DBG(NO_DCC_MSAA
), "Disable DCC for MSAA" },
102 { "nofmask", DBG(NO_FMASK
), "Disable MSAA compression" },
105 { "testdma", DBG(TEST_DMA
), "Invoke SDMA tests and exit." },
106 { "testvmfaultcp", DBG(TEST_VMFAULT_CP
), "Invoke a CP VM fault test and exit." },
107 { "testvmfaultsdma", DBG(TEST_VMFAULT_SDMA
), "Invoke a SDMA VM fault test and exit." },
108 { "testvmfaultshader", DBG(TEST_VMFAULT_SHADER
), "Invoke a shader VM fault test and exit." },
110 DEBUG_NAMED_VALUE_END
/* must be last */
113 static void si_init_compiler(struct si_screen
*sscreen
,
114 struct si_compiler
*compiler
)
116 enum ac_target_machine_options tm_options
=
117 (sscreen
->debug_flags
& DBG(SI_SCHED
) ? AC_TM_SISCHED
: 0) |
118 (sscreen
->info
.chip_class
>= GFX9
? AC_TM_FORCE_ENABLE_XNACK
: 0) |
119 (sscreen
->info
.chip_class
< GFX9
? AC_TM_FORCE_DISABLE_XNACK
: 0) |
120 (!sscreen
->llvm_has_working_vgpr_indexing
? AC_TM_PROMOTE_ALLOCA_TO_SCRATCH
: 0);
122 compiler
->tm
= ac_create_target_machine(sscreen
->info
.family
,
123 tm_options
, &compiler
->triple
);
127 compiler
->target_library_info
=
128 gallivm_create_target_library_info(compiler
->triple
);
129 if (!compiler
->target_library_info
)
132 compiler
->passmgr
= LLVMCreatePassManager();
133 if (!compiler
->passmgr
)
136 LLVMAddTargetLibraryInfo(compiler
->target_library_info
,
139 /* Add LLVM passes into the pass manager. */
140 if (sscreen
->debug_flags
& DBG(CHECK_IR
))
141 LLVMAddVerifierPass(compiler
->passmgr
);
143 LLVMAddAlwaysInlinerPass(compiler
->passmgr
);
144 /* This pass should eliminate all the load and store instructions. */
145 LLVMAddPromoteMemoryToRegisterPass(compiler
->passmgr
);
146 LLVMAddScalarReplAggregatesPass(compiler
->passmgr
);
147 LLVMAddLICMPass(compiler
->passmgr
);
148 LLVMAddAggressiveDCEPass(compiler
->passmgr
);
149 LLVMAddCFGSimplificationPass(compiler
->passmgr
);
150 /* This is recommended by the instruction combining pass. */
151 LLVMAddEarlyCSEMemSSAPass(compiler
->passmgr
);
152 LLVMAddInstructionCombiningPass(compiler
->passmgr
);
154 /* Get the data layout. */
155 LLVMTargetDataRef data_layout
= LLVMCreateTargetDataLayout(compiler
->tm
);
158 compiler
->data_layout
= LLVMCopyStringRepOfTargetData(data_layout
);
159 LLVMDisposeTargetData(data_layout
);
162 static void si_destroy_compiler(struct si_compiler
*compiler
)
164 if (compiler
->data_layout
)
165 LLVMDisposeMessage((char*)compiler
->data_layout
);
166 if (compiler
->passmgr
)
167 LLVMDisposePassManager(compiler
->passmgr
);
168 #if HAVE_LLVM >= 0x0700
169 /* This crashes on LLVM 5.0 and 6.0 and Ubuntu 18.04, so leak it there. */
170 if (compiler
->target_library_info
)
171 gallivm_dispose_target_library_info(compiler
->target_library_info
);
174 LLVMDisposeTargetMachine(compiler
->tm
);
180 static void si_destroy_context(struct pipe_context
*context
)
182 struct si_context
*sctx
= (struct si_context
*)context
;
185 /* Unreference the framebuffer normally to disable related logic
188 struct pipe_framebuffer_state fb
= {};
189 if (context
->set_framebuffer_state
)
190 context
->set_framebuffer_state(context
, &fb
);
192 si_release_all_descriptors(sctx
);
194 pipe_resource_reference(&sctx
->esgs_ring
, NULL
);
195 pipe_resource_reference(&sctx
->gsvs_ring
, NULL
);
196 pipe_resource_reference(&sctx
->tess_rings
, NULL
);
197 pipe_resource_reference(&sctx
->null_const_buf
.buffer
, NULL
);
198 r600_resource_reference(&sctx
->border_color_buffer
, NULL
);
199 free(sctx
->border_color_table
);
200 r600_resource_reference(&sctx
->scratch_buffer
, NULL
);
201 r600_resource_reference(&sctx
->compute_scratch_buffer
, NULL
);
202 r600_resource_reference(&sctx
->wait_mem_scratch
, NULL
);
204 si_pm4_free_state(sctx
, sctx
->init_config
, ~0);
205 if (sctx
->init_config_gs_rings
)
206 si_pm4_free_state(sctx
, sctx
->init_config_gs_rings
, ~0);
207 for (i
= 0; i
< ARRAY_SIZE(sctx
->vgt_shader_config
); i
++)
208 si_pm4_delete_state(sctx
, vgt_shader_config
, sctx
->vgt_shader_config
[i
]);
210 if (sctx
->fixed_func_tcs_shader
.cso
)
211 sctx
->b
.delete_tcs_state(&sctx
->b
, sctx
->fixed_func_tcs_shader
.cso
);
212 if (sctx
->custom_dsa_flush
)
213 sctx
->b
.delete_depth_stencil_alpha_state(&sctx
->b
, sctx
->custom_dsa_flush
);
214 if (sctx
->custom_blend_resolve
)
215 sctx
->b
.delete_blend_state(&sctx
->b
, sctx
->custom_blend_resolve
);
216 if (sctx
->custom_blend_fmask_decompress
)
217 sctx
->b
.delete_blend_state(&sctx
->b
, sctx
->custom_blend_fmask_decompress
);
218 if (sctx
->custom_blend_eliminate_fastclear
)
219 sctx
->b
.delete_blend_state(&sctx
->b
, sctx
->custom_blend_eliminate_fastclear
);
220 if (sctx
->custom_blend_dcc_decompress
)
221 sctx
->b
.delete_blend_state(&sctx
->b
, sctx
->custom_blend_dcc_decompress
);
222 if (sctx
->vs_blit_pos
)
223 sctx
->b
.delete_vs_state(&sctx
->b
, sctx
->vs_blit_pos
);
224 if (sctx
->vs_blit_pos_layered
)
225 sctx
->b
.delete_vs_state(&sctx
->b
, sctx
->vs_blit_pos_layered
);
226 if (sctx
->vs_blit_color
)
227 sctx
->b
.delete_vs_state(&sctx
->b
, sctx
->vs_blit_color
);
228 if (sctx
->vs_blit_color_layered
)
229 sctx
->b
.delete_vs_state(&sctx
->b
, sctx
->vs_blit_color_layered
);
230 if (sctx
->vs_blit_texcoord
)
231 sctx
->b
.delete_vs_state(&sctx
->b
, sctx
->vs_blit_texcoord
);
234 util_blitter_destroy(sctx
->blitter
);
236 /* Release DCC stats. */
237 for (int i
= 0; i
< ARRAY_SIZE(sctx
->dcc_stats
); i
++) {
238 assert(!sctx
->dcc_stats
[i
].query_active
);
240 for (int j
= 0; j
< ARRAY_SIZE(sctx
->dcc_stats
[i
].ps_stats
); j
++)
241 if (sctx
->dcc_stats
[i
].ps_stats
[j
])
242 sctx
->b
.destroy_query(&sctx
->b
,
243 sctx
->dcc_stats
[i
].ps_stats
[j
]);
245 si_texture_reference(&sctx
->dcc_stats
[i
].tex
, NULL
);
248 if (sctx
->query_result_shader
)
249 sctx
->b
.delete_compute_state(&sctx
->b
, sctx
->query_result_shader
);
252 sctx
->ws
->cs_destroy(sctx
->gfx_cs
);
254 sctx
->ws
->cs_destroy(sctx
->dma_cs
);
256 sctx
->ws
->ctx_destroy(sctx
->ctx
);
258 if (sctx
->b
.stream_uploader
)
259 u_upload_destroy(sctx
->b
.stream_uploader
);
260 if (sctx
->b
.const_uploader
)
261 u_upload_destroy(sctx
->b
.const_uploader
);
262 if (sctx
->cached_gtt_allocator
)
263 u_upload_destroy(sctx
->cached_gtt_allocator
);
265 slab_destroy_child(&sctx
->pool_transfers
);
266 slab_destroy_child(&sctx
->pool_transfers_unsync
);
268 if (sctx
->allocator_zeroed_memory
)
269 u_suballocator_destroy(sctx
->allocator_zeroed_memory
);
271 sctx
->ws
->fence_reference(&sctx
->last_gfx_fence
, NULL
);
272 sctx
->ws
->fence_reference(&sctx
->last_sdma_fence
, NULL
);
273 r600_resource_reference(&sctx
->eop_bug_scratch
, NULL
);
275 si_destroy_compiler(&sctx
->compiler
);
277 si_saved_cs_reference(&sctx
->current_saved_cs
, NULL
);
279 _mesa_hash_table_destroy(sctx
->tex_handles
, NULL
);
280 _mesa_hash_table_destroy(sctx
->img_handles
, NULL
);
282 util_dynarray_fini(&sctx
->resident_tex_handles
);
283 util_dynarray_fini(&sctx
->resident_img_handles
);
284 util_dynarray_fini(&sctx
->resident_tex_needs_color_decompress
);
285 util_dynarray_fini(&sctx
->resident_img_needs_color_decompress
);
286 util_dynarray_fini(&sctx
->resident_tex_needs_depth_decompress
);
290 static enum pipe_reset_status
si_get_reset_status(struct pipe_context
*ctx
)
292 struct si_context
*sctx
= (struct si_context
*)ctx
;
294 if (sctx
->screen
->info
.has_gpu_reset_status_query
)
295 return sctx
->ws
->ctx_query_reset_status(sctx
->ctx
);
297 if (sctx
->screen
->info
.has_gpu_reset_counter_query
) {
298 unsigned latest
= sctx
->ws
->query_value(sctx
->ws
,
299 RADEON_GPU_RESET_COUNTER
);
301 if (sctx
->gpu_reset_counter
== latest
)
302 return PIPE_NO_RESET
;
304 sctx
->gpu_reset_counter
= latest
;
305 return PIPE_UNKNOWN_CONTEXT_RESET
;
308 return PIPE_NO_RESET
;
311 static void si_set_device_reset_callback(struct pipe_context
*ctx
,
312 const struct pipe_device_reset_callback
*cb
)
314 struct si_context
*sctx
= (struct si_context
*)ctx
;
317 sctx
->device_reset_callback
= *cb
;
319 memset(&sctx
->device_reset_callback
, 0,
320 sizeof(sctx
->device_reset_callback
));
323 bool si_check_device_reset(struct si_context
*sctx
)
325 enum pipe_reset_status status
;
327 if (!sctx
->device_reset_callback
.reset
)
330 if (!sctx
->b
.get_device_reset_status
)
333 status
= sctx
->b
.get_device_reset_status(&sctx
->b
);
334 if (status
== PIPE_NO_RESET
)
337 sctx
->device_reset_callback
.reset(sctx
->device_reset_callback
.data
, status
);
341 /* Apitrace profiling:
342 * 1) qapitrace : Tools -> Profile: Measure CPU & GPU times
343 * 2) In the middle panel, zoom in (mouse wheel) on some bad draw call
344 * and remember its number.
345 * 3) In Mesa, enable queries and performance counters around that draw
346 * call and print the results.
347 * 4) glretrace --benchmark --markers ..
349 static void si_emit_string_marker(struct pipe_context
*ctx
,
350 const char *string
, int len
)
352 struct si_context
*sctx
= (struct si_context
*)ctx
;
354 dd_parse_apitrace_marker(string
, len
, &sctx
->apitrace_call_number
);
357 u_log_printf(sctx
->log
, "\nString marker: %*s\n", len
, string
);
360 static void si_set_debug_callback(struct pipe_context
*ctx
,
361 const struct pipe_debug_callback
*cb
)
363 struct si_context
*sctx
= (struct si_context
*)ctx
;
364 struct si_screen
*screen
= sctx
->screen
;
366 util_queue_finish(&screen
->shader_compiler_queue
);
367 util_queue_finish(&screen
->shader_compiler_queue_low_priority
);
372 memset(&sctx
->debug
, 0, sizeof(sctx
->debug
));
375 static void si_set_log_context(struct pipe_context
*ctx
,
376 struct u_log_context
*log
)
378 struct si_context
*sctx
= (struct si_context
*)ctx
;
382 u_log_add_auto_logger(log
, si_auto_log_cs
, sctx
);
385 static struct pipe_context
*si_create_context(struct pipe_screen
*screen
,
388 struct si_context
*sctx
= CALLOC_STRUCT(si_context
);
389 struct si_screen
* sscreen
= (struct si_screen
*)screen
;
390 struct radeon_winsys
*ws
= sscreen
->ws
;
396 if (flags
& PIPE_CONTEXT_DEBUG
)
397 sscreen
->record_llvm_ir
= true; /* racy but not critical */
399 sctx
->b
.screen
= screen
; /* this must be set first */
401 sctx
->b
.destroy
= si_destroy_context
;
402 sctx
->b
.emit_string_marker
= si_emit_string_marker
;
403 sctx
->b
.set_debug_callback
= si_set_debug_callback
;
404 sctx
->b
.set_log_context
= si_set_log_context
;
405 sctx
->screen
= sscreen
; /* Easy accessing of screen/winsys. */
406 sctx
->is_debug
= (flags
& PIPE_CONTEXT_DEBUG
) != 0;
408 slab_create_child(&sctx
->pool_transfers
, &sscreen
->pool_transfers
);
409 slab_create_child(&sctx
->pool_transfers_unsync
, &sscreen
->pool_transfers
);
411 sctx
->ws
= sscreen
->ws
;
412 sctx
->family
= sscreen
->info
.family
;
413 sctx
->chip_class
= sscreen
->info
.chip_class
;
415 if (sscreen
->info
.has_gpu_reset_counter_query
) {
416 sctx
->gpu_reset_counter
=
417 sctx
->ws
->query_value(sctx
->ws
, RADEON_GPU_RESET_COUNTER
);
420 sctx
->b
.get_device_reset_status
= si_get_reset_status
;
421 sctx
->b
.set_device_reset_callback
= si_set_device_reset_callback
;
423 si_init_context_texture_functions(sctx
);
424 si_init_query_functions(sctx
);
426 if (sctx
->chip_class
== CIK
||
427 sctx
->chip_class
== VI
||
428 sctx
->chip_class
== GFX9
) {
429 sctx
->eop_bug_scratch
= r600_resource(
430 pipe_buffer_create(&sscreen
->b
, 0, PIPE_USAGE_DEFAULT
,
431 16 * sscreen
->info
.num_render_backends
));
432 if (!sctx
->eop_bug_scratch
)
436 sctx
->allocator_zeroed_memory
=
437 u_suballocator_create(&sctx
->b
, sscreen
->info
.gart_page_size
,
438 0, PIPE_USAGE_DEFAULT
, 0, true);
439 if (!sctx
->allocator_zeroed_memory
)
442 sctx
->b
.stream_uploader
= u_upload_create(&sctx
->b
, 1024 * 1024,
443 0, PIPE_USAGE_STREAM
,
444 SI_RESOURCE_FLAG_READ_ONLY
);
445 if (!sctx
->b
.stream_uploader
)
448 sctx
->b
.const_uploader
= u_upload_create(&sctx
->b
, 128 * 1024,
449 0, PIPE_USAGE_DEFAULT
,
450 SI_RESOURCE_FLAG_32BIT
|
451 (sscreen
->cpdma_prefetch_writes_memory
?
452 0 : SI_RESOURCE_FLAG_READ_ONLY
));
453 if (!sctx
->b
.const_uploader
)
456 sctx
->cached_gtt_allocator
= u_upload_create(&sctx
->b
, 16 * 1024,
457 0, PIPE_USAGE_STAGING
, 0);
458 if (!sctx
->cached_gtt_allocator
)
461 sctx
->ctx
= sctx
->ws
->ctx_create(sctx
->ws
);
465 if (sscreen
->info
.num_sdma_rings
&& !(sscreen
->debug_flags
& DBG(NO_ASYNC_DMA
))) {
466 sctx
->dma_cs
= sctx
->ws
->cs_create(sctx
->ctx
, RING_DMA
,
467 (void*)si_flush_dma_cs
,
471 si_init_buffer_functions(sctx
);
472 si_init_clear_functions(sctx
);
473 si_init_blit_functions(sctx
);
474 si_init_compute_functions(sctx
);
475 si_init_cp_dma_functions(sctx
);
476 si_init_debug_functions(sctx
);
477 si_init_msaa_functions(sctx
);
478 si_init_streamout_functions(sctx
);
480 if (sscreen
->info
.has_hw_decode
) {
481 sctx
->b
.create_video_codec
= si_uvd_create_decoder
;
482 sctx
->b
.create_video_buffer
= si_video_buffer_create
;
484 sctx
->b
.create_video_codec
= vl_create_decoder
;
485 sctx
->b
.create_video_buffer
= vl_video_buffer_create
;
488 sctx
->gfx_cs
= ws
->cs_create(sctx
->ctx
, RING_GFX
,
489 (void*)si_flush_gfx_cs
, sctx
);
492 sctx
->border_color_table
= malloc(SI_MAX_BORDER_COLORS
*
493 sizeof(*sctx
->border_color_table
));
494 if (!sctx
->border_color_table
)
497 sctx
->border_color_buffer
= r600_resource(
498 pipe_buffer_create(screen
, 0, PIPE_USAGE_DEFAULT
,
499 SI_MAX_BORDER_COLORS
*
500 sizeof(*sctx
->border_color_table
)));
501 if (!sctx
->border_color_buffer
)
504 sctx
->border_color_map
=
505 ws
->buffer_map(sctx
->border_color_buffer
->buf
,
506 NULL
, PIPE_TRANSFER_WRITE
);
507 if (!sctx
->border_color_map
)
510 si_init_all_descriptors(sctx
);
511 si_init_fence_functions(sctx
);
512 si_init_state_functions(sctx
);
513 si_init_shader_functions(sctx
);
514 si_init_viewport_functions(sctx
);
515 si_init_ia_multi_vgt_param_table(sctx
);
517 if (sctx
->chip_class
>= CIK
)
518 cik_init_sdma_functions(sctx
);
520 si_init_dma_functions(sctx
);
522 if (sscreen
->debug_flags
& DBG(FORCE_DMA
))
523 sctx
->b
.resource_copy_region
= sctx
->dma_copy
;
525 sctx
->blitter
= util_blitter_create(&sctx
->b
);
526 if (sctx
->blitter
== NULL
)
528 sctx
->blitter
->draw_rectangle
= si_draw_rectangle
;
529 sctx
->blitter
->skip_viewport_restore
= true;
531 sctx
->sample_mask
= 0xffff;
533 if (sctx
->chip_class
>= GFX9
) {
534 sctx
->wait_mem_scratch
= r600_resource(
535 pipe_buffer_create(screen
, 0, PIPE_USAGE_DEFAULT
, 4));
536 if (!sctx
->wait_mem_scratch
)
539 /* Initialize the memory. */
540 struct radeon_cmdbuf
*cs
= sctx
->gfx_cs
;
541 radeon_emit(cs
, PKT3(PKT3_WRITE_DATA
, 3, 0));
542 radeon_emit(cs
, S_370_DST_SEL(V_370_MEMORY_SYNC
) |
543 S_370_WR_CONFIRM(1) |
544 S_370_ENGINE_SEL(V_370_ME
));
545 radeon_emit(cs
, sctx
->wait_mem_scratch
->gpu_address
);
546 radeon_emit(cs
, sctx
->wait_mem_scratch
->gpu_address
>> 32);
547 radeon_emit(cs
, sctx
->wait_mem_number
);
548 radeon_add_to_buffer_list(sctx
, cs
, sctx
->wait_mem_scratch
,
549 RADEON_USAGE_WRITE
, RADEON_PRIO_FENCE
);
552 /* CIK cannot unbind a constant buffer (S_BUFFER_LOAD doesn't skip loads
553 * if NUM_RECORDS == 0). We need to use a dummy buffer instead. */
554 if (sctx
->chip_class
== CIK
) {
555 sctx
->null_const_buf
.buffer
=
556 pipe_aligned_buffer_create(screen
,
557 SI_RESOURCE_FLAG_32BIT
,
558 PIPE_USAGE_DEFAULT
, 16,
559 sctx
->screen
->info
.tcc_cache_line_size
);
560 if (!sctx
->null_const_buf
.buffer
)
562 sctx
->null_const_buf
.buffer_size
= sctx
->null_const_buf
.buffer
->width0
;
564 for (shader
= 0; shader
< SI_NUM_SHADERS
; shader
++) {
565 for (i
= 0; i
< SI_NUM_CONST_BUFFERS
; i
++) {
566 sctx
->b
.set_constant_buffer(&sctx
->b
, shader
, i
,
567 &sctx
->null_const_buf
);
571 si_set_rw_buffer(sctx
, SI_HS_CONST_DEFAULT_TESS_LEVELS
,
572 &sctx
->null_const_buf
);
573 si_set_rw_buffer(sctx
, SI_VS_CONST_INSTANCE_DIVISORS
,
574 &sctx
->null_const_buf
);
575 si_set_rw_buffer(sctx
, SI_VS_CONST_CLIP_PLANES
,
576 &sctx
->null_const_buf
);
577 si_set_rw_buffer(sctx
, SI_PS_CONST_POLY_STIPPLE
,
578 &sctx
->null_const_buf
);
579 si_set_rw_buffer(sctx
, SI_PS_CONST_SAMPLE_POSITIONS
,
580 &sctx
->null_const_buf
);
582 /* Clear the NULL constant buffer, because loads should return zeros. */
583 si_clear_buffer(sctx
, sctx
->null_const_buf
.buffer
, 0,
584 sctx
->null_const_buf
.buffer
->width0
, 0,
585 SI_COHERENCY_SHADER
);
588 uint64_t max_threads_per_block
;
589 screen
->get_compute_param(screen
, PIPE_SHADER_IR_TGSI
,
590 PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK
,
591 &max_threads_per_block
);
593 /* The maximum number of scratch waves. Scratch space isn't divided
594 * evenly between CUs. The number is only a function of the number of CUs.
595 * We can decrease the constant to decrease the scratch buffer size.
597 * sctx->scratch_waves must be >= the maximum posible size of
598 * 1 threadgroup, so that the hw doesn't hang from being unable
601 * The recommended value is 4 per CU at most. Higher numbers don't
602 * bring much benefit, but they still occupy chip resources (think
603 * async compute). I've seen ~2% performance difference between 4 and 32.
605 sctx
->scratch_waves
= MAX2(32 * sscreen
->info
.num_good_compute_units
,
606 max_threads_per_block
/ 64);
608 si_init_compiler(sscreen
, &sctx
->compiler
);
610 /* Bindless handles. */
611 sctx
->tex_handles
= _mesa_hash_table_create(NULL
, _mesa_hash_pointer
,
612 _mesa_key_pointer_equal
);
613 sctx
->img_handles
= _mesa_hash_table_create(NULL
, _mesa_hash_pointer
,
614 _mesa_key_pointer_equal
);
616 util_dynarray_init(&sctx
->resident_tex_handles
, NULL
);
617 util_dynarray_init(&sctx
->resident_img_handles
, NULL
);
618 util_dynarray_init(&sctx
->resident_tex_needs_color_decompress
, NULL
);
619 util_dynarray_init(&sctx
->resident_img_needs_color_decompress
, NULL
);
620 util_dynarray_init(&sctx
->resident_tex_needs_depth_decompress
, NULL
);
622 /* this must be last */
623 si_begin_new_gfx_cs(sctx
);
626 fprintf(stderr
, "radeonsi: Failed to create a context.\n");
627 si_destroy_context(&sctx
->b
);
631 static struct pipe_context
*si_pipe_create_context(struct pipe_screen
*screen
,
632 void *priv
, unsigned flags
)
634 struct si_screen
*sscreen
= (struct si_screen
*)screen
;
635 struct pipe_context
*ctx
;
637 if (sscreen
->debug_flags
& DBG(CHECK_VM
))
638 flags
|= PIPE_CONTEXT_DEBUG
;
640 ctx
= si_create_context(screen
, flags
);
642 if (!(flags
& PIPE_CONTEXT_PREFER_THREADED
))
645 /* Clover (compute-only) is unsupported. */
646 if (flags
& PIPE_CONTEXT_COMPUTE_ONLY
)
649 /* When shaders are logged to stderr, asynchronous compilation is
651 if (sscreen
->debug_flags
& DBG_ALL_SHADERS
)
654 /* Use asynchronous flushes only on amdgpu, since the radeon
655 * implementation for fence_server_sync is incomplete. */
656 return threaded_context_create(ctx
, &sscreen
->pool_transfers
,
657 si_replace_buffer_storage
,
658 sscreen
->info
.drm_major
>= 3 ? si_create_fence
: NULL
,
659 &((struct si_context
*)ctx
)->tc
);
665 static void si_destroy_screen(struct pipe_screen
* pscreen
)
667 struct si_screen
*sscreen
= (struct si_screen
*)pscreen
;
668 struct si_shader_part
*parts
[] = {
670 sscreen
->tcs_epilogs
,
677 if (!sscreen
->ws
->unref(sscreen
->ws
))
680 util_queue_destroy(&sscreen
->shader_compiler_queue
);
681 util_queue_destroy(&sscreen
->shader_compiler_queue_low_priority
);
683 for (i
= 0; i
< ARRAY_SIZE(sscreen
->compiler
); i
++)
684 si_destroy_compiler(&sscreen
->compiler
[i
]);
686 for (i
= 0; i
< ARRAY_SIZE(sscreen
->compiler_lowp
); i
++)
687 si_destroy_compiler(&sscreen
->compiler_lowp
[i
]);
689 /* Free shader parts. */
690 for (i
= 0; i
< ARRAY_SIZE(parts
); i
++) {
692 struct si_shader_part
*part
= parts
[i
];
694 parts
[i
] = part
->next
;
695 ac_shader_binary_clean(&part
->binary
);
699 mtx_destroy(&sscreen
->shader_parts_mutex
);
700 si_destroy_shader_cache(sscreen
);
702 si_perfcounters_destroy(sscreen
);
703 si_gpu_load_kill_thread(sscreen
);
705 mtx_destroy(&sscreen
->gpu_load_mutex
);
706 mtx_destroy(&sscreen
->aux_context_lock
);
707 sscreen
->aux_context
->destroy(sscreen
->aux_context
);
709 slab_destroy_parent(&sscreen
->pool_transfers
);
711 disk_cache_destroy(sscreen
->disk_shader_cache
);
712 sscreen
->ws
->destroy(sscreen
->ws
);
716 static void si_init_gs_info(struct si_screen
*sscreen
)
718 sscreen
->gs_table_depth
= ac_get_gs_table_depth(sscreen
->info
.chip_class
,
719 sscreen
->info
.family
);
722 static void si_handle_env_var_force_family(struct si_screen
*sscreen
)
724 const char *family
= debug_get_option("SI_FORCE_FAMILY", NULL
);
730 for (i
= CHIP_TAHITI
; i
< CHIP_LAST
; i
++) {
731 if (!strcmp(family
, ac_get_llvm_processor_name(i
))) {
732 /* Override family and chip_class. */
733 sscreen
->info
.family
= i
;
735 if (i
>= CHIP_VEGA10
)
736 sscreen
->info
.chip_class
= GFX9
;
737 else if (i
>= CHIP_TONGA
)
738 sscreen
->info
.chip_class
= VI
;
739 else if (i
>= CHIP_BONAIRE
)
740 sscreen
->info
.chip_class
= CIK
;
742 sscreen
->info
.chip_class
= SI
;
744 /* Don't submit any IBs. */
745 setenv("RADEON_NOOP", "1", 1);
750 fprintf(stderr
, "radeonsi: Unknown family: %s\n", family
);
754 static void si_test_vmfault(struct si_screen
*sscreen
)
756 struct pipe_context
*ctx
= sscreen
->aux_context
;
757 struct si_context
*sctx
= (struct si_context
*)ctx
;
758 struct pipe_resource
*buf
=
759 pipe_buffer_create_const0(&sscreen
->b
, 0, PIPE_USAGE_DEFAULT
, 64);
762 puts("Buffer allocation failed.");
766 r600_resource(buf
)->gpu_address
= 0; /* cause a VM fault */
768 if (sscreen
->debug_flags
& DBG(TEST_VMFAULT_CP
)) {
769 si_copy_buffer(sctx
, buf
, buf
, 0, 4, 4, 0);
770 ctx
->flush(ctx
, NULL
, 0);
771 puts("VM fault test: CP - done.");
773 if (sscreen
->debug_flags
& DBG(TEST_VMFAULT_SDMA
)) {
774 sctx
->dma_clear_buffer(sctx
, buf
, 0, 4, 0);
775 ctx
->flush(ctx
, NULL
, 0);
776 puts("VM fault test: SDMA - done.");
778 if (sscreen
->debug_flags
& DBG(TEST_VMFAULT_SHADER
)) {
779 util_test_constant_buffer(ctx
, buf
);
780 puts("VM fault test: Shader - done.");
785 static void si_disk_cache_create(struct si_screen
*sscreen
)
787 /* Don't use the cache if shader dumping is enabled. */
788 if (sscreen
->debug_flags
& DBG_ALL_SHADERS
)
791 uint32_t mesa_timestamp
;
792 if (disk_cache_get_function_timestamp(si_disk_cache_create
,
796 uint32_t llvm_timestamp
;
798 if (disk_cache_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo
,
800 res
= asprintf(×tamp_str
, "%u_%u",
801 mesa_timestamp
, llvm_timestamp
);
805 /* These flags affect shader compilation. */
806 #define ALL_FLAGS (DBG(FS_CORRECT_DERIVS_AFTER_KILL) | \
810 uint64_t shader_debug_flags
= sscreen
->debug_flags
&
813 /* Add the high bits of 32-bit addresses, which affects
814 * how 32-bit addresses are expanded to 64 bits.
816 STATIC_ASSERT(ALL_FLAGS
<= UINT_MAX
);
817 shader_debug_flags
|= (uint64_t)sscreen
->info
.address32_hi
<< 32;
819 sscreen
->disk_shader_cache
=
820 disk_cache_create(si_get_family_name(sscreen
),
828 struct pipe_screen
*radeonsi_screen_create(struct radeon_winsys
*ws
,
829 const struct pipe_screen_config
*config
)
831 struct si_screen
*sscreen
= CALLOC_STRUCT(si_screen
);
832 unsigned hw_threads
, num_comp_hi_threads
, num_comp_lo_threads
, i
;
839 ws
->query_info(ws
, &sscreen
->info
);
841 sscreen
->debug_flags
= debug_get_flags_option("R600_DEBUG",
844 /* Set functions first. */
845 sscreen
->b
.context_create
= si_pipe_create_context
;
846 sscreen
->b
.destroy
= si_destroy_screen
;
848 si_init_screen_get_functions(sscreen
);
849 si_init_screen_buffer_functions(sscreen
);
850 si_init_screen_fence_functions(sscreen
);
851 si_init_screen_state_functions(sscreen
);
852 si_init_screen_texture_functions(sscreen
);
853 si_init_screen_query_functions(sscreen
);
855 /* Set these flags in debug_flags early, so that the shader cache takes
858 if (driQueryOptionb(config
->options
,
859 "glsl_correct_derivatives_after_discard"))
860 sscreen
->debug_flags
|= DBG(FS_CORRECT_DERIVS_AFTER_KILL
);
861 if (driQueryOptionb(config
->options
, "radeonsi_enable_sisched"))
862 sscreen
->debug_flags
|= DBG(SI_SCHED
);
865 if (sscreen
->debug_flags
& DBG(INFO
))
866 ac_print_gpu_info(&sscreen
->info
);
868 slab_create_parent(&sscreen
->pool_transfers
,
869 sizeof(struct r600_transfer
), 64);
871 sscreen
->force_aniso
= MIN2(16, debug_get_num_option("R600_TEX_ANISO", -1));
872 if (sscreen
->force_aniso
>= 0) {
873 printf("radeonsi: Forcing anisotropy filter to %ix\n",
874 /* round down to a power of two */
875 1 << util_logbase2(sscreen
->force_aniso
));
878 (void) mtx_init(&sscreen
->aux_context_lock
, mtx_plain
);
879 (void) mtx_init(&sscreen
->gpu_load_mutex
, mtx_plain
);
881 si_init_gs_info(sscreen
);
882 if (!si_init_shader_cache(sscreen
)) {
887 si_disk_cache_create(sscreen
);
889 /* Determine the number of shader compiler threads. */
890 hw_threads
= sysconf(_SC_NPROCESSORS_ONLN
);
892 if (hw_threads
>= 12) {
893 num_comp_hi_threads
= hw_threads
* 3 / 4;
894 num_comp_lo_threads
= hw_threads
/ 3;
895 } else if (hw_threads
>= 6) {
896 num_comp_hi_threads
= hw_threads
- 2;
897 num_comp_lo_threads
= hw_threads
/ 2;
898 } else if (hw_threads
>= 2) {
899 num_comp_hi_threads
= hw_threads
- 1;
900 num_comp_lo_threads
= hw_threads
/ 2;
902 num_comp_hi_threads
= 1;
903 num_comp_lo_threads
= 1;
906 num_comp_hi_threads
= MIN2(num_comp_hi_threads
,
907 ARRAY_SIZE(sscreen
->compiler
));
908 num_comp_lo_threads
= MIN2(num_comp_lo_threads
,
909 ARRAY_SIZE(sscreen
->compiler_lowp
));
911 if (!util_queue_init(&sscreen
->shader_compiler_queue
, "si_shader",
912 64, num_comp_hi_threads
,
913 UTIL_QUEUE_INIT_RESIZE_IF_FULL
)) {
914 si_destroy_shader_cache(sscreen
);
919 if (!util_queue_init(&sscreen
->shader_compiler_queue_low_priority
,
921 64, num_comp_lo_threads
,
922 UTIL_QUEUE_INIT_RESIZE_IF_FULL
|
923 UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY
)) {
924 si_destroy_shader_cache(sscreen
);
929 si_handle_env_var_force_family(sscreen
);
931 if (!debug_get_bool_option("RADEON_DISABLE_PERFCOUNTERS", false))
932 si_init_perfcounters(sscreen
);
934 /* Determine tessellation ring info. */
935 bool double_offchip_buffers
= sscreen
->info
.chip_class
>= CIK
&&
936 sscreen
->info
.family
!= CHIP_CARRIZO
&&
937 sscreen
->info
.family
!= CHIP_STONEY
;
938 /* This must be one less than the maximum number due to a hw limitation.
939 * Various hardware bugs in SI, CIK, and GFX9 need this.
941 unsigned max_offchip_buffers_per_se
;
943 /* Only certain chips can use the maximum value. */
944 if (sscreen
->info
.family
== CHIP_VEGA12
)
945 max_offchip_buffers_per_se
= double_offchip_buffers
? 128 : 64;
947 max_offchip_buffers_per_se
= double_offchip_buffers
? 127 : 63;
949 unsigned max_offchip_buffers
= max_offchip_buffers_per_se
*
950 sscreen
->info
.max_se
;
951 unsigned offchip_granularity
;
953 /* Hawaii has a bug with offchip buffers > 256 that can be worked
954 * around by setting 4K granularity.
956 if (sscreen
->info
.family
== CHIP_HAWAII
) {
957 sscreen
->tess_offchip_block_dw_size
= 4096;
958 offchip_granularity
= V_03093C_X_4K_DWORDS
;
960 sscreen
->tess_offchip_block_dw_size
= 8192;
961 offchip_granularity
= V_03093C_X_8K_DWORDS
;
964 sscreen
->tess_factor_ring_size
= 32768 * sscreen
->info
.max_se
;
965 assert(((sscreen
->tess_factor_ring_size
/ 4) & C_030938_SIZE
) == 0);
966 sscreen
->tess_offchip_ring_size
= max_offchip_buffers
*
967 sscreen
->tess_offchip_block_dw_size
* 4;
969 if (sscreen
->info
.chip_class
>= CIK
) {
970 if (sscreen
->info
.chip_class
>= VI
)
971 --max_offchip_buffers
;
972 sscreen
->vgt_hs_offchip_param
=
973 S_03093C_OFFCHIP_BUFFERING(max_offchip_buffers
) |
974 S_03093C_OFFCHIP_GRANULARITY(offchip_granularity
);
976 assert(offchip_granularity
== V_03093C_X_8K_DWORDS
);
977 sscreen
->vgt_hs_offchip_param
=
978 S_0089B0_OFFCHIP_BUFFERING(max_offchip_buffers
);
981 /* The mere presense of CLEAR_STATE in the IB causes random GPU hangs
983 sscreen
->has_clear_state
= sscreen
->info
.chip_class
>= CIK
;
985 sscreen
->has_distributed_tess
=
986 sscreen
->info
.chip_class
>= VI
&&
987 sscreen
->info
.max_se
>= 2;
989 sscreen
->has_draw_indirect_multi
=
990 (sscreen
->info
.family
>= CHIP_POLARIS10
) ||
991 (sscreen
->info
.chip_class
== VI
&&
992 sscreen
->info
.pfp_fw_version
>= 121 &&
993 sscreen
->info
.me_fw_version
>= 87) ||
994 (sscreen
->info
.chip_class
== CIK
&&
995 sscreen
->info
.pfp_fw_version
>= 211 &&
996 sscreen
->info
.me_fw_version
>= 173) ||
997 (sscreen
->info
.chip_class
== SI
&&
998 sscreen
->info
.pfp_fw_version
>= 79 &&
999 sscreen
->info
.me_fw_version
>= 142);
1001 sscreen
->has_out_of_order_rast
= sscreen
->info
.chip_class
>= VI
&&
1002 sscreen
->info
.max_se
>= 2 &&
1003 !(sscreen
->debug_flags
& DBG(NO_OUT_OF_ORDER
));
1004 sscreen
->assume_no_z_fights
=
1005 driQueryOptionb(config
->options
, "radeonsi_assume_no_z_fights");
1006 sscreen
->commutative_blend_add
=
1007 driQueryOptionb(config
->options
, "radeonsi_commutative_blend_add");
1008 sscreen
->clear_db_cache_before_clear
=
1009 driQueryOptionb(config
->options
, "radeonsi_clear_db_cache_before_clear");
1010 sscreen
->has_msaa_sample_loc_bug
= (sscreen
->info
.family
>= CHIP_POLARIS10
&&
1011 sscreen
->info
.family
<= CHIP_POLARIS12
) ||
1012 sscreen
->info
.family
== CHIP_VEGA10
||
1013 sscreen
->info
.family
== CHIP_RAVEN
;
1014 sscreen
->has_ls_vgpr_init_bug
= sscreen
->info
.family
== CHIP_VEGA10
||
1015 sscreen
->info
.family
== CHIP_RAVEN
;
1017 if (sscreen
->debug_flags
& DBG(DPBB
)) {
1018 sscreen
->dpbb_allowed
= true;
1020 /* Only enable primitive binning on Raven by default. */
1021 /* TODO: Investigate if binning is profitable on Vega12. */
1022 sscreen
->dpbb_allowed
= sscreen
->info
.family
== CHIP_RAVEN
&&
1023 !(sscreen
->debug_flags
& DBG(NO_DPBB
));
1026 if (sscreen
->debug_flags
& DBG(DFSM
)) {
1027 sscreen
->dfsm_allowed
= sscreen
->dpbb_allowed
;
1029 sscreen
->dfsm_allowed
= sscreen
->dpbb_allowed
&&
1030 !(sscreen
->debug_flags
& DBG(NO_DFSM
));
1033 /* While it would be nice not to have this flag, we are constrained
1034 * by the reality that LLVM 5.0 doesn't have working VGPR indexing
1037 sscreen
->llvm_has_working_vgpr_indexing
= sscreen
->info
.chip_class
<= VI
;
1039 /* Some chips have RB+ registers, but don't support RB+. Those must
1040 * always disable it.
1042 if (sscreen
->info
.family
== CHIP_STONEY
||
1043 sscreen
->info
.chip_class
>= GFX9
) {
1044 sscreen
->has_rbplus
= true;
1046 sscreen
->rbplus_allowed
=
1047 !(sscreen
->debug_flags
& DBG(NO_RB_PLUS
)) &&
1048 (sscreen
->info
.family
== CHIP_STONEY
||
1049 sscreen
->info
.family
== CHIP_VEGA12
||
1050 sscreen
->info
.family
== CHIP_RAVEN
);
1053 sscreen
->dcc_msaa_allowed
=
1054 !(sscreen
->debug_flags
& DBG(NO_DCC_MSAA
));
1056 sscreen
->cpdma_prefetch_writes_memory
= sscreen
->info
.chip_class
<= VI
;
1058 (void) mtx_init(&sscreen
->shader_parts_mutex
, mtx_plain
);
1059 sscreen
->use_monolithic_shaders
=
1060 (sscreen
->debug_flags
& DBG(MONOLITHIC_SHADERS
)) != 0;
1062 sscreen
->barrier_flags
.cp_to_L2
= SI_CONTEXT_INV_SMEM_L1
|
1063 SI_CONTEXT_INV_VMEM_L1
;
1064 if (sscreen
->info
.chip_class
<= VI
) {
1065 sscreen
->barrier_flags
.cp_to_L2
|= SI_CONTEXT_INV_GLOBAL_L2
;
1066 sscreen
->barrier_flags
.L2_to_cp
|= SI_CONTEXT_WRITEBACK_GLOBAL_L2
;
1069 if (debug_get_bool_option("RADEON_DUMP_SHADERS", false))
1070 sscreen
->debug_flags
|= DBG_ALL_SHADERS
;
1077 * That means 8 coverage samples, 4 Z/S samples, and 2 color samples.
1079 * s >= z >= c (ignoring this only wastes memory)
1084 * Only MSAA color and depth buffers are overriden.
1086 if (sscreen
->info
.has_eqaa_surface_allocator
) {
1087 const char *eqaa
= debug_get_option("EQAA", NULL
);
1090 if (eqaa
&& sscanf(eqaa
, "%u,%u,%u", &s
, &z
, &f
) == 3 && s
&& z
&& f
) {
1091 sscreen
->eqaa_force_coverage_samples
= s
;
1092 sscreen
->eqaa_force_z_samples
= z
;
1093 sscreen
->eqaa_force_color_samples
= f
;
1097 for (i
= 0; i
< num_comp_hi_threads
; i
++)
1098 si_init_compiler(sscreen
, &sscreen
->compiler
[i
]);
1099 for (i
= 0; i
< num_comp_lo_threads
; i
++)
1100 si_init_compiler(sscreen
, &sscreen
->compiler_lowp
[i
]);
1102 /* Create the auxiliary context. This must be done last. */
1103 sscreen
->aux_context
= si_create_context(&sscreen
->b
, 0);
1105 if (sscreen
->debug_flags
& DBG(TEST_DMA
))
1106 si_test_dma(sscreen
);
1108 if (sscreen
->debug_flags
& (DBG(TEST_VMFAULT_CP
) |
1109 DBG(TEST_VMFAULT_SDMA
) |
1110 DBG(TEST_VMFAULT_SHADER
)))
1111 si_test_vmfault(sscreen
);