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>
This commit is contained in:
Samuel Pitoiset 2021-02-02 19:52:09 +01:00
parent c167b773fe
commit 7e47fe9a94

View file

@ -1316,9 +1316,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);