diff options
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_pipe.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.c | 95 |
1 files changed, 54 insertions, 41 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index b965d9d64d4..9b1eab8284b 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -389,16 +389,15 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, if (!sctx) return NULL; + sctx->has_graphics = sscreen->info.chip_class == SI || + !(flags & PIPE_CONTEXT_COMPUTE_ONLY); + if (flags & PIPE_CONTEXT_DEBUG) sscreen->record_llvm_ir = true; /* racy but not critical */ sctx->b.screen = screen; /* this must be set first */ sctx->b.priv = NULL; sctx->b.destroy = si_destroy_context; - sctx->b.emit_string_marker = si_emit_string_marker; - sctx->b.set_debug_callback = si_set_debug_callback; - sctx->b.set_log_context = si_set_log_context; - sctx->b.set_context_param = si_set_context_param; sctx->screen = sscreen; /* Easy accessing of screen/winsys. */ sctx->is_debug = (flags & PIPE_CONTEXT_DEBUG) != 0; @@ -414,11 +413,6 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, sctx->ws->query_value(sctx->ws, RADEON_GPU_RESET_COUNTER); } - sctx->b.get_device_reset_status = si_get_reset_status; - sctx->b.set_device_reset_callback = si_set_device_reset_callback; - - si_init_context_texture_functions(sctx); - si_init_query_functions(sctx); if (sctx->chip_class == CIK || sctx->chip_class == VI || @@ -430,6 +424,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, goto fail; } + /* Initialize context allocators. */ sctx->allocator_zeroed_memory = u_suballocator_create(&sctx->b, 128 * 1024, 0, PIPE_USAGE_DEFAULT, @@ -473,24 +468,8 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, if (use_sdma_upload) u_upload_enable_flush_explicit(sctx->b.const_uploader); - si_init_buffer_functions(sctx); - si_init_clear_functions(sctx); - si_init_blit_functions(sctx); - si_init_compute_functions(sctx); - si_init_compute_blit_functions(sctx); - si_init_debug_functions(sctx); - si_init_msaa_functions(sctx); - si_init_streamout_functions(sctx); - - if (sscreen->info.has_hw_decode) { - sctx->b.create_video_codec = si_uvd_create_decoder; - sctx->b.create_video_buffer = si_video_buffer_create; - } else { - sctx->b.create_video_codec = vl_create_decoder; - sctx->b.create_video_buffer = vl_video_buffer_create; - } - - sctx->gfx_cs = ws->cs_create(sctx->ctx, RING_GFX, + sctx->gfx_cs = ws->cs_create(sctx->ctx, + sctx->has_graphics ? RING_GFX : RING_COMPUTE, (void*)si_flush_gfx_cs, sctx, stop_exec_on_failure); /* Border colors. */ @@ -512,29 +491,62 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, if (!sctx->border_color_map) goto fail; + /* Initialize context functions used by graphics and compute. */ + sctx->b.emit_string_marker = si_emit_string_marker; + sctx->b.set_debug_callback = si_set_debug_callback; + sctx->b.set_log_context = si_set_log_context; + sctx->b.set_context_param = si_set_context_param; + sctx->b.get_device_reset_status = si_get_reset_status; + sctx->b.set_device_reset_callback = si_set_device_reset_callback; + sctx->b.memory_barrier = si_memory_barrier; + si_init_all_descriptors(sctx); + si_init_buffer_functions(sctx); + si_init_clear_functions(sctx); + si_init_blit_functions(sctx); + si_init_compute_functions(sctx); + si_init_compute_blit_functions(sctx); + si_init_debug_functions(sctx); si_init_fence_functions(sctx); - si_init_state_functions(sctx); - si_init_shader_functions(sctx); - si_init_viewport_functions(sctx); - - if (sctx->chip_class >= CIK) - cik_init_sdma_functions(sctx); - else - si_init_dma_functions(sctx); if (sscreen->debug_flags & DBG(FORCE_DMA)) sctx->b.resource_copy_region = sctx->dma_copy; - sctx->blitter = util_blitter_create(&sctx->b); - if (sctx->blitter == NULL) - goto fail; - sctx->blitter->skip_viewport_restore = true; + /* Initialize graphics-only context functions. */ + if (sctx->has_graphics) { + si_init_context_texture_functions(sctx); + si_init_query_functions(sctx); + si_init_msaa_functions(sctx); + si_init_shader_functions(sctx); + si_init_state_functions(sctx); + si_init_streamout_functions(sctx); + si_init_viewport_functions(sctx); + + sctx->blitter = util_blitter_create(&sctx->b); + if (sctx->blitter == NULL) + goto fail; + sctx->blitter->skip_viewport_restore = true; - si_init_draw_functions(sctx); + si_init_draw_functions(sctx); + } + + /* Initialize SDMA functions. */ + if (sctx->chip_class >= CIK) + cik_init_sdma_functions(sctx); + else + si_init_dma_functions(sctx); sctx->sample_mask = 0xffff; + /* Initialize multimedia functions. */ + if (sscreen->info.has_hw_decode) { + sctx->b.create_video_codec = si_uvd_create_decoder; + sctx->b.create_video_buffer = si_video_buffer_create; + } else { + sctx->b.create_video_codec = vl_create_decoder; + sctx->b.create_video_buffer = vl_video_buffer_create; + } + if (sctx->chip_class >= GFX9) { sctx->wait_mem_scratch = si_resource( pipe_buffer_create(screen, 0, PIPE_USAGE_DEFAULT, 4)); @@ -558,7 +570,8 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, goto fail; sctx->null_const_buf.buffer_size = sctx->null_const_buf.buffer->width0; - for (shader = 0; shader < SI_NUM_SHADERS; shader++) { + unsigned start_shader = sctx->has_graphics ? 0 : PIPE_SHADER_COMPUTE; + for (shader = start_shader; shader < SI_NUM_SHADERS; shader++) { for (i = 0; i < SI_NUM_CONST_BUFFERS; i++) { sctx->b.set_constant_buffer(&sctx->b, shader, i, &sctx->null_const_buf); |