venus: add a missing barrier before copying query feedback

The 1st sync scope of vkCmdCopyQueryPoolResults is not sufficient to
cover transfer writes against query feedback buffer. We must ensure
ordering against prior query reset cmd where the feedback buffer fill
gets injected.

Fixes: de4593faa1 ("venus: add query pool feedback cmds")
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24130>
(cherry picked from commit ed79b30639)
This commit is contained in:
Yiwei Zhang 2023-07-12 19:05:20 +00:00 committed by Dylan Baker
parent 6e8e1b8309
commit 8ada1e6e4d
2 changed files with 20 additions and 1 deletions

View file

@ -174,7 +174,7 @@
"description": "venus: add a missing barrier before copying query feedback",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "de4593faa193f575b8524c49b8e64f2dc12b498a",
"notes": null

View file

@ -528,6 +528,25 @@ vn_feedback_query_copy_cmd_record(VkCommandBuffer cmd_handle,
const size_t slot_size = (pool->result_array_size * 8) + 8;
const size_t offset = slot_size * query;
/* The first synchronization scope of vkCmdCopyQueryPoolResults does not
* include the query feedback buffer. Insert a barrier to ensure ordering
* against feedback buffer fill cmd injected in vkCmdResetQueryPool.
*/
const VkBufferMemoryBarrier buf_barrier_before = {
.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,
.pNext = NULL,
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.buffer = pool->feedback->buffer,
.offset = offset,
.size = slot_size * count,
};
vn_CmdPipelineBarrier(cmd_handle, VK_PIPELINE_STAGE_TRANSFER_BIT,
VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 1,
&buf_barrier_before, 0, NULL);
/* Per spec: "The first synchronization scope includes all commands
* which reference the queries in queryPool indicated by query that
* occur earlier in submission order. If flags does not include