radeonsi/gfx10: add si_context::emit_cache_flush

The introduction of GCR_CNTL makes cache flush handling on gfx10
sufficiently different that it makes sense to just use a separate
function.

Since emit_cache_flush is called quite early during context init,
we initialize the pointer explicitly in si_create_context.

Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
Nicolai Hähnle 2017-11-16 12:16:52 +01:00 committed by Marek Olšák
parent 08e2a62b07
commit 0c6c6810bd
9 changed files with 15 additions and 9 deletions

View file

@ -935,7 +935,7 @@ static void si_launch_grid(
}
if (sctx->flags)
si_emit_cache_flush(sctx);
sctx->emit_cache_flush(sctx);
if (!si_switch_compute_shader(sctx, program, &program->shader,
code_object, info->pc))

View file

@ -434,7 +434,7 @@ void si_retile_dcc(struct si_context *sctx, struct si_texture *tex)
SI_CONTEXT_CS_PARTIAL_FLUSH |
si_get_flush_flags(sctx, SI_COHERENCY_CB_META, L2_LRU) |
si_get_flush_flags(sctx, SI_COHERENCY_SHADER, L2_LRU);
si_emit_cache_flush(sctx);
sctx->emit_cache_flush(sctx);
/* Save states. */
void *saved_cs = sctx->cs_shader_state.program;

View file

@ -187,7 +187,7 @@ static void si_cp_dma_prepare(struct si_context *sctx, struct pipe_resource *dst
* Also wait for the previous CP DMA operations.
*/
if (!(user_flags & SI_CPDMA_SKIP_GFX_SYNC) && sctx->flags)
si_emit_cache_flush(sctx);
sctx->emit_cache_flush(sctx);
if (!(user_flags & SI_CPDMA_SKIP_SYNC_BEFORE) && *is_first &&
!(*packet_flags & CP_DMA_CLEAR))

View file

@ -1904,7 +1904,7 @@ static void si_upload_bindless_descriptors(struct si_context *sctx)
*/
sctx->flags |= SI_CONTEXT_PS_PARTIAL_FLUSH |
SI_CONTEXT_CS_PARTIAL_FLUSH;
si_emit_cache_flush(sctx);
sctx->emit_cache_flush(sctx);
util_dynarray_foreach(&sctx->resident_tex_handles,
struct si_texture_handle *, tex_handle) {
@ -1930,7 +1930,7 @@ static void si_upload_bindless_descriptors(struct si_context *sctx)
/* Invalidate L1 because it doesn't know that L2 changed. */
sctx->flags |= SI_CONTEXT_INV_SCACHE;
si_emit_cache_flush(sctx);
sctx->emit_cache_flush(sctx);
sctx->bindless_descriptors_dirty = false;
}

View file

@ -173,7 +173,7 @@ void si_flush_gfx_cs(struct si_context *ctx, unsigned flags,
/* Wait for draw calls to finish if needed. */
if (wait_flags) {
ctx->flags |= wait_flags;
si_emit_cache_flush(ctx);
ctx->emit_cache_flush(ctx);
}
ctx->gfx_last_ib_is_busy = wait_flags == 0;

View file

@ -487,6 +487,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
goto fail;
/* Initialize context functions used by graphics and compute. */
sctx->emit_cache_flush = si_emit_cache_flush;
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;

View file

@ -862,6 +862,9 @@ struct si_context {
struct pipe_device_reset_callback device_reset_callback;
struct u_log_context *log;
void *query_result_shader;
void (*emit_cache_flush)(struct si_context *ctx);
struct blitter_context *blitter;
void *custom_dsa_flush;
void *custom_blend_resolve;

View file

@ -981,6 +981,8 @@ void si_emit_cache_flush(struct si_context *sctx)
(flags & SI_CONTEXT_CS_PARTIAL_FLUSH &&
sctx->compute_is_busy);
assert(sctx->chip_class <= GFX9);
if (flags & SI_CONTEXT_FLUSH_AND_INV_CB)
sctx->num_cb_cache_flushes++;
if (flags & SI_CONTEXT_FLUSH_AND_INV_DB)
@ -1744,7 +1746,7 @@ static void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *i
/* Emit all states except possibly render condition. */
si_emit_all_states(sctx, info, prim, instance_count,
primitive_restart, masked_atoms);
si_emit_cache_flush(sctx);
sctx->emit_cache_flush(sctx);
/* <-- CUs are idle here. */
if (si_is_atom_dirty(sctx, &sctx->atoms.s.render_cond))
@ -1772,7 +1774,7 @@ static void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *i
* states, and draw at the end.
*/
if (sctx->flags)
si_emit_cache_flush(sctx);
sctx->emit_cache_flush(sctx);
/* Only prefetch the API VS and VBO descriptors. */
if (sctx->chip_class >= GFX7 && sctx->prefetch_L2_mask)

View file

@ -253,7 +253,7 @@ void si_test_dma_perf(struct si_screen *sscreen)
/* Flush L2, so that we don't just test L2 cache performance. */
if (!test_sdma) {
sctx->flags |= SI_CONTEXT_WB_L2;
si_emit_cache_flush(sctx);
sctx->emit_cache_flush(sctx);
}
ctx->end_query(ctx, q[iter]);