From 644dcc0337d8f52ba0a6d7c74927e8a66af92b5d Mon Sep 17 00:00:00 2001 From: Paulo Zanoni Date: Thu, 1 Aug 2024 15:17:27 -0700 Subject: [PATCH] anv: disable CCS for Source2 games on Xe2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dota 2 and Counter-Strike 2 really want to be able to allocate memory for both VkImages and VkBuffers from the same memory type. Xe2's special compression-only memory type does not support buffers, which makes these games crash. Disable CCS on these games as a workaround. This is a temporary workaround as we're still working towards a long-term solution (either by fixing the engine or finding a way better expose our memory types). Backport-to: 24.2 Fixes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11520 Fixes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11521 Reviewed-by: José Roberto de Souza Reviewed-by: Jianxun Zhang Signed-off-by: Paulo Zanoni Part-of: --- src/intel/vulkan/anv_instance.c | 3 +++ src/intel/vulkan/anv_physical_device.c | 3 +++ src/intel/vulkan/anv_private.h | 1 + src/util/00-mesa-defaults.conf | 6 ++++++ src/util/driconf.h | 4 ++++ 5 files changed, 17 insertions(+) diff --git a/src/intel/vulkan/anv_instance.c b/src/intel/vulkan/anv_instance.c index 5c8eb543039..f42165d8a98 100644 --- a/src/intel/vulkan/anv_instance.c +++ b/src/intel/vulkan/anv_instance.c @@ -16,6 +16,7 @@ static const driOptionDescription anv_dri_options[] = { DRI_CONF_VK_XWAYLAND_WAIT_READY(false) DRI_CONF_ANV_ASSUME_FULL_SUBGROUPS(0) DRI_CONF_ANV_DISABLE_FCV(false) + DRI_CONF_ANV_DISABLE_XE2_CCS(false) DRI_CONF_ANV_EXTERNAL_MEMORY_IMPLICIT_SYNC(true) DRI_CONF_ANV_FORCE_GUC_LOW_LATENCY(false) DRI_CONF_ANV_SAMPLE_MASK_OUT_OPENGL_BEHAVIOUR(false) @@ -166,6 +167,8 @@ anv_init_dri_options(struct anv_instance *instance) instance->enable_tbimr = driQueryOptionb(&instance->dri_options, "intel_tbimr"); instance->disable_fcv = driQueryOptionb(&instance->dri_options, "anv_disable_fcv"); + instance->disable_xe2_ccs = + driQueryOptionb(&instance->dri_options, "anv_disable_xe2_ccs"); instance->external_memory_implicit_sync = driQueryOptionb(&instance->dri_options, "anv_external_memory_implicit_sync"); instance->compression_control_enabled = diff --git a/src/intel/vulkan/anv_physical_device.c b/src/intel/vulkan/anv_physical_device.c index b961261418e..6b361ce57cf 100644 --- a/src/intel/vulkan/anv_physical_device.c +++ b/src/intel/vulkan/anv_physical_device.c @@ -2250,6 +2250,9 @@ anv_physical_device_try_create(struct vk_instance *vk_instance, goto fail_fd; } + if (devinfo.ver == 20 && instance->disable_xe2_ccs) + intel_debug |= DEBUG_NO_CCS; + /* Disable Wa_16013994831 on Gfx12.0 because we found other cases where we * need to always disable preemption : * - https://gitlab.freedesktop.org/mesa/mesa/-/issues/5963 diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 335abd937d3..ab077016c40 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1299,6 +1299,7 @@ struct anv_instance { unsigned force_vk_vendor; bool has_fake_sparse; bool disable_fcv; + bool disable_xe2_ccs; bool compression_control_enabled; bool anv_fake_nonlocal_memory; diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf index 033b4cd89dc..b9e2e17996e 100644 --- a/src/util/00-mesa-defaults.conf +++ b/src/util/00-mesa-defaults.conf @@ -1251,6 +1251,12 @@ TODO: document the other workarounds. + + +