From c4d1a199f8379b3982a53fb18fe2b50fafd682df Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 3 Oct 2017 19:28:48 +0200 Subject: radeonsi: add a drirc workaround for HTILE corruption in ARK: Survival Evolved MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v2: use DB_META | PS_PARTIAL_FLUSH Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102955 Reviewed-by: Samuel Pitoiset (v1) Reviewed-by: Nicolai Hähnle (v1) --- src/gallium/drivers/radeonsi/driinfo_radeonsi.h | 4 ++++ src/gallium/drivers/radeonsi/si_blit.c | 15 +++++++++++++++ src/gallium/drivers/radeonsi/si_pipe.c | 2 ++ src/gallium/drivers/radeonsi/si_pipe.h | 1 + 4 files changed, 22 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/radeonsi/driinfo_radeonsi.h b/src/gallium/drivers/radeonsi/driinfo_radeonsi.h index 989e5175cc0..402d3406d45 100644 --- a/src/gallium/drivers/radeonsi/driinfo_radeonsi.h +++ b/src/gallium/drivers/radeonsi/driinfo_radeonsi.h @@ -4,3 +4,7 @@ DRI_CONF_SECTION_PERFORMANCE DRI_CONF_RADEONSI_ASSUME_NO_Z_FIGHTS("false") DRI_CONF_RADEONSI_COMMUTATIVE_BLEND_ADD("false") DRI_CONF_SECTION_END + +DRI_CONF_SECTION_DEBUG + DRI_CONF_RADEONSI_CLEAR_DB_META_BEFORE_CLEAR("false") +DRI_CONF_SECTION_END diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c index 67972a24ffb..2e76a5c6998 100644 --- a/src/gallium/drivers/radeonsi/si_blit.c +++ b/src/gallium/drivers/radeonsi/si_blit.c @@ -903,6 +903,21 @@ static void si_clear(struct pipe_context *ctx, unsigned buffers, sctx->db_stencil_clear = true; si_mark_atom_dirty(sctx, &sctx->db_render_state); } + + /* TODO: Find out what's wrong here. Fast depth clear leads to + * corruption in ARK: Survival Evolved, but that may just be + * a coincidence and the root cause is elsewhere. + * + * The corruption can be fixed by putting the DB metadata flush + * before or after the depth clear. (suprisingly) + * + * https://bugs.freedesktop.org/show_bug.cgi?id=102955 (apitrace) + * + * This hack decreases back-to-back ClearDepth performance. + */ + if (sctx->screen->clear_db_meta_before_clear) + sctx->b.flags |= SI_CONTEXT_FLUSH_AND_INV_DB_META | + SI_CONTEXT_PS_PARTIAL_FLUSH; } si_blitter_begin(ctx, SI_CLEAR); diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 3d2ce04725b..5e20a0b8e38 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -1055,6 +1055,8 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws, driQueryOptionb(config->options, "radeonsi_assume_no_z_fights"); sscreen->commutative_blend_add = driQueryOptionb(config->options, "radeonsi_commutative_blend_add"); + sscreen->clear_db_meta_before_clear = + driQueryOptionb(config->options, "radeonsi_clear_db_meta_before_clear"); sscreen->has_msaa_sample_loc_bug = (sscreen->b.family >= CHIP_POLARIS10 && sscreen->b.family <= CHIP_POLARIS12) || sscreen->b.family == CHIP_VEGA10 || diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index b96bf9d2fe1..684fda13406 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -98,6 +98,7 @@ struct si_screen { bool has_out_of_order_rast; bool assume_no_z_fights; bool commutative_blend_add; + bool clear_db_meta_before_clear; bool has_msaa_sample_loc_bug; bool dpbb_allowed; bool dfsm_allowed; -- cgit v1.2.3