radeonsi: don't always update shader coherency draw call counter

The bug report has a sequence that looks like this:
* set tex as framebuffer
* dispatch a compute shader that doesn't use tex
* dispatch a compute shader that uses it

Since we were updating the counters at step 2, step 3 failed to realize
that calling si_make_CB_shader_coherent was needed.

While at it, this commit splits the draw call tracking counter in 2: one
for CB, one for DB.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11638
Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30591>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2024-08-09 15:39:43 +02:00
parent 9fa324c24c
commit bfcee149ed
2 changed files with 15 additions and 8 deletions

View file

@ -1186,20 +1186,24 @@ static void si_launch_grid(struct pipe_context *ctx, const struct pipe_grid_info
si_check_dirty_buffers_textures(sctx);
if (sctx->has_graphics) {
if (sctx->last_num_draw_calls != sctx->num_draw_calls) {
if (sctx->num_draw_calls_sh_coherent.with_cb != sctx->num_draw_calls ||
sctx->num_draw_calls_sh_coherent.with_db != sctx->num_draw_calls) {
si_update_fb_dirtiness_after_rendering(sctx);
sctx->last_num_draw_calls = sctx->num_draw_calls;
if (sctx->force_shader_coherency.with_cb ||
si_check_needs_implicit_sync(sctx, RADEON_USAGE_CB_NEEDS_IMPLICIT_SYNC))
si_check_needs_implicit_sync(sctx, RADEON_USAGE_CB_NEEDS_IMPLICIT_SYNC)) {
sctx->num_draw_calls_sh_coherent.with_cb = sctx->num_draw_calls;
si_make_CB_shader_coherent(sctx, 0,
sctx->framebuffer.CB_has_shader_readable_metadata,
sctx->framebuffer.all_DCC_pipe_aligned);
}
if (sctx->gfx_level == GFX12 &&
(sctx->force_shader_coherency.with_db ||
si_check_needs_implicit_sync(sctx, RADEON_USAGE_DB_NEEDS_IMPLICIT_SYNC)))
si_make_DB_shader_coherent(sctx, 0, false, false);
if (sctx->gfx_level == GFX12 &&
(sctx->force_shader_coherency.with_db ||
si_check_needs_implicit_sync(sctx, RADEON_USAGE_DB_NEEDS_IMPLICIT_SYNC))) {
sctx->num_draw_calls_sh_coherent.with_db = sctx->num_draw_calls;
si_make_DB_shader_coherent(sctx, 0, false, false);
}
}
if (sctx->gfx_level < GFX11)

View file

@ -1020,7 +1020,10 @@ struct si_context {
unsigned last_dirty_tex_counter;
unsigned last_dirty_buf_counter;
unsigned last_compressed_colortex_counter;
unsigned last_num_draw_calls;
struct {
unsigned with_cb;
unsigned with_db;
} num_draw_calls_sh_coherent;
unsigned flags; /* flush flags */
/* Atoms (state emit functions). */