radv/amdgpu: fix executing secondaries without IB2

If a secondary cmdbuf has been grown and is executed without IB2
(eg. on compute queue or when it's not allowed), the ib size ptr
contains chaining info, which means the IB size was wrong.

This fixes CPU crashes when running gl_vk_meshlet_cadscene.

Fixes: 277b2afd70 ("radv/amdgpu: add support for executing DGC cmdbuf with RADV_DEBUG=noibs")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24891>
(cherry picked from commit 9206aeb077)
This commit is contained in:
Samuel Pitoiset 2023-08-25 17:26:30 +02:00 committed by Dylan Baker
parent 1763073c8a
commit 2e9cda7e77
2 changed files with 3 additions and 2 deletions

View file

@ -7894,7 +7894,7 @@
"description": "radv/amdgpu: fix executing secondaries without IB2",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "277b2afd7081fd41fe08db6890f58f2ac1fbe42e",
"notes": null

View file

@ -455,7 +455,8 @@ radv_amdgpu_cs_finalize(struct radeon_cmdbuf *_cs)
}
/* Append the current (last) IB to the array of IB buffers. */
radv_amdgpu_cs_add_ib_buffer(cs, cs->ib_buffer, 0, cs->use_ib ? *cs->ib_size_ptr : cs->base.cdw, false);
radv_amdgpu_cs_add_ib_buffer(cs, cs->ib_buffer, 0, cs->use_ib ? G_3F2_IB_SIZE(*cs->ib_size_ptr) : cs->base.cdw,
false);
/* Prevent freeing this BO twice. */
cs->ib_buffer = NULL;