From 49a016ec5d77e8401556bbd8cad386457537eb30 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 15 Aug 2018 21:36:14 -0400 Subject: radeonsi: make si_initialize_compute reusable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tested-by: Dieter Nützel Acked-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_compute.c | 14 +++++++------- src/gallium/drivers/radeonsi/si_pipe.h | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index cf9c0601fc9..2d70f0759bb 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -317,9 +317,8 @@ static void si_set_global_binding( } } -static void si_initialize_compute(struct si_context *sctx) +void si_emit_initial_compute_regs(struct si_context *sctx, struct radeon_cmdbuf *cs) { - struct radeon_cmdbuf *cs = sctx->gfx_cs; uint64_t bc_va; radeon_set_sh_reg_seq(cs, R_00B858_COMPUTE_STATIC_THREAD_MGMT_SE0, 2); @@ -363,9 +362,6 @@ static void si_initialize_compute(struct si_context *sctx) bc_va >> 8); } } - - sctx->cs_shader_state.emitted_program = NULL; - sctx->cs_shader_state.initialized = true; } static bool si_setup_compute_scratch_buffer(struct si_context *sctx, @@ -914,8 +910,12 @@ static void si_launch_grid( if (sctx->bo_list_add_all_compute_resources) si_compute_resources_add_all_to_bo_list(sctx); - if (!sctx->cs_shader_state.initialized) - si_initialize_compute(sctx); + if (!sctx->cs_shader_state.initialized) { + si_emit_initial_compute_regs(sctx, sctx->gfx_cs); + + sctx->cs_shader_state.emitted_program = NULL; + sctx->cs_shader_state.initialized = true; + } if (sctx->flags) si_emit_cache_flush(sctx); diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index be7ca4d5f5c..f65f4f50043 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -1304,6 +1304,7 @@ unsigned si_end_counter(struct si_screen *sscreen, unsigned type, uint64_t begin); /* si_compute.c */ +void si_emit_initial_compute_regs(struct si_context *sctx, struct radeon_cmdbuf *cs); unsigned si_get_compute_resource_limits(struct si_screen *sscreen, unsigned waves_per_threadgroup, unsigned max_waves_per_sh); -- cgit v1.2.3