Mesa (staging/18.3): anv: flush pipeline before query result copies

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Dec 3 18:33:05 UTC 2018


Module: Mesa
Branch: staging/18.3
Commit: 98d571d212701e235266ad2db999f4b57a13517f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=98d571d212701e235266ad2db999f4b57a13517f

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Thu Nov 29 13:02:03 2018 +0000

anv: flush pipeline before query result copies

Pipeline state pending bits should be taken into account when copying
results.

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
    (Jason)

v3: Wrap & expressions (Jason)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Suggested-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108894
Cc: mesa-stable at lists.freedesktop.org
(cherry picked from commit 37f9788e9a8e443772b5ad6f339567e6ae6a8320)

---

 src/intel/vulkan/genX_query.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/intel/vulkan/genX_query.c b/src/intel/vulkan/genX_query.c
index ce8757f264..4831c4ea33 100644
--- a/src/intel/vulkan/genX_query.c
+++ b/src/intel/vulkan/genX_query.c
@@ -729,11 +729,10 @@ void genX(CmdCopyQueryPoolResults)(
    ANV_FROM_HANDLE(anv_query_pool, pool, queryPool);
    ANV_FROM_HANDLE(anv_buffer, buffer, destBuffer);
 
-   if (flags & VK_QUERY_RESULT_WAIT_BIT) {
-      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;
+      genX(cmd_buffer_apply_pipe_flushes)(cmd_buffer);
    }
 
    struct anv_address dest_addr = anv_address_add(buffer->address, destOffset);




More information about the mesa-commit mailing list