tu: Prevent GPU hang with occlusion query + certain depth state

This state combination wedges something in GPU causing hang.
Forcing A6XX_LATE_Z prevents it. Prop driver does the same.

CC: mesa-stable

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37765>
(cherry picked from commit 02138d96fd)
This commit is contained in:
Danylo Piliaiev 2025-10-08 16:03:13 +02:00 committed by Eric Engestrom
parent 7bd263c9ce
commit 7e6440ca6f
2 changed files with 13 additions and 1 deletions

View file

@ -3104,7 +3104,7 @@
"description": "tu: Prevent GPU hang with occlusion query + certain depth state",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -6362,6 +6362,18 @@ tu6_build_depth_plane_z_mode(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
cmd->state.occlusion_query_may_be_running)
zmode = A6XX_EARLY_Z_LATE_Z;
VkCompareOp compare_op =
cmd->vk.dynamic_graphics_state.ds.depth.compare_op;
/* This state combination wedges something in GPU causing hang.
* Forcing A6XX_LATE_Z prevents it. Prop driver does the same.
*/
if (zmode == A6XX_EARLY_Z_LATE_Z && !depth_write &&
cmd->state.occlusion_query_may_be_running &&
(compare_op == VK_COMPARE_OP_ALWAYS ||
compare_op == VK_COMPARE_OP_NEVER)) {
zmode = A6XX_LATE_Z;
}
if (zmode == A6XX_EARLY_Z_LATE_Z &&
(cmd->state.stencil_written_on_depth_fail || fs->fs.per_samp ||
!vk_format_has_depth(depth_format) || !ds_test_enable)) {