From b98eebbcb2ab25a6a9de4e97f352715614c72c48 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Mon, 1 Jul 2024 14:45:38 -0700 Subject: [PATCH] intel/brw: Implement null push constant workaround. This implements an undocumented workaround for a hardware bug that affects draw calls with a pixel shader that has 0 push constant cycles when TBIMR is enabled, which has been seen to lead to a hang with Fallout 3 and Metal Gear Rising Revengeance. This hardware bug has been reported as HSDES#22020184996 which is still pending a resolution by the hardware team. However since this workaround found empirically has been confirmed to fix the issue reliably and it's relatively harmless it seems worth checking in already even though no final W/A number is available nor has the W/A json file been updated. To avoid the issue we simply pad the push constant payload to be at least 1 register. This is enabled via a brw_wm_prog_key since the driver needs to be in agreement with the compiler on whether the dummy push constant cycle is present, and it can be avoided in cases where the driver knows that TBIMR will be disabled (e.g. for BLORP). Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10728 Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11399 Fixes: 57decad9768a445 ("intel/xehp: Enable TBIMR by default.") Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/compiler/brw_compiler.h | 3 ++- src/intel/compiler/brw_fs.cpp | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h index 854c75b7d2a..4952ae10ef6 100644 --- a/src/intel/compiler/brw_compiler.h +++ b/src/intel/compiler/brw_compiler.h @@ -331,8 +331,9 @@ struct brw_wm_prog_key { bool coherent_fb_fetch:1; bool ignore_sample_mask_out:1; bool coarse_pixel:1; + bool null_push_constant_tbimr_workaround:1; - uint64_t padding:36; + uint64_t padding:35; }; struct brw_cs_prog_key { diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index 90e750d7b4f..123dc6dba7b 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -1192,6 +1192,9 @@ fs_visitor::assign_curb_setup() } prog_data->curb_read_length = uniform_push_length + ubo_push_length; + if (stage == MESA_SHADER_FRAGMENT && + ((struct brw_wm_prog_key *)key)->null_push_constant_tbimr_workaround) + prog_data->curb_read_length = MAX2(1, prog_data->curb_read_length); uint64_t used = 0; bool is_compute = gl_shader_stage_is_compute(stage);