From 763fac09cb31b0d2f5d12c8fee5a64d5cc6d129e Mon Sep 17 00:00:00 2001 From: madomado Date: Tue, 11 Mar 2025 13:50:20 +0800 Subject: [PATCH] feat(mesa): patches: two commit backports for game fixes (#3825) Closes #3804 --- ...f9a972324a72dd507e09ac975b969e6c88e0.patch | 34 +++++++++++++++++ ...8799be3afe9a1e7ca9156a5d44ffe0aae681.patch | 38 +++++++++++++++++++ anda/lib/mesa/mesa.spec | 5 ++- 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 anda/lib/mesa/13a3f9a972324a72dd507e09ac975b969e6c88e0.patch create mode 100644 anda/lib/mesa/237d8799be3afe9a1e7ca9156a5d44ffe0aae681.patch diff --git a/anda/lib/mesa/13a3f9a972324a72dd507e09ac975b969e6c88e0.patch b/anda/lib/mesa/13a3f9a972324a72dd507e09ac975b969e6c88e0.patch new file mode 100644 index 0000000000..43b451f3d1 --- /dev/null +++ b/anda/lib/mesa/13a3f9a972324a72dd507e09ac975b969e6c88e0.patch @@ -0,0 +1,34 @@ +From 13a3f9a972324a72dd507e09ac975b969e6c88e0 Mon Sep 17 00:00:00 2001 +From: Hans-Kristian Arntzen +Date: Tue, 25 Feb 2025 12:43:17 +0100 +Subject: [PATCH] radv: Always set 0 dispatch offset for indirect CS. + +Fixes severe glitching in Avowed. + +Signed-off-by: Hans-Kristian Arntzen +Reviewed-by: Samuel Pitoiset +Reviewed-by: Natalie Vock +Cc: mesa-stable +Part-of: +--- + src/amd/vulkan/radv_cmd_buffer.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c +index d8c0c6810524b..d85c0659cb04e 100644 +--- a/src/amd/vulkan/radv_cmd_buffer.c ++++ b/src/amd/vulkan/radv_cmd_buffer.c +@@ -11722,6 +11722,10 @@ radv_emit_dispatch_packets(struct radv_cmd_buffer *cmd_buffer, const struct radv + dispatch_initiator |= S_00B800_USE_THREAD_DIMENSIONS(1); + } + ++ /* Indirect CS does not support offsets in the API. Must program this in case there have been ++ * preceding 1D RT dispatch or vkCmdDispatchBase. */ ++ dispatch_initiator |= S_00B800_FORCE_START_AT_000(1); ++ + if (grid_size_offset) { + if (device->load_grid_size_from_user_sgpr) { + assert(pdev->info.gfx_level >= GFX10_3); +-- +GitLab + diff --git a/anda/lib/mesa/237d8799be3afe9a1e7ca9156a5d44ffe0aae681.patch b/anda/lib/mesa/237d8799be3afe9a1e7ca9156a5d44ffe0aae681.patch new file mode 100644 index 0000000000..47151e7f03 --- /dev/null +++ b/anda/lib/mesa/237d8799be3afe9a1e7ca9156a5d44ffe0aae681.patch @@ -0,0 +1,38 @@ +From 237d8799be3afe9a1e7ca9156a5d44ffe0aae681 Mon Sep 17 00:00:00 2001 +From: Natalie Vock +Date: Fri, 28 Feb 2025 14:21:57 +0100 +Subject: [PATCH] radv/rt: Limit monolithic pipelines to 50 stages + +Beyond that, monolithic pipelines just bloat to incredible sizes, +destroying compile times for questionable, if any, runtime perf benefit. + +Indiana Jones: The Great Circle has more than 100 stages and takes +several minutes to compile its RT pipeline on Deck when using monolithic +compilation, and yet separate shaders still end up faster (probably +because instruction cache coherency in traversal is better). + +Part-of: +--- + src/amd/vulkan/radv_pipeline_rt.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c +index 0658840966c30..bcda4aae5528d 100644 +--- a/src/amd/vulkan/radv_pipeline_rt.c ++++ b/src/amd/vulkan/radv_pipeline_rt.c +@@ -602,7 +602,11 @@ radv_rt_compile_shaders(struct radv_device *device, struct vk_pipeline_cache *ca + + bool library = pipeline->base.base.create_flags & VK_PIPELINE_CREATE_2_LIBRARY_BIT_KHR; + +- bool monolithic = !library; ++ /* Beyond 50 shader stages, inlining everything bloats the shader a ton, increasing compile times and ++ * potentially even reducing runtime performance because of instruction cache coherency issues in the ++ * traversal loop. ++ */ ++ bool monolithic = !library && pipeline->stage_count < 50; + for (uint32_t i = 0; i < pCreateInfo->stageCount; i++) { + if (rt_stages[i].shader || rt_stages[i].nir) + continue; +-- +GitLab + diff --git a/anda/lib/mesa/mesa.spec b/anda/lib/mesa/mesa.spec index fb1860d1c7..0324d039f6 100644 --- a/anda/lib/mesa/mesa.spec +++ b/anda/lib/mesa/mesa.spec @@ -76,7 +76,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.0.1 -Release: 3%?dist +Release: 4%?dist License: MIT AND BSD-3-Clause AND SGI-B-2.0 URL: http://www.mesa3d.org @@ -99,6 +99,9 @@ Patch20: valve.patch # https://gitlab.freedesktop.org/mesa/mesa/-/issues/12633 Patch21: 12633.patch +Patch30: 237d8799be3afe9a1e7ca9156a5d44ffe0aae681.patch +Patch31: 13a3f9a972324a72dd507e09ac975b969e6c88e0.patch + # s390x: fix build #Patch100: https://src.fedoraproject.org/rpms/mesa/raw/e89544b7a4d811a64ca23b402add29524cc6f704/f/fix-egl-on-s390x.patch