Skip to content

Commit

Permalink
vkd3d: Apply tiler checks before we early-exit due to AMD kernel checks.
Browse files Browse the repository at this point in the history
Signed-off-by: Hans-Kristian Arntzen <[email protected]>
  • Loading branch information
HansKristian-Work committed Feb 11, 2025
1 parent 8a9cdbe commit 8f5fa2a
Showing 1 changed file with 29 additions and 28 deletions.
57 changes: 29 additions & 28 deletions libs/vkd3d/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
Expand Down

0 comments on commit 8f5fa2a

Please sign in to comment.