From 7e9886def206595699472c7f3d3fbae021895de4 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 20 Apr 2026 15:06:29 +0200 Subject: [PATCH] radv: fix GPU hangs with PS epilogs and secondaries properly The previous fix was incomplete because if the same graphics pipeline and the same PS epilog are rebind after vkCmdExecuteCommands(), the PS epilog state wouldn't be re-emitted, and it will use a wrong VA (in case both fragment shader user SGPRs aren't similar either). Resetting the PS epilog to NULL in the primary should prevent any issues, but this tracking still need to be improved because it caused two issues recently. Fixes: 1a00587c44e ("radv: fix a GPU hang with PS epilogs and secondary command buffers") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15176 Signed-off-by: Samuel Pitoiset (cherry picked from commit a73fc90bcd1380cf8dc2d88d8d94594ddd77fd2e) Part-of: --- .pick_status.json | 2 +- src/amd/vulkan/radv_cmd_buffer.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 62cb42a57f0..892cce767a1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -144,7 +144,7 @@ "description": "radv: fix GPU hangs with PS epilogs and secondaries properly", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "1a00587c44ecb97d9978cd6bed8e76e56c6697f5", "notes": null diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index e09be04d395..2a4a54fcd6b 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -10020,7 +10020,6 @@ radv_CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCou primary->state.emitted_compute_pipeline = secondary->state.emitted_compute_pipeline; primary->state.emitted_rt_pipeline = secondary->state.emitted_rt_pipeline; - primary->state.ps_epilog = secondary->state.ps_epilog; primary->state.emitted_vs_prolog = secondary->state.emitted_vs_prolog; if (secondary->state.last_ia_multi_vgt_param) { @@ -10083,6 +10082,9 @@ radv_CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCou primary->state.last_first_instance = -1; primary->state.last_drawid = -1; primary->state.last_vertex_offset_valid = false; + + /* Make sure to re-emit the PS epilog if the same graphics pipeline is bind again. */ + primary->state.ps_epilog = NULL; } static void