From 3b941536c1e7dd11861d995df45d1d7f7d338966 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Tue, 11 Feb 2025 16:40:14 +0100 Subject: [PATCH] vkd3d: Apply tiler checks before we early-exit due to AMD kernel checks. Signed-off-by: Hans-Kristian Arntzen --- libs/vkd3d/device.c | 57 +++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index d3969a02c8..201cac17cd 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -3102,34 +3102,8 @@ static void d3d12_device_init_workarounds(struct d3d12_device *device) { uint32_t major, minor, patch; - if (vkd3d_config_flags & VKD3D_CONFIG_FLAG_SKIP_DRIVER_WORKAROUNDS) - return; - - if (device->device_info.properties2.properties.vendorID != 0x1002) - return; - - if (vkd3d_get_linux_kernel_version(&major, &minor, &patch)) - { - /* 6.10 amdgpu kernel changes the clear vram code to do background clears instead - * of on-demand clearing. This seems to have bugs, and we have been able to observe - * non-zeroed VRAM coming from the affected kernels. - * This workaround needs to be in place until we have confirmed a fix in upstream kernel. */ - INFO("Detected Linux kernel version %u.%u.%u\n", major, minor, patch); - - if (major > 6 || (major == 6 && minor >= 10)) - { - INFO("AMDGPU broken kernel detected. Enabling manual memory clearing path.\n"); - device->workarounds.amdgpu_broken_clearvram = true; - } - } - - /* AMDGPU seems to have a strange bug where remapping a page to NULL can cause an impossible - * page table issue where it's now possible to fault on a PRT page. - * It's unknown which kernel version introduced it and when it will be fixed. - * Only seems to affect very specific content which does not really rely on the NULL page behavior anyway. */ - device->workarounds.amdgpu_broken_null_tile_mapping = true; - - /* IMRs should not have this workaround enabled or else perf will drop */ + /* IMRs should not have this workaround enabled or else perf will drop. + * Technically, this isn't really a workaround as much as a speed hack on IMR. */ switch (device->device_info.vulkan_1_2_properties.driverID) { case VK_DRIVER_ID_IMAGINATION_PROPRIETARY: @@ -3153,6 +3127,33 @@ static void d3d12_device_init_workarounds(struct d3d12_device *device) default: break; } + + if (vkd3d_config_flags & VKD3D_CONFIG_FLAG_SKIP_DRIVER_WORKAROUNDS) + return; + + if (device->device_info.properties2.properties.vendorID == 0x1002) + { + if (vkd3d_get_linux_kernel_version(&major, &minor, &patch)) + { + /* 6.10 amdgpu kernel changes the clear vram code to do background clears instead + * of on-demand clearing. This seems to have bugs, and we have been able to observe + * non-zeroed VRAM coming from the affected kernels. + * This workaround needs to be in place until we have confirmed a fix in upstream kernel. */ + INFO("Detected Linux kernel version %u.%u.%u\n", major, minor, patch); + + if (major > 6 || (major == 6 && minor >= 10)) + { + INFO("AMDGPU broken kernel detected. Enabling manual memory clearing path.\n"); + device->workarounds.amdgpu_broken_clearvram = true; + } + } + + /* AMDGPU seems to have a strange bug where remapping a page to NULL can cause an impossible + * page table issue where it's now possible to fault on a PRT page. + * It's unknown which kernel version introduced it and when it will be fixed. + * Only seems to affect very specific content which does not really rely on the NULL page behavior anyway. */ + device->workarounds.amdgpu_broken_null_tile_mapping = true; + } } static HRESULT vkd3d_create_vk_device(struct d3d12_device *device,