<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 28, 2018 at 6:00 PM, Samuel Pitoiset <span dir="ltr"><<a href="mailto:samuel.pitoiset@gmail.com" target="_blank">samuel.pitoiset@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If the query pool has been previously resetted using the compute<br>
shader path.<br>
<br>
Fixes: a41e2e9cf5 ("radv: allow to use a compute shader for resetting the query pool")<br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=105292" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=105292</a><br>
Cc: "18.0" <<a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.<wbr>freedesktop.org</a>><br>
Signed-off-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>><br>
---<br>
src/amd/vulkan/radv_private.h | 1 +<br>
src/amd/vulkan/radv_query.c | 11 +++++++++++<br>
2 files changed, 12 insertions(+)<br>
<br>
diff --git a/src/amd/vulkan/radv_private.<wbr>h b/src/amd/vulkan/radv_private.<wbr>h<br>
index c72df5a737..dd57403894 100644<br>
--- a/src/amd/vulkan/radv_private.<wbr>h<br>
+++ b/src/amd/vulkan/radv_private.<wbr>h<br>
@@ -1604,6 +1604,7 @@ struct radv_query_pool {<br>
char *ptr;<br>
VkQueryType type;<br>
uint32_t pipeline_stats_mask;<br>
+ bool pending_reset;<br></blockquote><div><br></div><div>You can't do that, since we may be recording multiple command buffers simultaneously with the same pool. </div><div><br></div><div>The ideal would be per commandbuffer per pool, but in the interest of adding not too much overhead, just put it into the command buffer? (and make surethat either it is set at true at the start of the cmd buffer, or we flush on EndCommandBuffer if it is set, so it works when the reset and beginQuery are in different command buffers)</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
};<br>
<br>
struct radv_semaphore {<br>
diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c<br>
index ace745e4e6..d602707f5e 100644<br>
--- a/src/amd/vulkan/radv_query.c<br>
+++ b/src/amd/vulkan/radv_query.c<br>
@@ -771,6 +771,7 @@ VkResult radv_CreateQueryPool(<br>
unreachable("creating unhandled query type");<br>
}<br>
<br>
+ pool->pending_reset = false;<br>
pool->type = pCreateInfo->queryType;<br>
pool->pipeline_stats_mask = pCreateInfo-><wbr>pipelineStatistics;<br>
pool->availability_offset = pool->stride * pCreateInfo->queryCount;<br>
@@ -1070,6 +1071,8 @@ void radv_CmdResetQueryPool(<br>
pool->availability_offset + firstQuery * 4,<br>
queryCount * 4, 0);<br>
}<br>
+<br>
+ pool->pending_reset = true;<br>
}<br>
<br>
void radv_CmdBeginQuery(<br>
@@ -1086,6 +1089,14 @@ void radv_CmdBeginQuery(<br>
<br>
radv_cs_add_buffer(cmd_buffer-<wbr>>device->ws, cs, pool->bo, 8);<br>
<br>
+ if (pool->pending_reset) {<br>
+ /* Make sure to emit the cache flushes if the query pool has<br>
+ * been previously resetted using a compute shader.<br>
+ */<br>
+ si_emit_cache_flush(cmd_<wbr>buffer);<br>
+ pool->pending_reset = false;<br>
+ }<br>
+<br>
switch (pool->type) {<br>
case VK_QUERY_TYPE_OCCLUSION:<br>
radeon_check_space(cmd_buffer-<wbr>>device->ws, cs, 7);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.16.2<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>