radv: fix waiting on the last enabled RB for occlusion queries

Wait on the last enabled RB, not the last RB. This fixes GPU hangs
because the GPU was waiting forever.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4212
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8836>
(cherry picked from commit 7e47fe9a94)
This commit is contained in:
Samuel Pitoiset 2021-02-02 19:52:09 +01:00 committed by Dylan Baker
parent ca39949a27
commit 60f12ee177
2 changed files with 4 additions and 2 deletions

View file

@ -2794,7 +2794,7 @@
"description": "radv: fix waiting on the last enabled RB for occlusion queries",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},

View file

@ -1317,9 +1317,11 @@ void radv_CmdCopyQueryPoolResults(
switch (pool->type) {
case VK_QUERY_TYPE_OCCLUSION:
if (flags & VK_QUERY_RESULT_WAIT_BIT) {
unsigned enabled_rb_mask = cmd_buffer->device->physical_device->rad_info.enabled_rb_mask;
uint32_t rb_avail_offset = 16 * util_last_bit(enabled_rb_mask) - 4;
for(unsigned i = 0; i < queryCount; ++i, dest_va += stride) {
unsigned query = firstQuery + i;
uint64_t src_va = va + query * pool->stride + pool->stride - 4;
uint64_t src_va = va + query * pool->stride + rb_avail_offset;
radeon_check_space(cmd_buffer->device->ws, cs, 7);