radv: add radv_wait_for_vm_map_updates drirc and enable for Forza Horizon 5
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13321
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38031>
This commit is contained in:
Samuel Pitoiset 2025-10-23 18:06:22 +02:00 committed by Marge Bot
parent fc0cfaae1c
commit 2009815d61
5 changed files with 14 additions and 0 deletions

View file

@ -240,6 +240,10 @@ radv_alloc_memory(struct radv_device *device, const VkMemoryAllocateInfo *pAlloc
radv_device_should_clear_vram(device))
flags |= RADEON_FLAG_ZERO_VRAM;
/* Only apply the workaround for BOs created by the application, not by the driver. */
if (instance->drirc.debug.wait_for_vm_map_updates)
flags |= RADEON_FLAG_VM_UPDATE_WAIT;
/* On GFX12, DCC is transparent to the userspace driver and PTE.DCC is
* set per buffer allocation. Only VRAM can have DCC. When the kernel
* moves a buffer from VRAM->GTT it decompresses. When the kernel moves

View file

@ -200,6 +200,7 @@ static const driOptionDescription radv_dri_options[] = {
DRI_CONF_RADV_EMULATE_RT(false)
DRI_CONF_RADV_ENABLE_FLOAT16_GFX8(false)
DRI_CONF_RADV_COOPERATIVE_MATRIX2_NV(false)
DRI_CONF_RADV_WAIT_FOR_VM_MAP_UPDATES(false)
DRI_CONF_SECTION_END
};
// clang-format on
@ -235,6 +236,7 @@ radv_init_dri_debug_options(struct radv_instance *instance)
drirc->debug.split_fma = driQueryOptionb(&drirc->options, "radv_split_fma");
drirc->debug.ssbo_non_uniform = driQueryOptionb(&drirc->options, "radv_ssbo_non_uniform");
drirc->debug.tex_non_uniform = driQueryOptionb(&drirc->options, "radv_tex_non_uniform");
drirc->debug.wait_for_vm_map_updates = driQueryOptionb(&drirc->options, "radv_wait_for_vm_map_updates");
drirc->debug.zero_vram = driQueryOptionb(&drirc->options, "radv_zero_vram");
drirc->debug.app_layer = driQueryOptionstr(&drirc->options, "radv_app_layer");

View file

@ -57,6 +57,7 @@ struct radv_drirc {
bool ssbo_non_uniform;
bool tex_non_uniform;
bool zero_vram;
bool wait_for_vm_map_updates;
char *app_layer;
int override_uniform_offset_alignment;
} debug;

View file

@ -236,6 +236,9 @@ Application bugs worked around in this file:
<!-- The full WA hurts performance too much, use the partial one
that seems fine overall. -->
<option name="radv_gfx12_hiz_wa" value="partial" />
<!-- Force waiting for VM MAP updates at allocation time to
workaround an use-before-alloc which causes GPU hangs. -->
<option name="radv_wait_for_vm_map_updates" value="true" />
</application>
<application name="Far Cry 2" application_name_match="FarCry2.exe">

View file

@ -759,6 +759,10 @@
DRI_CONF_OPT_B(radv_rt_wave64, def, \
"Force wave64 in RT shaders")
#define DRI_CONF_RADV_WAIT_FOR_VM_MAP_UPDATES(def) \
DRI_CONF_OPT_B(radv_wait_for_vm_map_updates, def, \
"Wait for VM MAP updates at allocation time to mitigate use-before-alloc")
/**
* Overrides for forcing re-compilation of pipelines when RADV_BUILD_ID_OVERRIDE is enabled.
* These need to be bumped every time a compiler bugfix is backported (up to 8 shader