Mesa (main): anv: 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: 10be870c72707c36723c630ea52b3472aee310de
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=10be870c72707c36723c630ea52b3472aee310de
Author: Nanley Chery <nanley.g.chery at intel.com>
Date: Tue Jun 22 10:35:08 2021 -0700
anv: Tile cache flush for depth before fast clear
Instead of doing a tile cache flush after slow clears, resolves, and
ambiguates, do it before fast clears of HIZ_CCS_WT surfaces. This agrees
with the Bspec.
Reviewed-by: Felix DeGrood <felix.j.degrood at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11539>
---
src/intel/vulkan/anv_blorp.c | 20 +++++++++++++++++++-
src/intel/vulkan/genX_cmd_buffer.c | 9 +--------
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index 2297abefa57..ba24bd5a1ce 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -1677,7 +1677,6 @@ anv_image_clear_depth_stencil(struct anv_cmd_buffer *cmd_buffer,
*/
anv_add_pending_pipe_bits(cmd_buffer,
ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT |
- ANV_PIPE_TILE_CACHE_FLUSH_BIT |
ANV_PIPE_END_OF_PIPE_SYNC_BIT,
"after clear DS");
@@ -1785,6 +1784,25 @@ anv_image_hiz_clear(struct anv_cmd_buffer *cmd_buffer,
ANV_PIPE_DEPTH_STALL_BIT,
"before clear hiz");
+ if ((aspects & VK_IMAGE_ASPECT_DEPTH_BIT) &&
+ depth.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.
+ */
+ anv_add_pending_pipe_bits(cmd_buffer,
+ ANV_PIPE_DEPTH_CACHE_FLUSH_BIT |
+ ANV_PIPE_TILE_CACHE_FLUSH_BIT,
+ "before clear hiz_ccs_wt");
+ }
+
blorp_hiz_clear_depth_stencil(&batch, &depth, &stencil,
level, base_layer, layer_count,
area.offset.x, area.offset.y,
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index b122628a882..442c1bdecce 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -649,8 +649,7 @@ transition_depth_buffer(struct anv_cmd_buffer *cmd_buffer,
/* Getting into the pass-through state for Depth is tricky and involves
* both a resolve and an ambiguate. We don't handle that state right now
- * as anv_layout_to_aux_state never returns it. Resolve/ambiguate will
- * trigger depth clears which require tile cache flushes.
+ * as anv_layout_to_aux_state never returns it.
*/
assert(final_state != ISL_AUX_STATE_PASS_THROUGH);
@@ -658,16 +657,10 @@ transition_depth_buffer(struct anv_cmd_buffer *cmd_buffer,
assert(initial_hiz_valid);
anv_image_hiz_op(cmd_buffer, image, VK_IMAGE_ASPECT_DEPTH_BIT,
0, base_layer, layer_count, ISL_AUX_OP_FULL_RESOLVE);
- anv_add_pending_pipe_bits(cmd_buffer,
- ANV_PIPE_TILE_CACHE_FLUSH_BIT,
- "after depth resolve");
} else if (final_needs_hiz && !initial_hiz_valid) {
assert(initial_depth_valid);
anv_image_hiz_op(cmd_buffer, image, VK_IMAGE_ASPECT_DEPTH_BIT,
0, base_layer, layer_count, ISL_AUX_OP_AMBIGUATE);
- anv_add_pending_pipe_bits(cmd_buffer,
- ANV_PIPE_TILE_CACHE_FLUSH_BIT,
- "after hiz resolve");
}
}
More information about the mesa-commit
mailing list