radeonsi: add a drirc workaround for HTILE corruption in ARK: Survival Evolved

v2: use DB_META | PS_PARTIAL_FLUSH

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102955
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (v1)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v1)
This commit is contained in:
Marek Olšák 2017-10-03 19:28:48 +02:00
parent 15d918e46f
commit c4d1a199f8
6 changed files with 32 additions and 0 deletions

View File

@ -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

View File

@ -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);

View File

@ -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 ||

View File

@ -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;

View File

@ -235,4 +235,9 @@ TODO: document the other workarounds.
<option name="glx_disable_oml_sync_control" value="true" />
</application>
</device>
<device driver="radeonsi">
<application name="ARK: Survival Evolved (and unintentionally the UE4 demo template)" executable="ShooterGame">
<option name="radeonsi_clear_db_meta_before_clear" value="true" />
</application>
</device>
</driconf>

View File

@ -443,3 +443,8 @@ DRI_CONF_OPT_END
DRI_CONF_OPT_BEGIN_B(radeonsi_commutative_blend_add, def) \
DRI_CONF_DESC(en,gettext("Commutative additive blending optimizations (may cause rendering errors)")) \
DRI_CONF_OPT_END
#define DRI_CONF_RADEONSI_CLEAR_DB_META_BEFORE_CLEAR(def) \
DRI_CONF_OPT_BEGIN_B(radeonsi_clear_db_meta_before_clear, def) \
DRI_CONF_DESC(en,"Clear DB metadata cache before fast depth clear") \
DRI_CONF_OPT_END