radeonsi: make si_initialize_compute reusable
authorMarek Olšák <marek.olsak@amd.com>
Thu, 16 Aug 2018 01:36:14 +0000 (21:36 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 16 May 2019 17:06:51 +0000 (13:06 -0400)
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_compute.c
src/gallium/drivers/radeonsi/si_pipe.h

index cf9c0601fc980500651fdf1b50093a84d7007e7d..2d70f0759bb699f9783fc4fcc813ab5a5cafe87f 100644 (file)
@@ -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);
index be7ca4d5f5c7d31dd8d5a5562e604551c44e367b..f65f4f500434efbc64f82e46e7dbfe2041af55fc 100644 (file)
@@ -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);