[14/26] radeonsi: make si_initialize_compute reusable

Submitted by Marek Olšák on Feb. 13, 2019, 5:16 a.m.

Details

Message ID 20190213051621.6235-15-maraeo@gmail.com
State New
Headers show
Series "RadeonSI: Primitive culling with async compute" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Marek Olšák Feb. 13, 2019, 5:16 a.m.
From: Marek Olšák <marek.olsak@amd.com>

---
 src/gallium/drivers/radeonsi/si_compute.c | 14 +++++++-------
 src/gallium/drivers/radeonsi/si_pipe.h    |  1 +
 2 files changed, 8 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index 5ec0c0a5699..52a62dcb7fa 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -316,9 +316,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);
@@ -362,9 +361,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,
@@ -908,8 +904,12 @@  static void si_launch_grid(
 
 	si_need_gfx_cs_space(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 81faf4c66e8..e4e731e913b 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -1291,6 +1291,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);