chore: Update mesa spec files

This commit is contained in:
Kyle Gospodnetich 2023-12-07 11:58:03 -08:00
parent c8af5e29a8
commit e3c0671427
4 changed files with 1872 additions and 361 deletions

View File

@ -1,186 +0,0 @@
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index 3213577..0022246 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -289,6 +289,30 @@ dri3_update_max_num_back(struct loader_dri3_drawable *draw)
}
}
+static unsigned
+gamescope_swapchain_override()
+{
+ const char *path = getenv("GAMESCOPE_LIMITER_FILE");
+ if (!path)
+ return 0;
+
+ static simple_mtx_t mtx = SIMPLE_MTX_INITIALIZER;
+ static int fd = -1;
+
+ simple_mtx_lock(&mtx);
+ if (fd < 0) {
+ fd = open(path, O_RDONLY);
+ }
+ simple_mtx_unlock(&mtx);
+
+ if (fd < 0)
+ return 0;
+
+ uint32_t override_value = 0;
+ pread(fd, &override_value, sizeof(override_value), 0);
+ return override_value;
+}
+
void
loader_dri3_set_swap_interval(struct loader_dri3_drawable *draw, int interval)
{
@@ -303,10 +327,12 @@ loader_dri3_set_swap_interval(struct loader_dri3_drawable *draw, int interval)
* PS. changing from value A to B and A < B won't cause swap out of order but
* may still gets wrong target_msc value at the beginning.
*/
- if (draw->swap_interval != interval)
+ if (draw->orig_swap_interval != interval)
loader_dri3_swapbuffer_barrier(draw);
- draw->swap_interval = interval;
+ draw->orig_swap_interval = interval;
+ if (gamescope_swapchain_override() != 1)
+ draw->swap_interval = interval;
}
static void
@@ -435,6 +461,12 @@ loader_dri3_drawable_init(xcb_connection_t *conn,
if (!draw->adaptive_sync)
set_adaptive_sync_property(conn, draw->drawable, false);
+ draw->orig_swap_interval = draw->swap_interval;
+
+ unsigned gamescope_override = gamescope_swapchain_override();
+ if (gamescope_override == 1)
+ draw->swap_interval = 1;
+
draw->swap_interval = dri_get_initial_swap_interval(draw->dri_screen_render_gpu,
draw->ext->config);
@@ -1092,6 +1124,12 @@ loader_dri3_swap_buffers_msc(struct loader_dri3_drawable *draw,
if (draw->type == LOADER_DRI3_DRAWABLE_WINDOW) {
dri3_fence_reset(draw->conn, back);
+ unsigned gamescope_override = gamescope_swapchain_override();
+ if (gamescope_override == 1)
+ draw->swap_interval = 1;
+ else
+ draw->swap_interval = draw->orig_swap_interval;
+
/* Compute when we want the frame shown by taking the last known
* successful MSC and adding in a swap interval for each outstanding swap
* request. target_msc=divisor=remainder=0 means "Use glXSwapBuffers()
diff --git a/src/loader/meson.build b/src/loader/meson.build
index 35f9991..154cf80 100644
--- a/src/loader/meson.build
+++ b/src/loader/meson.build
@@ -29,7 +29,7 @@ if with_platform_x11 and with_dri3
dependencies : [
idep_mesautil,
dep_libdrm, dep_xcb_dri3, dep_xcb_present, dep_xcb_sync, dep_xshmfence,
- dep_xcb_xfixes,
+ dep_xcb_xfixes, dep_xcb_xrandr, idep_mesautil
],
build_by_default : false,
)
diff --git a/src/loader/loader_dri3_helper.h b/src/loader/loader_dri3_helper.h
index 1fd340b..b8f5eaa 100644
--- a/src/loader/loader_dri3_helper.h
+++ b/src/loader/loader_dri3_helper.h
@@ -178,6 +178,7 @@ struct loader_dri3_drawable {
bool block_on_depleted_buffers;
bool queries_buffer_age;
int swap_interval;
+ int orig_swap_interval;
struct loader_dri3_extensions *ext;
const struct loader_dri3_vtable *vtable;
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index a423559..5ed89cb 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -42,6 +42,7 @@
#include "util/hash_table.h"
#include "util/os_file.h"
#include "util/os_time.h"
+#include "util/simple_mtx.h"
#include "util/u_debug.h"
#include "util/u_thread.h"
#include "util/xmlconfig.h"
@@ -198,6 +199,30 @@ wsi_x11_detect_xwayland(xcb_connection_t *conn,
return is_xwayland;
}
+static unsigned
+gamescope_swapchain_override()
+{
+ const char *path = getenv("GAMESCOPE_LIMITER_FILE");
+ if (!path)
+ return 0;
+
+ static simple_mtx_t mtx = SIMPLE_MTX_INITIALIZER;
+ static int fd = -1;
+
+ simple_mtx_lock(&mtx);
+ if (fd < 0) {
+ fd = open(path, O_RDONLY);
+ }
+ simple_mtx_unlock(&mtx);
+
+ if (fd < 0)
+ return 0;
+
+ uint32_t override_value = 0;
+ pread(fd, &override_value, sizeof(override_value), 0);
+ return override_value;
+}
+
static struct wsi_x11_connection *
wsi_x11_connection_create(struct wsi_device *wsi_dev,
xcb_connection_t *conn)
@@ -1074,6 +1099,8 @@ struct x11_swapchain {
/* Total number of images returned to application in AcquireNextImage. */
uint64_t present_poll_acquire_count;
+ VkPresentModeKHR orig_present_mode;
+
struct x11_image images[0];
};
VK_DEFINE_NONDISP_HANDLE_CASTS(x11_swapchain, base.base, VkSwapchainKHR,
@@ -1802,6 +1829,12 @@ x11_queue_present(struct wsi_swapchain *anv_chain,
if (chain->status < 0)
return chain->status;
+ unsigned gamescope_override = gamescope_swapchain_override();
+ if ((gamescope_override == 1 && chain->base.present_mode != VK_PRESENT_MODE_FIFO_KHR) ||
+ (gamescope_override != 1 && chain->base.present_mode != chain->orig_present_mode)) {
+ return x11_swapchain_result(chain, VK_ERROR_OUT_OF_DATE_KHR);
+ }
+
if (damage && damage->pRectangles && damage->rectangleCount > 0 &&
damage->rectangleCount <= MAX_DAMAGE_RECTS) {
xcb_rectangle_t rects[MAX_DAMAGE_RECTS];
@@ -2554,6 +2587,10 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
xcb_void_cookie_t cookie;
VkResult result;
VkPresentModeKHR present_mode = wsi_swapchain_get_present_mode(wsi_device, pCreateInfo);
+ VkPresentModeKHR orig_present_mode = present_mode;
+
+ if (gamescope_swapchain_override() == 1)
+ present_mode = VK_PRESENT_MODE_FIFO_KHR;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR);
@@ -2666,6 +2703,7 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
chain->base.wait_for_present = x11_wait_for_present;
chain->base.release_images = x11_release_images;
chain->base.present_mode = present_mode;
+ chain->orig_present_mode = orig_present_mode;
chain->base.image_count = num_images;
chain->conn = conn;
chain->window = window;

View File

@ -6,17 +6,16 @@
%if !0%{?rhel}
%global with_nine 1
%global with_omx 1
%global with_opencl 1
%global with_opencl 0
%endif
%global base_vulkan ,amd
%endif
%global _unpackaged_files_terminate_build 0
%ifarch %{ix86} x86_64
%global with_crocus 1
%global with_i915 1
%if !0%{?rhel}
%global with_intel_clc 1
%endif
%global with_iris 1
%global with_xa 1
%global intel_platform_vulkan ,intel,intel_hasvk
@ -79,8 +78,7 @@ Source1: Mesa-MLAA-License-Clarification-Email.txt
# expected to fix the crashes reported in #2238711
Patch0: 0001-radeonsi-prefix-function-with-si_-to-prevent-name-co.patch
Patch1: valve_config.patch
Patch2: gamescope.patch
Patch1: valve.patch
BuildRequires: meson >= 1.2.0
BuildRequires: gcc
@ -139,23 +137,14 @@ BuildRequires: pkgconfig(libomxil-bellagio)
%endif
BuildRequires: pkgconfig(libelf)
BuildRequires: pkgconfig(libglvnd) >= 1.3.2
BuildRequires: llvm-devel >= 7.0.0
%if 0%{?with_opencl}
BuildRequires: clang-devel
BuildRequires: bindgen
BuildRequires: rust-packaging
BuildRequires: llvm16-devel
BuildRequires: pkgconfig(libclc)
BuildRequires: pkgconfig(SPIRV-Tools)
BuildRequires: pkgconfig(LLVMSPIRVLib)
%endif
%if %{with valgrind}
BuildRequires: pkgconfig(valgrind)
%endif
BuildRequires: python3-devel
BuildRequires: python3-mako
%if 0%{?with_intel_clc}
BuildRequires: python3-ply
%endif
BuildRequires: vulkan-headers
BuildRequires: glslang
%if 0%{?with_vulkan_hw}
@ -321,25 +310,6 @@ Requires: (%{name}-dri-drivers%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{r
%description libglapi
%{summary}.
%if 0%{?with_opencl}
%package libOpenCL
Summary: Mesa OpenCL runtime library
Requires: ocl-icd%{?_isa}
Requires: libclc%{?_isa}
Requires: %{name}-libgbm%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: opencl-filesystem
%description libOpenCL
%{summary}.
%package libOpenCL-devel
Summary: Mesa OpenCL development package
Requires: %{name}-libOpenCL%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description libOpenCL-devel
%{summary}.
%endif
%if 0%{?with_nine}
%package libd3d
Summary: Mesa Direct3D9 state tracker
@ -390,10 +360,8 @@ export RUSTFLAGS="%build_rustflags"
-Dgallium-va=%{?with_va:enabled}%{!?with_va:disabled} \
-Dgallium-xa=%{?with_xa:enabled}%{!?with_xa:disabled} \
-Dgallium-nine=%{?with_nine:true}%{!?with_nine:false} \
-Dgallium-opencl=%{?with_opencl:icd}%{!?with_opencl:disabled} \
%if 0%{?with_opencl}
-Dgallium-rusticl=true \
%endif
-Dgallium-opencl=disabled \
-Dgallium-rusticl=false \
-Dvulkan-drivers=%{?vulkan_drivers} \
-Dvulkan-layers=device-select \
-Dshared-glapi=enabled \
@ -404,9 +372,7 @@ export RUSTFLAGS="%build_rustflags"
-Dglx=dri \
-Degl=enabled \
-Dglvnd=true \
%if 0%{?with_intel_clc}
-Dintel-clc=enabled \
%endif
-Dintel-clc=disabled \
-Dmicrosoft-clc=disabled \
-Dllvm=enabled \
-Dshared-llvm=enabled \
@ -508,17 +474,6 @@ popd
%endif
%endif
%if 0%{?with_opencl}
%files libOpenCL
%{_libdir}/libMesaOpenCL.so.*
%{_libdir}/libRusticlOpenCL.so.*
%{_sysconfdir}/OpenCL/vendors/mesa.icd
%{_sysconfdir}/OpenCL/vendors/rusticl.icd
%files libOpenCL-devel
%{_libdir}/libMesaOpenCL.so
%{_libdir}/libRusticlOpenCL.so
%endif
%if 0%{?with_nine}
%files libd3d
%dir %{_libdir}/d3d/
@ -532,7 +487,9 @@ popd
%files dri-drivers
%dir %{_datadir}/drirc.d
%ifarch %{ix86} x86_64
%{_datadir}/drirc.d/00-mesa-defaults.conf
%endif
%{_libdir}/dri/kms_swrast_dri.so
%{_libdir}/dri/swrast_dri.so
%{_libdir}/dri/virtio_gpu_dri.so
@ -591,10 +548,6 @@ popd
%{_libdir}/dri/vmwgfx_dri.so
%endif
%endif
%if 0%{?with_opencl}
%dir %{_libdir}/gallium-pipe
%{_libdir}/gallium-pipe/*.so
%endif
%if 0%{?with_kmsro}
%{_libdir}/dri/armada-drm_dri.so
%{_libdir}/dri/exynos_dri.so
@ -652,9 +605,9 @@ popd
%{_datadir}/vulkan/implicit_layer.d/VkLayer_MESA_device_select.json
%if 0%{?with_vulkan_hw}
%{_libdir}/libvulkan_radeon.so
%{_datadir}/drirc.d/00-radv-defaults.conf
%{_datadir}/vulkan/icd.d/radeon_icd.*.json
%ifarch %{ix86} x86_64
%{_datadir}/drirc.d/00-radv-defaults.conf
%{_libdir}/libvulkan_intel.so
%{_datadir}/vulkan/icd.d/intel_icd.*.json
%{_libdir}/libvulkan_intel_hasvk.so

File diff suppressed because it is too large Load Diff

View File

@ -1,117 +0,0 @@
diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf
index 948c1ef..abe62c8 100644
--- a/src/util/00-mesa-defaults.conf
+++ b/src/util/00-mesa-defaults.conf
@@ -166,6 +166,12 @@ TODO: document the other workarounds.
<option name="disable_uniform_array_resize" value="true" />
</application>
+ <application name="The Chronicles of Riddick: Assault on Dark Athena" executable="DarkAthena.exe">
+ <option name="disable_uniform_array_resize" value="true" />
+ <option name="alias_shader_extension" value="GL_ATI_shader_texture_lod:GL_ARB_shader_texture_lod" />
+ <option name="allow_vertex_texture_bias" value="true" />
+ </application>
+
<application name="Dying Light" executable="DyingLightGame">
<option name="allow_glsl_builtin_variable_redeclaration" value="true" />
</application>
@@ -364,6 +370,11 @@ TODO: document the other workarounds.
<option name="lower_depth_range_rate" value="0.8" />
</application>
+ <application name="The Spirit and The Mouse" executable="TheSpiritAndTheMouse.exe">
+ <!-- https://gitlab.freedesktop.org/mesa/mesa/-/issues/9738 -->
+ <option name="lower_depth_range_rate" value="0.8" />
+ </application>
+
<application name="Penumbra: Overture" executable="Penumbra.exe">
<!-- https://gitlab.freedesktop.org/mesa/mesa/-/issues/8425 -->
<option name="allow_multisampled_copyteximage" value="true" />
@@ -718,6 +729,7 @@ TODO: document the other workarounds.
<application name="gnome-shell" executable="gnome-shell">
<option name="adaptive_sync" value="false" />
<option name="v3d_nonmsaa_texture_size_limit" value="true" />
+ <option name="mesa_glthread" value="false"/>
</application>
<application name="Desktop — Plasma" executable="plasmashell">
<option name="adaptive_sync" value="false" />
@@ -923,6 +935,39 @@ TODO: document the other workarounds.
<option name="vk_x11_override_min_image_count" value="3" />
</application>
+ <!-- Disable fp16 support for browsers, since there is too much
+ broken WebGL out there that uses the wrong precision.
+ Bonus workaround for Firefox bug #1845309. -->
+ <application name="Firefox" executable="firefox">
+ <option name="no_fp16" value="true" />
+ </application>
+ <application name="Firefox ESR" executable="firefox-esr">
+ <option name="no_fp16" value="true" />
+ </application>
+ <application name="Chromium" executable="chromium">
+ <option name="no_fp16" value="true" />
+ </application>
+ <application name="Google Chrome" executable="chrome">
+ <option name="no_fp16" value="true" />
+ </application>
+ <application name="Iceweasel" executable="iceweasel">
+ <option name="no_fp16" value="true" />
+ </application>
+ <application name="Epiphany" executable="epiphany">
+ <option name="no_fp16" value="true" />
+ </application>
+ <application name="Konqueror" executable="konqueror">
+ <option name="no_fp16" value="true" />
+ </application>
+ <application name="Falkon" executable="falkon">
+ <option name="no_fp16" value="true" />
+ </application>
+ <application name="Seamonkey" executable="seamonkey">
+ <option name="no_fp16" value="true" />
+ </application>
+ <application name="Waterfox" executable="waterfox">
+ <option name="no_fp16" value="true" />
+ </application>
</device>
<!-- vmwgfx doesn't like full buffer swaps and can't sync to vertical retraces.-->
<device driver="vmwgfx">
@@ -1104,6 +1149,25 @@ TODO: document the other workarounds.
<application name="Cyberpunk 2077" executable="Cyberpunk2077.exe">
<option name="force_vk_vendor" value="-1" />
</application>
+ <application name="Cyberpunk 2077" executable="Cyberpunk2077.exe">
+ <!--
+ Cyberpunk 2077 uses a watchdog thread to terminate
+ the process in case the render thread hasn't responded within 2 minutes.
+ This option speeds up shader compilation.
+ See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9241
+ -->
+ <option name="shader_spilling_rate" value="15" />
+ </application>
+ <application name="Elden Ring" executable="eldenring.exe">
+ <option name="fake_sparse" value="true" />
+ </application>
+ <!-- Needed to avoid XeSS code paths. -->
+ <application name="Marvel's Spider-Man Remastered" executable="Spider-Man.exe">
+ <option name="force_vk_vendor" value="-1" />
+ </application>
+ <application name="Hogwarts Legacy" executable="HogwartsLegacy.exe">
+ <option name="force_vk_vendor" value="-1" />
+ </application>
<!--
Disable 16-bit feature on zink and angle so that GLES mediump doesn't
lower to our inefficent 16-bit shader support. No need to do so for
diff --git a/src/util/00-radv-defaults.conf b/src/util/00-radv-defaults.conf
index 9434dba..3c3ae56 100644
--- a/src/util/00-radv-defaults.conf
+++ b/src/util/00-radv-defaults.conf
@@ -186,5 +186,9 @@ Application bugs worked around in this file:
<application name="Rocket League" executable="RocketLeague">
<option name="radv_zero_vram" value="true" />
</application>
+
+ <application name="Forza Horizon 5" application_name_match="ForzaHorizon5.exe">
+ <option name="vk_x11_override_min_image_count" value="4" />
+ </application>
</device>
</driconf>