From 17612503f5fab8d61e9ededaa56992f0c50d6f07 Mon Sep 17 00:00:00 2001 From: Kyle Gospodnetich Date: Tue, 13 May 2025 01:22:03 -0700 Subject: [PATCH] fix: Add extra patch for DOOM: The Dark Ages (Temporary, this is a backport) (#4805) --- anda/lib/mesa/mesa.spec | 5 ++- anda/lib/mesa/sparse.patch | 84 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 anda/lib/mesa/sparse.patch diff --git a/anda/lib/mesa/mesa.spec b/anda/lib/mesa/mesa.spec index f46a08c4a5..d666ac2fa1 100644 --- a/anda/lib/mesa/mesa.spec +++ b/anda/lib/mesa/mesa.spec @@ -80,7 +80,7 @@ Summary: Mesa graphics libraries # disabled by default, and has to be enabled manually. See `terra/release/terra-mesa.repo` for details. Epoch: 1 Version: 25.1.0 -Release: 1%?dist +Release: 2%?dist License: MIT AND BSD-3-Clause AND SGI-B-2.0 URL: http://www.mesa3d.org @@ -92,6 +92,9 @@ Source1: Mesa-MLAA-License-Clarification-Email.txt Patch10: gnome-shell-glthread-disable.patch +# Backport for DOOM: The Dark Ages +Patch15: sparse.patch + # https://github.com/bazzite-org/mesa Patch20: bazzite.patch diff --git a/anda/lib/mesa/sparse.patch b/anda/lib/mesa/sparse.patch new file mode 100644 index 0000000000..209b7db9e7 --- /dev/null +++ b/anda/lib/mesa/sparse.patch @@ -0,0 +1,84 @@ +From 8119f91113b775afe34cdf980550425639bab7cd Mon Sep 17 00:00:00 2001 +From: Natalie Vock +Date: Sat, 10 May 2025 14:37:13 +0200 +Subject: [PATCH] radv,driconf: Add radv_force_64k_sparse_alignment config + +Needed by DOOM: The Dark Ages. +--- + src/amd/vulkan/radv_buffer.c | 6 +++++- + src/amd/vulkan/radv_instance.c | 3 +++ + src/amd/vulkan/radv_instance.h | 1 + + src/util/driconf.h | 3 +++ + 4 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/amd/vulkan/radv_buffer.c b/src/amd/vulkan/radv_buffer.c +index 88111750517..8ef575f8246 100644 +--- a/src/amd/vulkan/radv_buffer.c ++++ b/src/amd/vulkan/radv_buffer.c +@@ -167,6 +167,7 @@ radv_get_buffer_memory_requirements(struct radv_device *device, VkDeviceSize siz + VkBufferUsageFlags2 usage, VkMemoryRequirements2 *pMemoryRequirements) + { + const struct radv_physical_device *pdev = radv_device_physical(device); ++ const struct radv_instance *instance = radv_physical_device_instance(pdev); + + pMemoryRequirements->memoryRequirements.memoryTypeBits = + ((1u << pdev->memory_properties.memoryTypeCount) - 1u) & ~pdev->memory_types_32bit; +@@ -179,7 +180,10 @@ radv_get_buffer_memory_requirements(struct radv_device *device, VkDeviceSize siz + pMemoryRequirements->memoryRequirements.memoryTypeBits = pdev->memory_types_32bit; + + if (flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) { +- pMemoryRequirements->memoryRequirements.alignment = 4096; ++ if (instance->drirc.force_64k_sparse_alignment) ++ pMemoryRequirements->memoryRequirements.alignment = 65536; ++ else ++ pMemoryRequirements->memoryRequirements.alignment = 4096; + } else { + if (usage & VK_BUFFER_USAGE_2_PREPROCESS_BUFFER_BIT_EXT) + pMemoryRequirements->memoryRequirements.alignment = radv_dgc_get_buffer_alignment(device); +diff --git a/src/amd/vulkan/radv_instance.c b/src/amd/vulkan/radv_instance.c +index 4946a5aebd0..d173b1b6c1c 100644 +--- a/src/amd/vulkan/radv_instance.c ++++ b/src/amd/vulkan/radv_instance.c +@@ -195,6 +195,7 @@ static const driOptionDescription radv_dri_options[] = { + DRI_CONF_RADV_APP_LAYER() + DRI_CONF_RADV_EMULATE_RT(false) + DRI_CONF_RADV_ENABLE_FLOAT16_GFX8(false) ++ DRI_CONF_RADV_FORCE_64K_SPARSE_ALIGNMENT(false) + DRI_CONF_SECTION_END + }; + // clang-format on +@@ -296,6 +297,8 @@ radv_init_dri_options(struct radv_instance *instance) + instance->drirc.lower_terminate_to_discard = + driQueryOptionb(&instance->drirc.options, "radv_lower_terminate_to_discard"); + ++ instance->drirc.force_64k_sparse_alignment = driQueryOptionb(&instance->drirc.options, "radv_force_64k_sparse_alignment"); ++ + instance->drirc.emulate_rt = driQueryOptionb(&instance->drirc.options, "radv_emulate_rt"); + + instance->drirc.expose_float16_gfx8 = driQueryOptionb(&instance->drirc.options, "radv_enable_float16_gfx8"); +diff --git a/src/amd/vulkan/radv_instance.h b/src/amd/vulkan/radv_instance.h +index d0f23404285..81c4921222e 100644 +--- a/src/amd/vulkan/radv_instance.h ++++ b/src/amd/vulkan/radv_instance.h +@@ -74,6 +74,7 @@ struct radv_instance { + bool lower_terminate_to_discard; + bool emulate_rt; + bool expose_float16_gfx8; ++ bool force_64k_sparse_alignment; + char *app_layer; + uint8_t override_graphics_shader_version; + uint8_t override_compute_shader_version; +diff --git a/src/util/driconf.h b/src/util/driconf.h +index 3f94b28aee7..66515010ca5 100644 +--- a/src/util/driconf.h ++++ b/src/util/driconf.h +@@ -808,6 +808,9 @@ + DRI_CONF_OPT_B(radv_disable_dedicated_sparse_queue, def, \ + "Disables the dedicated sparse queue. This replaces radv_legacy_sparse_binding as a compatible drirc workaround for games that might not expect a separate SPARSE queue") + ++#define DRI_CONF_RADV_FORCE_64K_SPARSE_ALIGNMENT(def) \ ++ DRI_CONF_OPT_B(radv_force_64k_sparse_alignment, def, \ ++ "Force the alignment of sparse buffers to 64KiB") + /** + * Overrides for forcing re-compilation of pipelines when RADV_BUILD_ID_OVERRIDE is enabled. + * These need to be bumped every time a compiler bugfix is backported (up to 8 shader