diff options
author | Marek Olšák <[email protected]> | 2017-06-07 00:16:46 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-06-22 01:51:02 +0200 |
commit | 79bd1d4f8b9f176b099854c6954960dc7fc53b02 (patch) | |
tree | c23e1c9cb30f7235388a4991ef7e23035c898ce9 /src/gallium/drivers/radeonsi/si_pipe.c | |
parent | c66fc618cca2c0a1caf9f56f3dfbbdc1d95d0e8c (diff) |
radeonsi/gfx9: keep reusing the same buffer/address for the gfx9 flush fence
instead of using a monotonic suballocator
v2: initialize the memory at context creation
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_pipe.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index a4f3c2d6149..74ac0ec0389 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -64,6 +64,7 @@ static void si_destroy_context(struct pipe_context *context) free(sctx->border_color_table); r600_resource_reference(&sctx->scratch_buffer, NULL); r600_resource_reference(&sctx->compute_scratch_buffer, NULL); + r600_resource_reference(&sctx->wait_mem_scratch, NULL); si_pm4_free_state(sctx, sctx->init_config, ~0); if (sctx->init_config_gs_rings) @@ -269,6 +270,23 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, /* these must be last */ si_begin_new_cs(sctx); + if (sctx->b.chip_class >= GFX9) { + sctx->wait_mem_scratch = (struct r600_resource*) + pipe_buffer_create(screen, 0, PIPE_USAGE_DEFAULT, 4); + if (!sctx->wait_mem_scratch) + goto fail; + + /* Initialize the memory. */ + struct radeon_winsys_cs *cs = sctx->b.gfx.cs; + radeon_emit(cs, PKT3(PKT3_WRITE_DATA, 3, 0)); + radeon_emit(cs, S_370_DST_SEL(V_370_MEMORY_SYNC) | + S_370_WR_CONFIRM(1) | + S_370_ENGINE_SEL(V_370_ME)); + radeon_emit(cs, sctx->wait_mem_scratch->gpu_address); + radeon_emit(cs, sctx->wait_mem_scratch->gpu_address >> 32); + radeon_emit(cs, sctx->wait_mem_number); + } + /* CIK cannot unbind a constant buffer (S_BUFFER_LOAD doesn't skip loads * if NUM_RECORDS == 0). We need to use a dummy buffer instead. */ if (sctx->b.chip_class == CIK) { |