From 7ef9b0358c0012f7b9a43a37eba0b663b6f7e8e1 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: (cherry picked from commit 644dcc0337d8f52ba0a6d7c74927e8a66af92b5d) --- .pick_status.json | 2 +- src/intel/vulkan/anv_device.c | 6 ++++++ src/intel/vulkan/anv_private.h | 1 + src/util/00-mesa-defaults.conf | 6 ++++++ src/util/driconf.h | 4 ++++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index ed21bdccfc9..e97131ae56c 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -754,7 +754,7 @@ "description": "anv: disable CCS for Source2 games on Xe2", "nominated": true, "nomination_type": 4, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index e988569c9a6..aada27472ed 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -80,6 +80,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) @@ -2418,6 +2419,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 @@ -2758,6 +2762,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_private.h b/src/intel/vulkan/anv_private.h index a1788d11d59..66873879fca 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1274,6 +1274,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. + + +