anv: Allow compressed memtypes with default buffer types
Source 2 games segfault if certain buffers are not able to use the same memory types as images. CS2 specifically expects this to be the case for vertex and index buffers (VK_BUFFER_USAGE_2_INDEX_BUFFER_BIT, VK_BUFFER_USAGE_2_VERTEX_BUFFER_BIT). I have not tested other Source 2 games to see how much the requirement differs for the usage (if at all). Up until now, we've disabled CCS for the Source 2 engine with the anv_disable_xe2_ccs driconf option. However, this option is not great for performance. So, replace this with a new option to allow the same memory types we use for images on buffers - anv_enable_buffer_comp. Compression of buffers is generally not good for performance. I collected the result of unconditionally enabling the feature in the performance CI on BMG. I used the default configuration to average the result of two runs of each trace. The CI reports that 4 game traces would regress between 0.44-1.01% FPS with buffer compression. However, the CI actually shows it to be beneficial in three of our game traces: * Cyberpunk-trace-dx12-1080p-high 106.51% * Hitman3-trace-dx12-1080p-med 101.59% * Blackops3-trace-dx11-1080p-high 100.44% So, enable the option for the two games we already have driconf entries for, Cyberpunk and Hitman3. Of course, also enable the option for Source 2 games. Casey Bowman reports that on BMG, some frame times drop from ~15ms to ~7ms in CS2. This is in large part due to the removal of HiZ resolves, which is a consequence of the game now using of HIZ_CCS_WT instead of plain HIZ. Ref: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11520 Acked-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32519>
This commit is contained in:
@@ -72,6 +72,9 @@ anv_get_buffer_memory_requirements(struct anv_device *device,
|
||||
else if (usage & (VK_BUFFER_USAGE_2_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT |
|
||||
VK_BUFFER_USAGE_2_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT))
|
||||
memory_types = device->physical->memory.dynamic_visible_mem_types;
|
||||
else if (device->physical->instance->enable_buffer_comp)
|
||||
memory_types = device->physical->memory.default_buffer_mem_types |
|
||||
device->physical->memory.compressed_mem_types;
|
||||
else
|
||||
memory_types = device->physical->memory.default_buffer_mem_types;
|
||||
|
||||
|
@@ -17,7 +17,7 @@ static const driOptionDescription anv_dri_options[] = {
|
||||
DRI_CONF_ANV_ASSUME_FULL_SUBGROUPS(0)
|
||||
DRI_CONF_ANV_ASSUME_FULL_SUBGROUPS_WITH_BARRIER(false)
|
||||
DRI_CONF_ANV_DISABLE_FCV(false)
|
||||
DRI_CONF_ANV_DISABLE_XE2_CCS(false)
|
||||
DRI_CONF_ANV_ENABLE_BUFFER_COMP(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)
|
||||
@@ -171,8 +171,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->enable_buffer_comp =
|
||||
driQueryOptionb(&instance->dri_options, "anv_enable_buffer_comp");
|
||||
instance->external_memory_implicit_sync =
|
||||
driQueryOptionb(&instance->dri_options, "anv_external_memory_implicit_sync");
|
||||
instance->compression_control_enabled =
|
||||
|
@@ -2440,9 +2440,6 @@ 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
|
||||
|
@@ -1137,7 +1137,10 @@ struct anv_physical_device {
|
||||
uint32_t dynamic_visible_mem_types;
|
||||
/** Mask of memory types of protected buffers/images */
|
||||
uint32_t protected_mem_types;
|
||||
/** Mask of memory types of compressed buffers/images */
|
||||
/**
|
||||
* Mask of memory types of compressed buffers/images. This is generally
|
||||
* a win for images, but a loss for buffers.
|
||||
*/
|
||||
uint32_t compressed_mem_types;
|
||||
} memory;
|
||||
|
||||
@@ -1304,7 +1307,7 @@ struct anv_instance {
|
||||
unsigned force_vk_vendor;
|
||||
bool has_fake_sparse;
|
||||
bool disable_fcv;
|
||||
bool disable_xe2_ccs;
|
||||
bool enable_buffer_comp;
|
||||
bool compression_control_enabled;
|
||||
bool anv_fake_nonlocal_memory;
|
||||
bool anv_upper_bound_descriptor_pool_sampler;
|
||||
|
@@ -1201,6 +1201,10 @@ TODO: document the other workarounds.
|
||||
</application>
|
||||
<application name="Cyberpunk 2077" executable="Cyberpunk2077.exe">
|
||||
<option name="force_vk_vendor" value="-1" />
|
||||
<!--
|
||||
Cyberpunk 2077 gets a big speedup by enabling buffer compression.
|
||||
-->
|
||||
<option name="anv_enable_buffer_comp" value="true" />
|
||||
</application>
|
||||
<application name="Cyberpunk 2077" executable="Cyberpunk2077.exe">
|
||||
<!--
|
||||
@@ -1226,6 +1230,10 @@ TODO: document the other workarounds.
|
||||
</application>
|
||||
<application name="Hitman 3" executable="hitman3.exe">
|
||||
<option name="force_vk_vendor" value="-1"/>
|
||||
<!--
|
||||
Hitman 3 gets a speedup by enabling buffer compression.
|
||||
-->
|
||||
<option name="anv_enable_buffer_comp" value="true" />
|
||||
</application>
|
||||
<application name="Hogwarts Legacy" executable="HogwartsLegacy.exe">
|
||||
<option name="force_vk_vendor" value="-1" />
|
||||
@@ -1278,11 +1286,12 @@ TODO: document the other workarounds.
|
||||
<application name="Total War: WARHAMMER III" executable="TotalWarhammer3">
|
||||
<option name="anv_fake_nonlocal_memory" value="true" />
|
||||
</application>
|
||||
<!-- Source2 games seem confused by the CCS-only memory type, so
|
||||
temporarily disable CCS. More details on the issue:
|
||||
<!-- Source2 games seem confused by the CCS-only memory type being
|
||||
restricted to images, so allow it for buffers. More details on
|
||||
the issue:
|
||||
https://gitlab.freedesktop.org/mesa/mesa/-/issues/11520 -->
|
||||
<engine engine_name_match="Source2">
|
||||
<option name="anv_disable_xe2_ccs" value="true" />
|
||||
<option name="anv_enable_buffer_comp" value="true" />
|
||||
</engine>
|
||||
<!--
|
||||
Disable 16-bit feature on zink and angle so that GLES mediump doesn't
|
||||
|
@@ -827,9 +827,9 @@
|
||||
DRI_CONF_OPT_B(anv_disable_fcv, def, \
|
||||
"Disable FCV optimization")
|
||||
|
||||
#define DRI_CONF_ANV_DISABLE_XE2_CCS(def) \
|
||||
DRI_CONF_OPT_B(anv_disable_xe2_ccs, def, \
|
||||
"Disable CCS optimization on Xe2")
|
||||
#define DRI_CONF_ANV_ENABLE_BUFFER_COMP(def) \
|
||||
DRI_CONF_OPT_B(anv_enable_buffer_comp, def, \
|
||||
"Enable CCS on buffers where possible")
|
||||
|
||||
#define DRI_CONF_ANV_EXTERNAL_MEMORY_IMPLICIT_SYNC(def) \
|
||||
DRI_CONF_OPT_B(anv_external_memory_implicit_sync, def, "Implicit sync on external BOs")
|
||||
|
Reference in New Issue
Block a user