Commit 37f9788e authored by Lionel Landwerlin's avatar Lionel Landwerlin

anv: flush pipeline before query result copies

Pipeline state pending bits should be taken into account when copying

In the particular bug below, the results of the
vkCmdCopyQueryPoolResults() command was being overwritten by the
preceding vkCmdCopyBuffer() with a same destination buffer. This is
because we copy the buffers using the 3D pipeline whereas we copy the
query results using the command streamer. Those pieces of HW work in
parallel and the results are somewhat undefined.

v2: Unconditionally flush the pipeline before copying the results

v3: Wrap & expressions (Jason)
Signed-off-by: Lionel Landwerlin's avatarLionel Landwerlin <>
Suggested-by: Jason Ekstrand's avatarJason Ekstrand <>
Reviewed-by: Jason Ekstrand's avatarJason Ekstrand <>
parent 39b20b7d
......@@ -729,11 +729,10 @@ void genX(CmdCopyQueryPoolResults)(
ANV_FROM_HANDLE(anv_query_pool, pool, queryPool);
ANV_FROM_HANDLE(anv_buffer, buffer, destBuffer);
anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) {
pc.CommandStreamerStallEnable = true;
pc.StallAtPixelScoreboard = true;
if ((flags & VK_QUERY_RESULT_WAIT_BIT) ||
(cmd_buffer->state.pending_pipe_bits & ANV_PIPE_FLUSH_BITS)) {
cmd_buffer->state.pending_pipe_bits |= ANV_PIPE_CS_STALL_BIT;
struct anv_address dest_addr = anv_address_add(buffer->address, destOffset);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment