radv/amdgpu: Fix crash with RADV_DEBUG=noibs

After a refactor last year, the noibs option stopped working
because it hits an assertion when empty IBs are submitted.

Emit a single large NOP packet to avoid submitting empty IBs.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37121>
(cherry picked from commit 132a61c6b7)
This commit is contained in:
Timur Kristóf 2025-08-20 14:57:17 +02:00 committed by Eric Engestrom
parent 4623e861e4
commit 36ef404a6c
2 changed files with 6 additions and 1 deletions

View file

@ -8714,7 +8714,7 @@
"description": "radv/amdgpu: Fix crash with RADV_DEBUG=noibs",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -457,6 +457,11 @@ radv_amdgpu_winsys_cs_pad(struct radeon_cmdbuf *_cs, unsigned leave_dw_space)
radeon_emit_unchecked(&cs->base, PKT3(PKT3_NOP, remaining - 2, 0));
cs->base.cdw += remaining - 1;
}
} else if (cs->base.cdw == 0 && leave_dw_space == 0) {
/* Emit a NOP packet to avoid submitting a completely empty IB. */
const int remaining = pad_dw_mask + 1;
radeon_emit_unchecked(&cs->base, PKT3(PKT3_NOP, remaining - 2, 0));
cs->base.cdw += remaining - 1;
}
} else {
/* Don't pad on VCN encode/unified as no NOPs */