From a89752d6300a850537b7f509b5662984b8aae072 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Wed, 19 Jul 2023 23:10:22 +0000 Subject: [PATCH] turnip: flush cache for dstBuffer in vkCmdCopyQueryPoolResults There can be other writes to the dstBuffer gated by proper barriers beforehand. TEST=dEQP-VK.pipeline.*.timestamp.* with Venus on Turnip Fixes: 487aa807bd1b ("tu: Rewrite flushing to use barriers") Signed-off-by: Yiwei Zhang Part-of: --- src/freedreno/vulkan/tu_cmd_buffer.cc | 2 +- src/freedreno/vulkan/tu_cmd_buffer.h | 3 +++ src/freedreno/vulkan/tu_query.cc | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/freedreno/vulkan/tu_cmd_buffer.cc b/src/freedreno/vulkan/tu_cmd_buffer.cc index 6324a1d..1b74e91 100644 --- a/src/freedreno/vulkan/tu_cmd_buffer.cc +++ b/src/freedreno/vulkan/tu_cmd_buffer.cc @@ -184,7 +184,7 @@ tu6_emit_flushes(struct tu_cmd_buffer *cmd_buffer, } /* "Normal" cache flushes outside the renderpass, that don't require any special handling */ -static void +void tu_emit_cache_flush(struct tu_cmd_buffer *cmd_buffer) { tu6_emit_flushes(cmd_buffer, &cmd_buffer->cs, &cmd_buffer->state.cache); diff --git a/src/freedreno/vulkan/tu_cmd_buffer.h b/src/freedreno/vulkan/tu_cmd_buffer.h index c7311b4..570cf61 100644 --- a/src/freedreno/vulkan/tu_cmd_buffer.h +++ b/src/freedreno/vulkan/tu_cmd_buffer.h @@ -624,6 +624,9 @@ void tu_render_pass_state_merge(struct tu_render_pass_state *dst, VkResult tu_cmd_buffer_begin(struct tu_cmd_buffer *cmd_buffer, const VkCommandBufferBeginInfo *pBeginInfo); +void +tu_emit_cache_flush(struct tu_cmd_buffer *cmd_buffer); + void tu_emit_cache_flush_renderpass(struct tu_cmd_buffer *cmd_buffer); void tu_emit_cache_flush_ccu(struct tu_cmd_buffer *cmd_buffer, diff --git a/src/freedreno/vulkan/tu_query.cc b/src/freedreno/vulkan/tu_query.cc index 2084d9a..03954ab 100644 --- a/src/freedreno/vulkan/tu_query.cc +++ b/src/freedreno/vulkan/tu_query.cc @@ -614,6 +614,9 @@ emit_copy_query_pool_results(struct tu_cmd_buffer *cmdbuf, VkDeviceSize stride, VkQueryResultFlags flags) { + /* Flush cache for the buffer to copy to. */ + tu_emit_cache_flush(cmdbuf); + /* From the Vulkan 1.1.130 spec: * * vkCmdCopyQueryPoolResults is guaranteed to see the effect of previous -- 2.7.4