From d1a2ba57f9f8fe0ed87a7286605bda4a954abd71 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 10 Mar 2025 18:29:40 +0100 Subject: [PATCH] radv: fix a GPU hang with inherited rendering and HiZ/HiS on GFX1201 With secondary command buffers, inherited rendering can be used but it's basically impossible to know if the depth/stencil attachment enabled HiZ/HiS. But it's required to disable WALK_ALIGN8 to avoid GPU hangs. This assumes that HiZ/HiS is enabled for inherited rendering as long as a depth/stencil attachment is used. It's not the most optimal approach but it's not supposed to hurt either. This fixes a GPU hang with dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.contents_secondary_cmdbuffers and friends. GFX1200 isn't affected because it doesn't support HiZ/HiS. Cc: mesa-stable Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_cmd_buffer.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 1e5ae5dd5c4..00c2599b05b 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -3625,6 +3625,7 @@ radv_emit_rasterization_samples(struct radv_cmd_buffer *cmd_buffer) { struct radv_device *device = radv_cmd_buffer_device(cmd_buffer); const struct radv_physical_device *pdev = radv_device_physical(device); + const struct radv_instance *instance = radv_physical_device_instance(pdev); unsigned rasterization_samples = radv_get_rasterization_samples(cmd_buffer); unsigned ps_iter_samples = radv_get_ps_iter_samples(cmd_buffer); const struct radv_dynamic_state *d = &cmd_buffer->state.dynamic; @@ -3639,6 +3640,12 @@ radv_emit_rasterization_samples(struct radv_cmd_buffer *cmd_buffer) if (render->ds_att.iview) { const struct radeon_surf *surf = &render->ds_att.iview->image->planes[0].surface; has_hiz_his = surf->u.gfx9.zs.hiz.offset || surf->u.gfx9.zs.his.offset; + } else if (render->ds_att.format && !(instance->debug_flags & RADV_DEBUG_NO_HIZ)) { + /* For inherited rendering with secondary commands buffers, assume HiZ/HiS is enabled if + * there is a depth/stencil attachment. This shouldn't hurt and it's required to disable + * WALK_ALIGN8 to avoid GPU hangs. + */ + has_hiz_his = true; } walk_align8 = !has_hiz_his && !cmd_buffer->state.uses_vrs_attachment;