<div dir="ltr"><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 29, 2018 at 9:43 AM Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Pipeline barriers inserted through vkCmdPipelineBarrier() should be<br>
taken into account when copying results.<br>
<br>
In the particular bug below, the results of the<br>
vkCmdCopyQueryPoolResults() command was being overwritten by the<br>
preceding vkCmdCopyBuffer() with a same destination buffer. This is<br>
because we copy the buffers using the 3D pipeline whereas we copy the<br>
query results using the command streamer. Those work in parallel<br>
unless synchronized.<br>
<br>
Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>><br>
Suggested-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>><br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=108894" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=108894</a><br>
Cc: <a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.freedesktop.org</a><br>
---<br>
src/intel/vulkan/genX_query.c | 7 +++----<br>
1 file changed, 3 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/genX_query.c b/src/intel/vulkan/genX_query.c<br>
index ce8757f2643..edf9962179a 100644<br>
--- a/src/intel/vulkan/genX_query.c<br>
+++ b/src/intel/vulkan/genX_query.c<br>
@@ -730,10 +730,9 @@ void genX(CmdCopyQueryPoolResults)(<br>
ANV_FROM_HANDLE(anv_buffer, buffer, destBuffer);<br>
<br>
if (flags & VK_QUERY_RESULT_WAIT_BIT) {<br>
- anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) {<br>
- pc.CommandStreamerStallEnable = true;<br>
- pc.StallAtPixelScoreboard = true;<br>
- }<br>
+ if (cmd_buffer->state.pending_pipe_bits & ANV_PIPE_FLUSH_BITS)<br>
+ cmd_buffer->state.pending_pipe_bits |= ANV_PIPE_CS_STALL_BIT;<br>
+ genX(cmd_buffer_apply_pipe_flushes)(cmd_buffer);<br></blockquote><div><br></div><div>Unfortunately, I think we need to do it somewhat unconditionally. More specifically....</div><div><br></div><div>if ((flags & VK_QUERY_RESULT_WAIT_BIT) ||</div><div> (cmd_buffer->state.pending_pipe_bits & ANV_PIPE_FLUSH_BITS)) {</div><div> cmd_buffer->state.pending_pipe_bits |= ANV_PIPE_CS_STALL_BIT;</div><div> genX(cmd_buffer_apply_pipe_flushes)(cmd_buffer);</div><div>}</div><div><br></div><div>Otherwise, we still have a write-after-write hazard if the client does a vkCmdFillBuffer to zero out the destination prior to copying query pool results into it.</div><div><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
}<br>
<br>
struct anv_address dest_addr = anv_address_add(buffer->address, destOffset);<br>
-- <br>
2.20.0.rc1<br>
<br>
</blockquote></div></div></div>