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 "radeon/radeon_uvd.h"
32 #include "gallivm/lp_bld_misc.h"
33 #include "util/disk_cache.h"
34 #include "util/hash_table.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." },
86 /* 3D engine options: */
87 { "switch_on_eop", DBG(SWITCH_ON_EOP
), "Program WD/IA to switch on end-of-packet." },
88 { "nooutoforder", DBG(NO_OUT_OF_ORDER
), "Disable out-of-order rasterization" },
89 { "nodpbb", DBG(NO_DPBB
), "Disable DPBB." },
90 { "nodfsm", DBG(NO_DFSM
), "Disable DFSM." },
91 { "dpbb", DBG(DPBB
), "Enable DPBB." },
92 { "dfsm", DBG(DFSM
), "Enable DFSM." },
93 { "nohyperz", DBG(NO_HYPERZ
), "Disable Hyper-Z" },
94 { "norbplus", DBG(NO_RB_PLUS
), "Disable RB+." },
95 { "no2d", DBG(NO_2D_TILING
), "Disable 2D tiling" },
96 { "notiling", DBG(NO_TILING
), "Disable tiling" },
97 { "nodcc", DBG(NO_DCC
), "Disable DCC." },
98 { "nodccclear", DBG(NO_DCC_CLEAR
), "Disable DCC fast clear." },
99 { "nodccfb", DBG(NO_DCC_FB
), "Disable separate DCC on the main framebuffer" },
100 { "nodccmsaa", DBG(NO_DCC_MSAA
), "Disable DCC for MSAA" },
101 { "nofmask", DBG(NO_FMASK
), "Disable MSAA compression" },
104 { "testdma", DBG(TEST_DMA
), "Invoke SDMA tests and exit." },
105 { "testvmfaultcp", DBG(TEST_VMFAULT_CP
), "Invoke a CP VM fault test and exit." },
106 { "testvmfaultsdma", DBG(TEST_VMFAULT_SDMA
), "Invoke a SDMA VM fault test and exit." },
107 { "testvmfaultshader", DBG(TEST_VMFAULT_SHADER
), "Invoke a shader VM fault test and exit." },
109 DEBUG_NAMED_VALUE_END
/* must be last */
112 static void si_init_compiler(struct si_screen
*sscreen
,
113 struct si_compiler
*compiler
)
115 enum ac_target_machine_options tm_options
=
116 (sscreen
->debug_flags
& DBG(SI_SCHED
) ? AC_TM_SISCHED
: 0) |
117 (sscreen
->info
.chip_class
>= GFX9
? AC_TM_FORCE_ENABLE_XNACK
: 0) |
118 (sscreen
->info
.chip_class
< GFX9
? AC_TM_FORCE_DISABLE_XNACK
: 0) |
119 (!sscreen
->llvm_has_working_vgpr_indexing
? AC_TM_PROMOTE_ALLOCA_TO_SCRATCH
: 0);
121 compiler
->tm
= ac_create_target_machine(sscreen
->info
.family
,
122 tm_options
, &compiler
->triple
);
126 compiler
->target_library_info
=
127 gallivm_create_target_library_info(compiler
->triple
);
128 if (!compiler
->target_library_info
)
131 compiler
->passmgr
= LLVMCreatePassManager();
132 if (!compiler
->passmgr
)
135 LLVMAddTargetLibraryInfo(compiler
->target_library_info
,
138 /* Add LLVM passes into the pass manager. */
139 if (sscreen
->debug_flags
& DBG(CHECK_IR
))
140 LLVMAddVerifierPass(compiler
->passmgr
);
142 LLVMAddAlwaysInlinerPass(compiler
->passmgr
);
143 /* This pass should eliminate all the load and store instructions. */
144 LLVMAddPromoteMemoryToRegisterPass(compiler
->passmgr
);
145 LLVMAddScalarReplAggregatesPass(compiler
->passmgr
);
146 LLVMAddLICMPass(compiler
->passmgr
);
147 LLVMAddAggressiveDCEPass(compiler
->passmgr
);
148 LLVMAddCFGSimplificationPass(compiler
->passmgr
);
149 /* This is recommended by the instruction combining pass. */
150 LLVMAddEarlyCSEMemSSAPass(compiler
->passmgr
);
151 LLVMAddInstructionCombiningPass(compiler
->passmgr
);
153 /* Get the data layout. */
154 LLVMTargetDataRef data_layout
= LLVMCreateTargetDataLayout(compiler
->tm
);
157 compiler
->data_layout
= LLVMCopyStringRepOfTargetData(data_layout
);
158 LLVMDisposeTargetData(data_layout
);
161 static void si_destroy_compiler(struct si_compiler
*compiler
)
163 if (compiler
->data_layout
)
164 LLVMDisposeMessage((char*)compiler
->data_layout
);
165 if (compiler
->passmgr
)
166 LLVMDisposePassManager(compiler
->passmgr
);
167 #if HAVE_LLVM < 0x0500 || HAVE_LLVM >= 0x0700
168 /* This crashes on LLVM 5.0 and 6.0 and Ubuntu 18.04, so leak it there. */
169 if (compiler
->target_library_info
)
170 gallivm_dispose_target_library_info(compiler
->target_library_info
);
173 LLVMDisposeTargetMachine(compiler
->tm
);
179 static void si_destroy_context(struct pipe_context
*context
)
181 struct si_context
*sctx
= (struct si_context
*)context
;
184 /* Unreference the framebuffer normally to disable related logic
187 struct pipe_framebuffer_state fb
= {};
188 if (context
->set_framebuffer_state
)
189 context
->set_framebuffer_state(context
, &fb
);
191 si_release_all_descriptors(sctx
);
193 pipe_resource_reference(&sctx
->esgs_ring
, NULL
);
194 pipe_resource_reference(&sctx
->gsvs_ring
, NULL
);
195 pipe_resource_reference(&sctx
->tess_rings
, NULL
);
196 pipe_resource_reference(&sctx
->null_const_buf
.buffer
, NULL
);
197 r600_resource_reference(&sctx
->border_color_buffer
, NULL
);
198 free(sctx
->border_color_table
);
199 r600_resource_reference(&sctx
->scratch_buffer
, NULL
);
200 r600_resource_reference(&sctx
->compute_scratch_buffer
, NULL
);
201 r600_resource_reference(&sctx
->wait_mem_scratch
, NULL
);
203 si_pm4_free_state(sctx
, sctx
->init_config
, ~0);
204 if (sctx
->init_config_gs_rings
)
205 si_pm4_free_state(sctx
, sctx
->init_config_gs_rings
, ~0);
206 for (i
= 0; i
< ARRAY_SIZE(sctx
->vgt_shader_config
); i
++)
207 si_pm4_delete_state(sctx
, vgt_shader_config
, sctx
->vgt_shader_config
[i
]);
209 if (sctx
->fixed_func_tcs_shader
.cso
)
210 sctx
->b
.delete_tcs_state(&sctx
->b
, sctx
->fixed_func_tcs_shader
.cso
);
211 if (sctx
->custom_dsa_flush
)
212 sctx
->b
.delete_depth_stencil_alpha_state(&sctx
->b
, sctx
->custom_dsa_flush
);
213 if (sctx
->custom_blend_resolve
)
214 sctx
->b
.delete_blend_state(&sctx
->b
, sctx
->custom_blend_resolve
);
215 if (sctx
->custom_blend_fmask_decompress
)
216 sctx
->b
.delete_blend_state(&sctx
->b
, sctx
->custom_blend_fmask_decompress
);
217 if (sctx
->custom_blend_eliminate_fastclear
)
218 sctx
->b
.delete_blend_state(&sctx
->b
, sctx
->custom_blend_eliminate_fastclear
);
219 if (sctx
->custom_blend_dcc_decompress
)
220 sctx
->b
.delete_blend_state(&sctx
->b
, sctx
->custom_blend_dcc_decompress
);
221 if (sctx
->vs_blit_pos
)
222 sctx
->b
.delete_vs_state(&sctx
->b
, sctx
->vs_blit_pos
);
223 if (sctx
->vs_blit_pos_layered
)
224 sctx
->b
.delete_vs_state(&sctx
->b
, sctx
->vs_blit_pos_layered
);
225 if (sctx
->vs_blit_color
)
226 sctx
->b
.delete_vs_state(&sctx
->b
, sctx
->vs_blit_color
);
227 if (sctx
->vs_blit_color_layered
)
228 sctx
->b
.delete_vs_state(&sctx
->b
, sctx
->vs_blit_color_layered
);
229 if (sctx
->vs_blit_texcoord
)
230 sctx
->b
.delete_vs_state(&sctx
->b
, sctx
->vs_blit_texcoord
);
233 util_blitter_destroy(sctx
->blitter
);
235 /* Release DCC stats. */
236 for (int i
= 0; i
< ARRAY_SIZE(sctx
->dcc_stats
); i
++) {
237 assert(!sctx
->dcc_stats
[i
].query_active
);
239 for (int j
= 0; j
< ARRAY_SIZE(sctx
->dcc_stats
[i
].ps_stats
); j
++)
240 if (sctx
->dcc_stats
[i
].ps_stats
[j
])
241 sctx
->b
.destroy_query(&sctx
->b
,
242 sctx
->dcc_stats
[i
].ps_stats
[j
]);
244 r600_texture_reference(&sctx
->dcc_stats
[i
].tex
, NULL
);
247 if (sctx
->query_result_shader
)
248 sctx
->b
.delete_compute_state(&sctx
->b
, sctx
->query_result_shader
);
251 sctx
->ws
->cs_destroy(sctx
->gfx_cs
);
253 sctx
->ws
->cs_destroy(sctx
->dma_cs
);
255 sctx
->ws
->ctx_destroy(sctx
->ctx
);
257 if (sctx
->b
.stream_uploader
)
258 u_upload_destroy(sctx
->b
.stream_uploader
);
259 if (sctx
->b
.const_uploader
)
260 u_upload_destroy(sctx
->b
.const_uploader
);
261 if (sctx
->cached_gtt_allocator
)
262 u_upload_destroy(sctx
->cached_gtt_allocator
);
264 slab_destroy_child(&sctx
->pool_transfers
);
265 slab_destroy_child(&sctx
->pool_transfers_unsync
);
267 if (sctx
->allocator_zeroed_memory
)
268 u_suballocator_destroy(sctx
->allocator_zeroed_memory
);
270 sctx
->ws
->fence_reference(&sctx
->last_gfx_fence
, NULL
);
271 sctx
->ws
->fence_reference(&sctx
->last_sdma_fence
, NULL
);
272 r600_resource_reference(&sctx
->eop_bug_scratch
, NULL
);
274 si_destroy_compiler(&sctx
->compiler
);
276 si_saved_cs_reference(&sctx
->current_saved_cs
, NULL
);
278 _mesa_hash_table_destroy(sctx
->tex_handles
, NULL
);
279 _mesa_hash_table_destroy(sctx
->img_handles
, NULL
);
281 util_dynarray_fini(&sctx
->resident_tex_handles
);
282 util_dynarray_fini(&sctx
->resident_img_handles
);
283 util_dynarray_fini(&sctx
->resident_tex_needs_color_decompress
);
284 util_dynarray_fini(&sctx
->resident_img_needs_color_decompress
);
285 util_dynarray_fini(&sctx
->resident_tex_needs_depth_decompress
);
289 static enum pipe_reset_status
si_get_reset_status(struct pipe_context
*ctx
)
291 struct si_context
*sctx
= (struct si_context
*)ctx
;
293 if (sctx
->screen
->info
.has_gpu_reset_status_query
)
294 return sctx
->ws
->ctx_query_reset_status(sctx
->ctx
);
296 if (sctx
->screen
->info
.has_gpu_reset_counter_query
) {
297 unsigned latest
= sctx
->ws
->query_value(sctx
->ws
,
298 RADEON_GPU_RESET_COUNTER
);
300 if (sctx
->gpu_reset_counter
== latest
)
301 return PIPE_NO_RESET
;
303 sctx
->gpu_reset_counter
= latest
;
304 return PIPE_UNKNOWN_CONTEXT_RESET
;
307 return PIPE_NO_RESET
;
310 static void si_set_device_reset_callback(struct pipe_context
*ctx
,
311 const struct pipe_device_reset_callback
*cb
)
313 struct si_context
*sctx
= (struct si_context
*)ctx
;
316 sctx
->device_reset_callback
= *cb
;
318 memset(&sctx
->device_reset_callback
, 0,
319 sizeof(sctx
->device_reset_callback
));
322 bool si_check_device_reset(struct si_context
*sctx
)
324 enum pipe_reset_status status
;
326 if (!sctx
->device_reset_callback
.reset
)
329 if (!sctx
->b
.get_device_reset_status
)
332 status
= sctx
->b
.get_device_reset_status(&sctx
->b
);
333 if (status
== PIPE_NO_RESET
)
336 sctx
->device_reset_callback
.reset(sctx
->device_reset_callback
.data
, status
);
340 /* Apitrace profiling:
341 * 1) qapitrace : Tools -> Profile: Measure CPU & GPU times
342 * 2) In the middle panel, zoom in (mouse wheel) on some bad draw call
343 * and remember its number.
344 * 3) In Mesa, enable queries and performance counters around that draw
345 * call and print the results.
346 * 4) glretrace --benchmark --markers ..
348 static void si_emit_string_marker(struct pipe_context
*ctx
,
349 const char *string
, int len
)
351 struct si_context
*sctx
= (struct si_context
*)ctx
;
353 dd_parse_apitrace_marker(string
, len
, &sctx
->apitrace_call_number
);
356 u_log_printf(sctx
->log
, "\nString marker: %*s\n", len
, string
);
359 static void si_set_debug_callback(struct pipe_context
*ctx
,
360 const struct pipe_debug_callback
*cb
)
362 struct si_context
*sctx
= (struct si_context
*)ctx
;
363 struct si_screen
*screen
= sctx
->screen
;
365 util_queue_finish(&screen
->shader_compiler_queue
);
366 util_queue_finish(&screen
->shader_compiler_queue_low_priority
);
371 memset(&sctx
->debug
, 0, sizeof(sctx
->debug
));
374 static void si_set_log_context(struct pipe_context
*ctx
,
375 struct u_log_context
*log
)
377 struct si_context
*sctx
= (struct si_context
*)ctx
;
381 u_log_add_auto_logger(log
, si_auto_log_cs
, sctx
);
384 static struct pipe_context
*si_create_context(struct pipe_screen
*screen
,
387 struct si_context
*sctx
= CALLOC_STRUCT(si_context
);
388 struct si_screen
* sscreen
= (struct si_screen
*)screen
;
389 struct radeon_winsys
*ws
= sscreen
->ws
;
395 if (flags
& PIPE_CONTEXT_DEBUG
)
396 sscreen
->record_llvm_ir
= true; /* racy but not critical */
398 sctx
->b
.screen
= screen
; /* this must be set first */
400 sctx
->b
.destroy
= si_destroy_context
;
401 sctx
->b
.emit_string_marker
= si_emit_string_marker
;
402 sctx
->b
.set_debug_callback
= si_set_debug_callback
;
403 sctx
->b
.set_log_context
= si_set_log_context
;
404 sctx
->screen
= sscreen
; /* Easy accessing of screen/winsys. */
405 sctx
->is_debug
= (flags
& PIPE_CONTEXT_DEBUG
) != 0;
407 slab_create_child(&sctx
->pool_transfers
, &sscreen
->pool_transfers
);
408 slab_create_child(&sctx
->pool_transfers_unsync
, &sscreen
->pool_transfers
);
410 sctx
->ws
= sscreen
->ws
;
411 sctx
->family
= sscreen
->info
.family
;
412 sctx
->chip_class
= sscreen
->info
.chip_class
;
414 if (sscreen
->info
.has_gpu_reset_counter_query
) {
415 sctx
->gpu_reset_counter
=
416 sctx
->ws
->query_value(sctx
->ws
, RADEON_GPU_RESET_COUNTER
);
419 sctx
->b
.get_device_reset_status
= si_get_reset_status
;
420 sctx
->b
.set_device_reset_callback
= si_set_device_reset_callback
;
422 si_init_context_texture_functions(sctx
);
423 si_init_query_functions(sctx
);
425 if (sctx
->chip_class
== CIK
||
426 sctx
->chip_class
== VI
||
427 sctx
->chip_class
== GFX9
) {
428 sctx
->eop_bug_scratch
= r600_resource(
429 pipe_buffer_create(&sscreen
->b
, 0, PIPE_USAGE_DEFAULT
,
430 16 * sscreen
->info
.num_render_backends
));
431 if (!sctx
->eop_bug_scratch
)
435 sctx
->allocator_zeroed_memory
=
436 u_suballocator_create(&sctx
->b
, sscreen
->info
.gart_page_size
,
437 0, PIPE_USAGE_DEFAULT
, 0, true);
438 if (!sctx
->allocator_zeroed_memory
)
441 sctx
->b
.stream_uploader
= u_upload_create(&sctx
->b
, 1024 * 1024,
442 0, PIPE_USAGE_STREAM
,
443 SI_RESOURCE_FLAG_READ_ONLY
);
444 if (!sctx
->b
.stream_uploader
)
447 sctx
->b
.const_uploader
= u_upload_create(&sctx
->b
, 128 * 1024,
448 0, PIPE_USAGE_DEFAULT
,
449 SI_RESOURCE_FLAG_32BIT
|
450 (sscreen
->cpdma_prefetch_writes_memory
?
451 0 : SI_RESOURCE_FLAG_READ_ONLY
));
452 if (!sctx
->b
.const_uploader
)
455 sctx
->cached_gtt_allocator
= u_upload_create(&sctx
->b
, 16 * 1024,
456 0, PIPE_USAGE_STAGING
, 0);
457 if (!sctx
->cached_gtt_allocator
)
460 sctx
->ctx
= sctx
->ws
->ctx_create(sctx
->ws
);
464 if (sscreen
->info
.num_sdma_rings
&& !(sscreen
->debug_flags
& DBG(NO_ASYNC_DMA
))) {
465 sctx
->dma_cs
= sctx
->ws
->cs_create(sctx
->ctx
, RING_DMA
,
466 (void*)si_flush_dma_cs
,
470 si_init_buffer_functions(sctx
);
471 si_init_clear_functions(sctx
);
472 si_init_blit_functions(sctx
);
473 si_init_compute_functions(sctx
);
474 si_init_cp_dma_functions(sctx
);
475 si_init_debug_functions(sctx
);
476 si_init_msaa_functions(sctx
);
477 si_init_streamout_functions(sctx
);
479 if (sscreen
->info
.has_hw_decode
) {
480 sctx
->b
.create_video_codec
= si_uvd_create_decoder
;
481 sctx
->b
.create_video_buffer
= si_video_buffer_create
;
483 sctx
->b
.create_video_codec
= vl_create_decoder
;
484 sctx
->b
.create_video_buffer
= vl_video_buffer_create
;
487 sctx
->gfx_cs
= ws
->cs_create(sctx
->ctx
, RING_GFX
,
488 (void*)si_flush_gfx_cs
, sctx
);
491 sctx
->border_color_table
= malloc(SI_MAX_BORDER_COLORS
*
492 sizeof(*sctx
->border_color_table
));
493 if (!sctx
->border_color_table
)
496 sctx
->border_color_buffer
= r600_resource(
497 pipe_buffer_create(screen
, 0, PIPE_USAGE_DEFAULT
,
498 SI_MAX_BORDER_COLORS
*
499 sizeof(*sctx
->border_color_table
)));
500 if (!sctx
->border_color_buffer
)
503 sctx
->border_color_map
=
504 ws
->buffer_map(sctx
->border_color_buffer
->buf
,
505 NULL
, PIPE_TRANSFER_WRITE
);
506 if (!sctx
->border_color_map
)
509 si_init_all_descriptors(sctx
);
510 si_init_fence_functions(sctx
);
511 si_init_state_functions(sctx
);
512 si_init_shader_functions(sctx
);
513 si_init_viewport_functions(sctx
);
514 si_init_ia_multi_vgt_param_table(sctx
);
516 if (sctx
->chip_class
>= CIK
)
517 cik_init_sdma_functions(sctx
);
519 si_init_dma_functions(sctx
);
521 if (sscreen
->debug_flags
& DBG(FORCE_DMA
))
522 sctx
->b
.resource_copy_region
= sctx
->dma_copy
;
524 sctx
->blitter
= util_blitter_create(&sctx
->b
);
525 if (sctx
->blitter
== NULL
)
527 sctx
->blitter
->draw_rectangle
= si_draw_rectangle
;
528 sctx
->blitter
->skip_viewport_restore
= true;
530 sctx
->sample_mask
= 0xffff;
532 if (sctx
->chip_class
>= GFX9
) {
533 sctx
->wait_mem_scratch
= r600_resource(
534 pipe_buffer_create(screen
, 0, PIPE_USAGE_DEFAULT
, 4));
535 if (!sctx
->wait_mem_scratch
)
538 /* Initialize the memory. */
539 struct radeon_winsys_cs
*cs
= sctx
->gfx_cs
;
540 radeon_emit(cs
, PKT3(PKT3_WRITE_DATA
, 3, 0));
541 radeon_emit(cs
, S_370_DST_SEL(V_370_MEMORY_SYNC
) |
542 S_370_WR_CONFIRM(1) |
543 S_370_ENGINE_SEL(V_370_ME
));
544 radeon_emit(cs
, sctx
->wait_mem_scratch
->gpu_address
);
545 radeon_emit(cs
, sctx
->wait_mem_scratch
->gpu_address
>> 32);
546 radeon_emit(cs
, sctx
->wait_mem_number
);
547 radeon_add_to_buffer_list(sctx
, cs
, sctx
->wait_mem_scratch
,
548 RADEON_USAGE_WRITE
, RADEON_PRIO_FENCE
);
551 /* CIK cannot unbind a constant buffer (S_BUFFER_LOAD doesn't skip loads
552 * if NUM_RECORDS == 0). We need to use a dummy buffer instead. */
553 if (sctx
->chip_class
== CIK
) {
554 sctx
->null_const_buf
.buffer
=
555 pipe_aligned_buffer_create(screen
,
556 SI_RESOURCE_FLAG_32BIT
,
557 PIPE_USAGE_DEFAULT
, 16,
558 sctx
->screen
->info
.tcc_cache_line_size
);
559 if (!sctx
->null_const_buf
.buffer
)
561 sctx
->null_const_buf
.buffer_size
= sctx
->null_const_buf
.buffer
->width0
;
563 for (shader
= 0; shader
< SI_NUM_SHADERS
; shader
++) {
564 for (i
= 0; i
< SI_NUM_CONST_BUFFERS
; i
++) {
565 sctx
->b
.set_constant_buffer(&sctx
->b
, shader
, i
,
566 &sctx
->null_const_buf
);
570 si_set_rw_buffer(sctx
, SI_HS_CONST_DEFAULT_TESS_LEVELS
,
571 &sctx
->null_const_buf
);
572 si_set_rw_buffer(sctx
, SI_VS_CONST_INSTANCE_DIVISORS
,
573 &sctx
->null_const_buf
);
574 si_set_rw_buffer(sctx
, SI_VS_CONST_CLIP_PLANES
,
575 &sctx
->null_const_buf
);
576 si_set_rw_buffer(sctx
, SI_PS_CONST_POLY_STIPPLE
,
577 &sctx
->null_const_buf
);
578 si_set_rw_buffer(sctx
, SI_PS_CONST_SAMPLE_POSITIONS
,
579 &sctx
->null_const_buf
);
581 /* Clear the NULL constant buffer, because loads should return zeros. */
582 si_clear_buffer(sctx
, sctx
->null_const_buf
.buffer
, 0,
583 sctx
->null_const_buf
.buffer
->width0
, 0,
584 SI_COHERENCY_SHADER
);
587 uint64_t max_threads_per_block
;
588 screen
->get_compute_param(screen
, PIPE_SHADER_IR_TGSI
,
589 PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK
,
590 &max_threads_per_block
);
592 /* The maximum number of scratch waves. Scratch space isn't divided
593 * evenly between CUs. The number is only a function of the number of CUs.
594 * We can decrease the constant to decrease the scratch buffer size.
596 * sctx->scratch_waves must be >= the maximum posible size of
597 * 1 threadgroup, so that the hw doesn't hang from being unable
600 * The recommended value is 4 per CU at most. Higher numbers don't
601 * bring much benefit, but they still occupy chip resources (think
602 * async compute). I've seen ~2% performance difference between 4 and 32.
604 sctx
->scratch_waves
= MAX2(32 * sscreen
->info
.num_good_compute_units
,
605 max_threads_per_block
/ 64);
607 si_init_compiler(sscreen
, &sctx
->compiler
);
609 /* Bindless handles. */
610 sctx
->tex_handles
= _mesa_hash_table_create(NULL
, _mesa_hash_pointer
,
611 _mesa_key_pointer_equal
);
612 sctx
->img_handles
= _mesa_hash_table_create(NULL
, _mesa_hash_pointer
,
613 _mesa_key_pointer_equal
);
615 util_dynarray_init(&sctx
->resident_tex_handles
, NULL
);
616 util_dynarray_init(&sctx
->resident_img_handles
, NULL
);
617 util_dynarray_init(&sctx
->resident_tex_needs_color_decompress
, NULL
);
618 util_dynarray_init(&sctx
->resident_img_needs_color_decompress
, NULL
);
619 util_dynarray_init(&sctx
->resident_tex_needs_depth_decompress
, NULL
);
621 /* this must be last */
622 si_begin_new_gfx_cs(sctx
);
625 fprintf(stderr
, "radeonsi: Failed to create a context.\n");
626 si_destroy_context(&sctx
->b
);
630 static struct pipe_context
*si_pipe_create_context(struct pipe_screen
*screen
,
631 void *priv
, unsigned flags
)
633 struct si_screen
*sscreen
= (struct si_screen
*)screen
;
634 struct pipe_context
*ctx
;
636 if (sscreen
->debug_flags
& DBG(CHECK_VM
))
637 flags
|= PIPE_CONTEXT_DEBUG
;
639 ctx
= si_create_context(screen
, flags
);
641 if (!(flags
& PIPE_CONTEXT_PREFER_THREADED
))
644 /* Clover (compute-only) is unsupported. */
645 if (flags
& PIPE_CONTEXT_COMPUTE_ONLY
)
648 /* When shaders are logged to stderr, asynchronous compilation is
650 if (sscreen
->debug_flags
& DBG_ALL_SHADERS
)
653 /* Use asynchronous flushes only on amdgpu, since the radeon
654 * implementation for fence_server_sync is incomplete. */
655 return threaded_context_create(ctx
, &sscreen
->pool_transfers
,
656 si_replace_buffer_storage
,
657 sscreen
->info
.drm_major
>= 3 ? si_create_fence
: NULL
,
658 &((struct si_context
*)ctx
)->tc
);
664 static void si_destroy_screen(struct pipe_screen
* pscreen
)
666 struct si_screen
*sscreen
= (struct si_screen
*)pscreen
;
667 struct si_shader_part
*parts
[] = {
669 sscreen
->tcs_epilogs
,
676 if (!sscreen
->ws
->unref(sscreen
->ws
))
679 util_queue_destroy(&sscreen
->shader_compiler_queue
);
680 util_queue_destroy(&sscreen
->shader_compiler_queue_low_priority
);
682 for (i
= 0; i
< ARRAY_SIZE(sscreen
->compiler
); i
++)
683 si_destroy_compiler(&sscreen
->compiler
[i
]);
685 for (i
= 0; i
< ARRAY_SIZE(sscreen
->compiler_lowp
); i
++)
686 si_destroy_compiler(&sscreen
->compiler_lowp
[i
]);
688 /* Free shader parts. */
689 for (i
= 0; i
< ARRAY_SIZE(parts
); i
++) {
691 struct si_shader_part
*part
= parts
[i
];
693 parts
[i
] = part
->next
;
694 ac_shader_binary_clean(&part
->binary
);
698 mtx_destroy(&sscreen
->shader_parts_mutex
);
699 si_destroy_shader_cache(sscreen
);
701 si_perfcounters_destroy(sscreen
);
702 si_gpu_load_kill_thread(sscreen
);
704 mtx_destroy(&sscreen
->gpu_load_mutex
);
705 mtx_destroy(&sscreen
->aux_context_lock
);
706 sscreen
->aux_context
->destroy(sscreen
->aux_context
);
708 slab_destroy_parent(&sscreen
->pool_transfers
);
710 disk_cache_destroy(sscreen
->disk_shader_cache
);
711 sscreen
->ws
->destroy(sscreen
->ws
);
715 static void si_init_gs_info(struct si_screen
*sscreen
)
717 sscreen
->gs_table_depth
= ac_get_gs_table_depth(sscreen
->info
.chip_class
,
718 sscreen
->info
.family
);
721 static void si_handle_env_var_force_family(struct si_screen
*sscreen
)
723 const char *family
= debug_get_option("SI_FORCE_FAMILY", NULL
);
729 for (i
= CHIP_TAHITI
; i
< CHIP_LAST
; i
++) {
730 if (!strcmp(family
, ac_get_llvm_processor_name(i
))) {
731 /* Override family and chip_class. */
732 sscreen
->info
.family
= i
;
734 if (i
>= CHIP_VEGA10
)
735 sscreen
->info
.chip_class
= GFX9
;
736 else if (i
>= CHIP_TONGA
)
737 sscreen
->info
.chip_class
= VI
;
738 else if (i
>= CHIP_BONAIRE
)
739 sscreen
->info
.chip_class
= CIK
;
741 sscreen
->info
.chip_class
= SI
;
743 /* Don't submit any IBs. */
744 setenv("RADEON_NOOP", "1", 1);
749 fprintf(stderr
, "radeonsi: Unknown family: %s\n", family
);
753 static void si_test_vmfault(struct si_screen
*sscreen
)
755 struct pipe_context
*ctx
= sscreen
->aux_context
;
756 struct si_context
*sctx
= (struct si_context
*)ctx
;
757 struct pipe_resource
*buf
=
758 pipe_buffer_create_const0(&sscreen
->b
, 0, PIPE_USAGE_DEFAULT
, 64);
761 puts("Buffer allocation failed.");
765 r600_resource(buf
)->gpu_address
= 0; /* cause a VM fault */
767 if (sscreen
->debug_flags
& DBG(TEST_VMFAULT_CP
)) {
768 si_copy_buffer(sctx
, buf
, buf
, 0, 4, 4, 0);
769 ctx
->flush(ctx
, NULL
, 0);
770 puts("VM fault test: CP - done.");
772 if (sscreen
->debug_flags
& DBG(TEST_VMFAULT_SDMA
)) {
773 sctx
->dma_clear_buffer(sctx
, buf
, 0, 4, 0);
774 ctx
->flush(ctx
, NULL
, 0);
775 puts("VM fault test: SDMA - done.");
777 if (sscreen
->debug_flags
& DBG(TEST_VMFAULT_SHADER
)) {
778 util_test_constant_buffer(ctx
, buf
);
779 puts("VM fault test: Shader - done.");
784 static void si_disk_cache_create(struct si_screen
*sscreen
)
786 /* Don't use the cache if shader dumping is enabled. */
787 if (sscreen
->debug_flags
& DBG_ALL_SHADERS
)
790 uint32_t mesa_timestamp
;
791 if (disk_cache_get_function_timestamp(si_disk_cache_create
,
795 uint32_t llvm_timestamp
;
797 if (disk_cache_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo
,
799 res
= asprintf(×tamp_str
, "%u_%u",
800 mesa_timestamp
, llvm_timestamp
);
804 /* These flags affect shader compilation. */
805 #define ALL_FLAGS (DBG(FS_CORRECT_DERIVS_AFTER_KILL) | \
809 uint64_t shader_debug_flags
= sscreen
->debug_flags
&
812 /* Add the high bits of 32-bit addresses, which affects
813 * how 32-bit addresses are expanded to 64 bits.
815 STATIC_ASSERT(ALL_FLAGS
<= UINT_MAX
);
816 shader_debug_flags
|= (uint64_t)sscreen
->info
.address32_hi
<< 32;
818 sscreen
->disk_shader_cache
=
819 disk_cache_create(si_get_family_name(sscreen
),
827 struct pipe_screen
*radeonsi_screen_create(struct radeon_winsys
*ws
,
828 const struct pipe_screen_config
*config
)
830 struct si_screen
*sscreen
= CALLOC_STRUCT(si_screen
);
831 unsigned hw_threads
, num_comp_hi_threads
, num_comp_lo_threads
, i
;
838 ws
->query_info(ws
, &sscreen
->info
);
840 sscreen
->debug_flags
= debug_get_flags_option("R600_DEBUG",
843 /* Set functions first. */
844 sscreen
->b
.context_create
= si_pipe_create_context
;
845 sscreen
->b
.destroy
= si_destroy_screen
;
847 si_init_screen_get_functions(sscreen
);
848 si_init_screen_buffer_functions(sscreen
);
849 si_init_screen_fence_functions(sscreen
);
850 si_init_screen_state_functions(sscreen
);
851 si_init_screen_texture_functions(sscreen
);
852 si_init_screen_query_functions(sscreen
);
854 /* Set these flags in debug_flags early, so that the shader cache takes
857 if (driQueryOptionb(config
->options
,
858 "glsl_correct_derivatives_after_discard"))
859 sscreen
->debug_flags
|= DBG(FS_CORRECT_DERIVS_AFTER_KILL
);
860 if (driQueryOptionb(config
->options
, "radeonsi_enable_sisched"))
861 sscreen
->debug_flags
|= DBG(SI_SCHED
);
864 if (sscreen
->debug_flags
& DBG(INFO
))
865 ac_print_gpu_info(&sscreen
->info
);
867 slab_create_parent(&sscreen
->pool_transfers
,
868 sizeof(struct r600_transfer
), 64);
870 sscreen
->force_aniso
= MIN2(16, debug_get_num_option("R600_TEX_ANISO", -1));
871 if (sscreen
->force_aniso
>= 0) {
872 printf("radeonsi: Forcing anisotropy filter to %ix\n",
873 /* round down to a power of two */
874 1 << util_logbase2(sscreen
->force_aniso
));
877 (void) mtx_init(&sscreen
->aux_context_lock
, mtx_plain
);
878 (void) mtx_init(&sscreen
->gpu_load_mutex
, mtx_plain
);
880 si_init_gs_info(sscreen
);
881 if (!si_init_shader_cache(sscreen
)) {
886 si_disk_cache_create(sscreen
);
888 /* Determine the number of shader compiler threads. */
889 hw_threads
= sysconf(_SC_NPROCESSORS_ONLN
);
891 if (hw_threads
>= 12) {
892 num_comp_hi_threads
= hw_threads
* 3 / 4;
893 num_comp_lo_threads
= hw_threads
/ 3;
894 } else if (hw_threads
>= 6) {
895 num_comp_hi_threads
= hw_threads
- 2;
896 num_comp_lo_threads
= hw_threads
/ 2;
897 } else if (hw_threads
>= 2) {
898 num_comp_hi_threads
= hw_threads
- 1;
899 num_comp_lo_threads
= hw_threads
/ 2;
901 num_comp_hi_threads
= 1;
902 num_comp_lo_threads
= 1;
905 num_comp_hi_threads
= MIN2(num_comp_hi_threads
,
906 ARRAY_SIZE(sscreen
->compiler
));
907 num_comp_lo_threads
= MIN2(num_comp_lo_threads
,
908 ARRAY_SIZE(sscreen
->compiler_lowp
));
910 if (!util_queue_init(&sscreen
->shader_compiler_queue
, "si_shader",
911 64, num_comp_hi_threads
,
912 UTIL_QUEUE_INIT_RESIZE_IF_FULL
)) {
913 si_destroy_shader_cache(sscreen
);
918 if (!util_queue_init(&sscreen
->shader_compiler_queue_low_priority
,
920 64, num_comp_lo_threads
,
921 UTIL_QUEUE_INIT_RESIZE_IF_FULL
|
922 UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY
)) {
923 si_destroy_shader_cache(sscreen
);
928 si_handle_env_var_force_family(sscreen
);
930 if (!debug_get_bool_option("RADEON_DISABLE_PERFCOUNTERS", false))
931 si_init_perfcounters(sscreen
);
933 /* Determine tessellation ring info. */
934 bool double_offchip_buffers
= sscreen
->info
.chip_class
>= CIK
&&
935 sscreen
->info
.family
!= CHIP_CARRIZO
&&
936 sscreen
->info
.family
!= CHIP_STONEY
;
937 /* This must be one less than the maximum number due to a hw limitation.
938 * Various hardware bugs in SI, CIK, and GFX9 need this.
940 unsigned max_offchip_buffers_per_se
;
942 /* Only certain chips can use the maximum value. */
943 if (sscreen
->info
.family
== CHIP_VEGA12
)
944 max_offchip_buffers_per_se
= double_offchip_buffers
? 128 : 64;
946 max_offchip_buffers_per_se
= double_offchip_buffers
? 127 : 63;
948 unsigned max_offchip_buffers
= max_offchip_buffers_per_se
*
949 sscreen
->info
.max_se
;
950 unsigned offchip_granularity
;
952 /* Hawaii has a bug with offchip buffers > 256 that can be worked
953 * around by setting 4K granularity.
955 if (sscreen
->info
.family
== CHIP_HAWAII
) {
956 sscreen
->tess_offchip_block_dw_size
= 4096;
957 offchip_granularity
= V_03093C_X_4K_DWORDS
;
959 sscreen
->tess_offchip_block_dw_size
= 8192;
960 offchip_granularity
= V_03093C_X_8K_DWORDS
;
963 sscreen
->tess_factor_ring_size
= 32768 * sscreen
->info
.max_se
;
964 assert(((sscreen
->tess_factor_ring_size
/ 4) & C_030938_SIZE
) == 0);
965 sscreen
->tess_offchip_ring_size
= max_offchip_buffers
*
966 sscreen
->tess_offchip_block_dw_size
* 4;
968 if (sscreen
->info
.chip_class
>= CIK
) {
969 if (sscreen
->info
.chip_class
>= VI
)
970 --max_offchip_buffers
;
971 sscreen
->vgt_hs_offchip_param
=
972 S_03093C_OFFCHIP_BUFFERING(max_offchip_buffers
) |
973 S_03093C_OFFCHIP_GRANULARITY(offchip_granularity
);
975 assert(offchip_granularity
== V_03093C_X_8K_DWORDS
);
976 sscreen
->vgt_hs_offchip_param
=
977 S_0089B0_OFFCHIP_BUFFERING(max_offchip_buffers
);
980 /* The mere presense of CLEAR_STATE in the IB causes random GPU hangs
982 sscreen
->has_clear_state
= sscreen
->info
.chip_class
>= CIK
;
984 sscreen
->has_distributed_tess
=
985 sscreen
->info
.chip_class
>= VI
&&
986 sscreen
->info
.max_se
>= 2;
988 sscreen
->has_draw_indirect_multi
=
989 (sscreen
->info
.family
>= CHIP_POLARIS10
) ||
990 (sscreen
->info
.chip_class
== VI
&&
991 sscreen
->info
.pfp_fw_version
>= 121 &&
992 sscreen
->info
.me_fw_version
>= 87) ||
993 (sscreen
->info
.chip_class
== CIK
&&
994 sscreen
->info
.pfp_fw_version
>= 211 &&
995 sscreen
->info
.me_fw_version
>= 173) ||
996 (sscreen
->info
.chip_class
== SI
&&
997 sscreen
->info
.pfp_fw_version
>= 79 &&
998 sscreen
->info
.me_fw_version
>= 142);
1000 sscreen
->has_out_of_order_rast
= sscreen
->info
.chip_class
>= VI
&&
1001 sscreen
->info
.max_se
>= 2 &&
1002 !(sscreen
->debug_flags
& DBG(NO_OUT_OF_ORDER
));
1003 sscreen
->assume_no_z_fights
=
1004 driQueryOptionb(config
->options
, "radeonsi_assume_no_z_fights");
1005 sscreen
->commutative_blend_add
=
1006 driQueryOptionb(config
->options
, "radeonsi_commutative_blend_add");
1007 sscreen
->clear_db_cache_before_clear
=
1008 driQueryOptionb(config
->options
, "radeonsi_clear_db_cache_before_clear");
1009 sscreen
->has_msaa_sample_loc_bug
= (sscreen
->info
.family
>= CHIP_POLARIS10
&&
1010 sscreen
->info
.family
<= CHIP_POLARIS12
) ||
1011 sscreen
->info
.family
== CHIP_VEGA10
||
1012 sscreen
->info
.family
== CHIP_RAVEN
;
1013 sscreen
->has_ls_vgpr_init_bug
= sscreen
->info
.family
== CHIP_VEGA10
||
1014 sscreen
->info
.family
== CHIP_RAVEN
;
1016 if (sscreen
->debug_flags
& DBG(DPBB
)) {
1017 sscreen
->dpbb_allowed
= true;
1019 /* Only enable primitive binning on Raven by default. */
1020 /* TODO: Investigate if binning is profitable on Vega12. */
1021 sscreen
->dpbb_allowed
= sscreen
->info
.family
== CHIP_RAVEN
&&
1022 !(sscreen
->debug_flags
& DBG(NO_DPBB
));
1025 if (sscreen
->debug_flags
& DBG(DFSM
)) {
1026 sscreen
->dfsm_allowed
= sscreen
->dpbb_allowed
;
1028 sscreen
->dfsm_allowed
= sscreen
->dpbb_allowed
&&
1029 !(sscreen
->debug_flags
& DBG(NO_DFSM
));
1032 /* While it would be nice not to have this flag, we are constrained
1033 * by the reality that LLVM 5.0 doesn't have working VGPR indexing
1036 sscreen
->llvm_has_working_vgpr_indexing
= sscreen
->info
.chip_class
<= VI
;
1038 /* Some chips have RB+ registers, but don't support RB+. Those must
1039 * always disable it.
1041 if (sscreen
->info
.family
== CHIP_STONEY
||
1042 sscreen
->info
.chip_class
>= GFX9
) {
1043 sscreen
->has_rbplus
= true;
1045 sscreen
->rbplus_allowed
=
1046 !(sscreen
->debug_flags
& DBG(NO_RB_PLUS
)) &&
1047 (sscreen
->info
.family
== CHIP_STONEY
||
1048 sscreen
->info
.family
== CHIP_VEGA12
||
1049 sscreen
->info
.family
== CHIP_RAVEN
);
1052 sscreen
->dcc_msaa_allowed
=
1053 !(sscreen
->debug_flags
& DBG(NO_DCC_MSAA
));
1055 sscreen
->cpdma_prefetch_writes_memory
= sscreen
->info
.chip_class
<= VI
;
1057 (void) mtx_init(&sscreen
->shader_parts_mutex
, mtx_plain
);
1058 sscreen
->use_monolithic_shaders
=
1059 (sscreen
->debug_flags
& DBG(MONOLITHIC_SHADERS
)) != 0;
1061 sscreen
->barrier_flags
.cp_to_L2
= SI_CONTEXT_INV_SMEM_L1
|
1062 SI_CONTEXT_INV_VMEM_L1
;
1063 if (sscreen
->info
.chip_class
<= VI
) {
1064 sscreen
->barrier_flags
.cp_to_L2
|= SI_CONTEXT_INV_GLOBAL_L2
;
1065 sscreen
->barrier_flags
.L2_to_cp
|= SI_CONTEXT_WRITEBACK_GLOBAL_L2
;
1068 if (debug_get_bool_option("RADEON_DUMP_SHADERS", false))
1069 sscreen
->debug_flags
|= DBG_ALL_SHADERS
;
1076 * That means 8 coverage samples, 4 Z/S samples, and 2 color samples.
1078 * s >= z >= c (ignoring this only wastes memory)
1083 * Only MSAA color and depth buffers are overriden.
1085 if (sscreen
->info
.has_eqaa_surface_allocator
) {
1086 const char *eqaa
= debug_get_option("EQAA", NULL
);
1089 if (eqaa
&& sscanf(eqaa
, "%u,%u,%u", &s
, &z
, &f
) == 3 && s
&& z
&& f
) {
1090 sscreen
->eqaa_force_coverage_samples
= s
;
1091 sscreen
->eqaa_force_z_samples
= z
;
1092 sscreen
->eqaa_force_color_samples
= f
;
1096 for (i
= 0; i
< num_comp_hi_threads
; i
++)
1097 si_init_compiler(sscreen
, &sscreen
->compiler
[i
]);
1098 for (i
= 0; i
< num_comp_lo_threads
; i
++)
1099 si_init_compiler(sscreen
, &sscreen
->compiler_lowp
[i
]);
1101 /* Create the auxiliary context. This must be done last. */
1102 sscreen
->aux_context
= si_create_context(&sscreen
->b
, 0);
1104 if (sscreen
->debug_flags
& DBG(TEST_DMA
))
1105 si_test_dma(sscreen
);
1107 if (sscreen
->debug_flags
& (DBG(TEST_VMFAULT_CP
) |
1108 DBG(TEST_VMFAULT_SDMA
) |
1109 DBG(TEST_VMFAULT_SHADER
)))
1110 si_test_vmfault(sscreen
);