Mesa (main): tu: Add a650-specific CCU flush workaround
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Aug 20 18:21:37 UTC 2021
Module: Mesa
Branch: main
Commit: 47996b951e753897ec52fda9b2040ec36c086f82
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=47996b951e753897ec52fda9b2040ec36c086f82
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Thu Aug 19 17:11:20 2021 +0200
tu: Add a650-specific CCU flush workaround
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12475>
---
src/freedreno/common/freedreno_dev_info.h | 15 +++++++++++++++
src/freedreno/common/freedreno_devices.py | 1 +
src/freedreno/vulkan/tu_clear_blit.c | 3 +++
src/freedreno/vulkan/tu_cmd_buffer.c | 4 +++-
4 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/freedreno/common/freedreno_dev_info.h b/src/freedreno/common/freedreno_dev_info.h
index d005bcd483b..f280298a344 100644
--- a/src/freedreno/common/freedreno_dev_info.h
+++ b/src/freedreno/common/freedreno_dev_info.h
@@ -102,6 +102,21 @@ struct fd_dev_info {
bool has_8bpp_ubwc;
+ /* a650 seems to be affected by a bug where flushing CCU color into
+ * depth or vice-versa requires a WFI. In particular, clearing a
+ * depth attachment (which writes to it as a color attachment) then
+ * using it as a normal depth attachment requires a WFI in addition
+ * to the expected CCU_FLUSH_COLOR + CCU_INVALIDATE_DEPTH, even
+ * though all those operations happen in the same stage. As this is
+ * usually the only scenario where a CCU flush doesn't require a WFI
+ * we just insert a WFI after every CCU flush.
+ *
+ * Tests affected include
+ * dEQP-VK.renderpass.suballocation.formats.d16_unorm.* in sysmem
+ * mode (a few tests flake when the entire series is run).
+ */
+ bool has_ccu_flush_bug;
+
struct {
uint32_t RB_UNKNOWN_8E04_blit;
uint32_t PC_POWER_CNTL;
diff --git a/src/freedreno/common/freedreno_devices.py b/src/freedreno/common/freedreno_devices.py
index e1eca08e593..42227faf19e 100644
--- a/src/freedreno/common/freedreno_devices.py
+++ b/src/freedreno/common/freedreno_devices.py
@@ -223,6 +223,7 @@ a6xx_gen3 = dict(
storage_16bit = True,
has_tex_filter_cubic = True,
has_sample_locations = True,
+ has_ccu_flush_bug = True,
)
# a635, a650:
diff --git a/src/freedreno/vulkan/tu_clear_blit.c b/src/freedreno/vulkan/tu_clear_blit.c
index 2bf02ca56d7..56cec909267 100644
--- a/src/freedreno/vulkan/tu_clear_blit.c
+++ b/src/freedreno/vulkan/tu_clear_blit.c
@@ -2604,6 +2604,9 @@ tu_clear_sysmem_attachment(struct tu_cmd_buffer *cmd,
tu6_emit_event_write(cmd, cs, PC_CCU_FLUSH_COLOR_TS);
tu6_emit_event_write(cmd, cs, PC_CCU_INVALIDATE_COLOR);
}
+
+ if (cmd->device->physical_device->info->a6xx.has_ccu_flush_bug)
+ tu_cs_emit_wfi(cs);
}
void
diff --git a/src/freedreno/vulkan/tu_cmd_buffer.c b/src/freedreno/vulkan/tu_cmd_buffer.c
index 869a2c8fba4..d5059cfaead 100644
--- a/src/freedreno/vulkan/tu_cmd_buffer.c
+++ b/src/freedreno/vulkan/tu_cmd_buffer.c
@@ -96,7 +96,9 @@ tu6_emit_flushes(struct tu_cmd_buffer *cmd_buffer,
tu6_emit_event_write(cmd_buffer, cs, CACHE_INVALIDATE);
if (flushes & TU_CMD_FLAG_WAIT_MEM_WRITES)
tu_cs_emit_pkt7(cs, CP_WAIT_MEM_WRITES, 0);
- if (flushes & TU_CMD_FLAG_WAIT_FOR_IDLE)
+ if ((flushes & TU_CMD_FLAG_WAIT_FOR_IDLE) ||
+ (cmd_buffer->device->physical_device->info->a6xx.has_ccu_flush_bug &&
+ (flushes & (TU_CMD_FLAG_CCU_FLUSH_COLOR | TU_CMD_FLAG_CCU_FLUSH_DEPTH))))
tu_cs_emit_wfi(cs);
if (flushes & TU_CMD_FLAG_WAIT_FOR_ME)
tu_cs_emit_pkt7(cs, CP_WAIT_FOR_ME, 0);
More information about the mesa-commit
mailing list