Bug 105292 - vkGetQueryPoolResults returns incorrect query status for large query buffers (bisected)
Summary: vkGetQueryPoolResults returns incorrect query status for large query buffers ...
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/radeon (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
Depends on:
Reported: 2018-02-28 14:47 UTC by Philip Rebohle
Modified: 2018-03-01 08:17 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

Modification to the 'occlusionquery' demo to reproduce the issue (4.36 KB, patch)
2018-02-28 14:47 UTC, Philip Rebohle
Details | Splinter Review
workaround (436 bytes, patch)
2018-02-28 16:00 UTC, Samuel Pitoiset
Details | Splinter Review

Description Philip Rebohle 2018-02-28 14:47:25 UTC
Created attachment 137687 [details] [review]
Modification to the 'occlusionquery' demo to reproduce the issue

Under certain circumstances, vkGetQueryPoolResults will always return VK_NOT_READY for a query pool, even when all of the requested queries should be available. When using VK_QUERY_RESULT_WAIT_BIT, the function never returns.

The attached patch is a modification to Sascha Willems' 'occlusionquery' demo which triggers the issue. Tested on an RX 480, mesa-git as of d448954228e69fd1b4000ea13e28c2ba2832db13, with validation layers enabled.

The following conditions have to be met in order to trigger this issue:
- The query pool has to be fairly large (>= 32 queries)
- vkCmdBeginQuery has to be called shortly or immediately after vkCmdResetQueryPool, outside a render pass instance.

This issue was introduced with the following commit:
[a41e2e9cf5f865f21e32cac2ed2e25dd21a05119] radv: allow to use a compute shader for resetting the query pool
Comment 1 Samuel Pitoiset 2018-02-28 15:56:54 UTC
Yeah, I think it's because we don't emit the cache flushes after resetting the query pool with a compute shader.
Comment 2 Samuel Pitoiset 2018-02-28 16:00:49 UTC
Created attachment 137690 [details] [review]

This fixes the issue for me, but I will probably come with a better solution a bit later.
Comment 3 Samuel Pitoiset 2018-02-28 17:00:35 UTC
Here's the fix https://patchwork.freedesktop.org/patch/207416/

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.