Mesa (main): iris: Tile cache flush for depth before fast clear
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Oct 12 19:00:36 UTC 2021
Module: Mesa
Branch: main
Commit: d7e836443a530bfb50fc1333311b00e2514e1051
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7e836443a530bfb50fc1333311b00e2514e1051
Author: Nanley Chery <nanley.g.chery at intel.com>
Date: Tue Jun 22 10:24:31 2021 -0700
iris: Tile cache flush for depth before fast clear
Instead of doing a tile cache flush after slow clears or when the clear
value changes, do it before every fast clear of a HIZ_CCS_WT surface.
This agrees with the Bspec.
Fixes: c85ea824bca ("iris: reduce redundant tile cache flushes")
Reviewed-by: Felix DeGrood <felix.j.degrood at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11539>
---
src/gallium/drivers/iris/iris_clear.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c
index df13f0a42f8..19f4d3506fa 100644
--- a/src/gallium/drivers/iris/iris_clear.c
+++ b/src/gallium/drivers/iris/iris_clear.c
@@ -501,8 +501,6 @@ fast_clear_depth(struct iris_context *ice,
ISL_AUX_OP_FULL_RESOLVE, false);
iris_resource_set_aux_state(ice, res, res_level, layer, 1,
ISL_AUX_STATE_RESOLVED);
- iris_emit_pipe_control_flush(batch, "hiz op: post depth resolve",
- PIPE_CONTROL_TILE_CACHE_FLUSH);
}
}
const union isl_color_value clear_value = { .f32 = {depth, } };
@@ -510,6 +508,23 @@ fast_clear_depth(struct iris_context *ice,
update_clear_depth = true;
}
+ if (res->aux.usage == ISL_AUX_USAGE_HIZ_CCS_WT) {
+ /* From Bspec 47010 (Depth Buffer Clear):
+ *
+ * Since the fast clear cycles to CCS are not cached in TileCache,
+ * any previous depth buffer writes to overlapping pixels must be
+ * flushed out of TileCache before a succeeding Depth Buffer Clear.
+ * This restriction only applies to Depth Buffer with write-thru
+ * enabled, since fast clears to CCS only occur for write-thru mode.
+ *
+ * There may have been a write to this depth buffer. Flush it from the
+ * tile cache just in case.
+ */
+ iris_emit_pipe_control_flush(batch, "hiz_ccs_wt: before fast clear",
+ PIPE_CONTROL_DEPTH_CACHE_FLUSH |
+ PIPE_CONTROL_TILE_CACHE_FLUSH);
+ }
+
for (unsigned l = 0; l < box->depth; l++) {
enum isl_aux_state aux_state =
iris_resource_get_aux_state(res, level, box->z + l);
@@ -617,8 +632,7 @@ clear_depth_stencil(struct iris_context *ice,
blorp_batch_finish(&blorp_batch);
iris_batch_sync_region_end(batch);
- iris_flush_and_dirty_for_history(ice, batch, res,
- PIPE_CONTROL_TILE_CACHE_FLUSH,
+ iris_flush_and_dirty_for_history(ice, batch, res, 0,
"cache history: post slow ZS clear");
if (clear_depth && z_res) {
More information about the mesa-commit
mailing list