radv: fix RADV_DEBUG=hang with multiple cmdbuffer per submission

With RADV_DEBUG=hang, there is only one cmdbuffer per submission and
this has been broken recently.

This fixes a segfault when generating GPU hang reports.

Fixes: 76deaa1b1a ("radv: Refactor command buffer handling in radv_queue_submit_normal.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20860>
This commit is contained in:
Samuel Pitoiset 2023-01-23 16:43:32 +01:00 committed by Marge Bot
parent 75ae391375
commit 7b76d46e38

View file

@ -5854,6 +5854,7 @@ radv_queue_submit_normal(struct radv_queue *queue, struct vk_queue_submit *submi
const bool last_submit = j + advance == cmd_buffer_count;
bool submit_ace = false;
unsigned num_submitted_cs = 0;
unsigned cs_idx = 0;
if (queue->device->trace_bo)
*queue->device->trace_id_ptr = 0;
@ -5876,6 +5877,7 @@ radv_queue_submit_normal(struct radv_queue *queue, struct vk_queue_submit *submi
can_patch &= !(cmd_buffer->usage_flags & VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT);
cs_array[num_submitted_cs++] = cmd_buffer->cs;
cs_idx = num_submitted_cs - 1;
}
/* Add gang wait postambles to make sure the gang leader waits for the whole gang. */
@ -5899,7 +5901,7 @@ radv_queue_submit_normal(struct radv_queue *queue, struct vk_queue_submit *submi
goto fail;
if (queue->device->trace_bo) {
radv_check_gpu_hangs(queue, cs_array[j]);
radv_check_gpu_hangs(queue, cs_array[cs_idx]);
}
if (queue->device->tma_bo) {