summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-10-03 19:28:48 +0200
committerMarek Olšák <[email protected]>2017-10-06 02:56:11 +0200
commitc4d1a199f8379b3982a53fb18fe2b50fafd682df (patch)
tree1ff4ed86212d6f43cd56a3e98fc25ac8c4ecfb58
parent15d918e46faf08be018394747f019b082871dccf (diff)
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 <[email protected]> (v1) Reviewed-by: Nicolai Hähnle <[email protected]> (v1)
-rw-r--r--src/gallium/drivers/radeonsi/driinfo_radeonsi.h4
-rw-r--r--src/gallium/drivers/radeonsi/si_blit.c15
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.h1
-rw-r--r--src/util/drirc5
-rw-r--r--src/util/xmlpool/t_options.h5
6 files changed, 32 insertions, 0 deletions
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;
diff --git a/src/util/drirc b/src/util/drirc
index 0bedeef9a3c..700402c6301 100644
--- a/src/util/drirc
+++ b/src/util/drirc
@@ -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>
diff --git a/src/util/xmlpool/t_options.h b/src/util/xmlpool/t_options.h
index 64477c5ed65..957ed615048 100644
--- a/src/util/xmlpool/t_options.h
+++ b/src/util/xmlpool/t_options.h
@@ -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