chore: Update to Mesa 23.3.0 (Patches from Nobara <3)

This commit is contained in:
Kyle Gospodnetich 2023-12-08 12:55:29 -08:00
parent f9dd379ace
commit e4db1fff07
8 changed files with 3477 additions and 1097 deletions

View File

@ -0,0 +1,39 @@
From a89bf9e86a83005befcdcef47a94fff167bdc47b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= <jexposit@redhat.com>
Date: Wed, 22 Nov 2023 12:48:47 +0100
Subject: [PATCH] zink: initialize drm_fd to -1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The `zink_internal_create_screen()` function initializes
`screen->drm_fd` to 0, a valid file descriptor value, via `rzalloc`.
If an error is found during initialization, the `zink_destroy_screen()`
function is invoked in the `fail` label and the `screen->drm_fd` is
closed because its value is 0 and `screen->drm_fd != -1` is checked.
Initialize `screen->drm_fd` to -1 to avoid this issue.
Resolves: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10191
Signed-off-by: José Expósito <jexposit@redhat.com>
---
src/gallium/drivers/zink/zink_screen.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index 50168d8daa1..f42f340657b 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -3126,6 +3126,8 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev
return NULL;
}
+ screen->drm_fd = -1;
+
glsl_type_singleton_init_or_ref();
zink_debug = debug_get_option_zink_debug();
if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_AUTO)
--
2.42.0

1666
spec_files/mesa/25352.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,75 +0,0 @@
From 9590bce3e249a34665b2c42b20bfdbdc7f32147f Mon Sep 17 00:00:00 2001
From: WinLinux1028 <reimu@hakurei.win>
Date: Tue, 11 Jul 2023 18:16:01 +0900
Subject: [PATCH] radeonsi: prefix function with si_ to prevent name collision
Fixed a build error caused by multiple gfx11_init_query symbols when building with iris and radeonsi specified in gallium-drivers.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9238
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24045>
---
src/gallium/drivers/radeonsi/gfx11_query.c | 4 ++--
src/gallium/drivers/radeonsi/si_pipe.c | 4 ++--
src/gallium/drivers/radeonsi/si_pipe.h | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/gfx11_query.c b/src/gallium/drivers/radeonsi/gfx11_query.c
index bfcd8e25110..2a331cc3bda 100644
--- a/src/gallium/drivers/radeonsi/gfx11_query.c
+++ b/src/gallium/drivers/radeonsi/gfx11_query.c
@@ -422,13 +422,13 @@ struct pipe_query *gfx11_sh_query_create(struct si_screen *screen, enum pipe_que
return (struct pipe_query *)query;
}
-void gfx11_init_query(struct si_context *sctx)
+void si_gfx11_init_query(struct si_context *sctx)
{
list_inithead(&sctx->shader_query_buffers);
sctx->atoms.s.shader_query.emit = emit_shader_query;
}
-void gfx11_destroy_query(struct si_context *sctx)
+void si_gfx11_destroy_query(struct si_context *sctx)
{
if (!sctx->shader_query_buffers.next)
return;
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index fb5c02c473b..2b4fceb89b1 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -192,7 +192,7 @@ static void si_destroy_context(struct pipe_context *context)
si_release_all_descriptors(sctx);
if (sctx->gfx_level >= GFX10 && sctx->has_graphics)
- gfx11_destroy_query(sctx);
+ si_gfx11_destroy_query(sctx);
if (sctx->sqtt) {
struct si_screen *sscreen = sctx->screen;
@@ -637,7 +637,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
/* Initialize graphics-only context functions. */
if (sctx->has_graphics) {
if (sctx->gfx_level >= GFX10)
- gfx11_init_query(sctx);
+ si_gfx11_init_query(sctx);
si_init_msaa_functions(sctx);
si_init_shader_functions(sctx);
si_init_state_functions(sctx);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 55f1d1788f1..389716854f9 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -1616,8 +1616,8 @@ void *si_create_query_result_cs(struct si_context *sctx);
void *gfx11_create_sh_query_result_cs(struct si_context *sctx);
/* gfx11_query.c */
-void gfx11_init_query(struct si_context *sctx);
-void gfx11_destroy_query(struct si_context *sctx);
+void si_gfx11_init_query(struct si_context *sctx);
+void si_gfx11_destroy_query(struct si_context *sctx);
/* si_test_image_copy_region.c */
void si_test_image_copy_region(struct si_screen *sscreen);
--
2.41.0

View File

@ -1,627 +0,0 @@
%ifnarch s390x
%global with_hardware 1
%global with_vulkan_hw 1
%global with_vdpau 1
%global with_va 1
%if !0%{?rhel}
%global with_nine 1
%global with_omx 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
%global with_iris 1
%global with_xa 1
%global intel_platform_vulkan ,intel,intel_hasvk
%endif
%ifarch aarch64 x86_64 %{ix86}
%if !0%{?rhel}
%global with_lima 1
%global with_vc4 1
%endif
%global with_etnaviv 1
%global with_freedreno 1
%global with_kmsro 1
%global with_panfrost 1
%global with_tegra 1
%global with_v3d 1
%global with_xa 1
%global extra_platform_vulkan ,broadcom,freedreno,panfrost
%endif
%ifnarch s390x
%if !0%{?rhel}
%global with_r300 1
%global with_r600 1
%endif
%global with_radeonsi 1
%global with_vmware 1
%endif
%if !0%{?rhel}
%global with_libunwind 1
%global with_lmsensors 1
%endif
%ifarch %{valgrind_arches}
%bcond_without valgrind
%else
%bcond_with valgrind
%endif
%global vulkan_drivers swrast%{?base_vulkan}%{?intel_platform_vulkan}%{?extra_platform_vulkan}
Name: mesa
Summary: Mesa graphics libraries
%global ver 23.2.1
Version: %{lua:ver = string.gsub(rpm.expand("%{ver}"), "-", "~"); print(ver)}
Release: %autorelease.bazzite.{{{ git_dir_version }}}
License: MIT AND BSD-3-Clause AND SGI-B-2.0
URL: http://www.mesa3d.org
Source0: https://archive.mesa3d.org/mesa-%{ver}.tar.xz
# src/gallium/auxiliary/postprocess/pp_mlaa* have an ... interestingly worded license.
# Source1 contains email correspondence clarifying the license terms.
# Fedora opts to ignore the optional part of clause 2 and treat that code as 2 clause BSD.
Source1: Mesa-MLAA-License-Clarification-Email.txt
# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24045
# https://bugzilla.redhat.com/show_bug.cgi?id=2238711
# fixes a symbol name collision between iris and radeonsi drivers
# expected to fix the crashes reported in #2238711
Patch0: 0001-radeonsi-prefix-function-with-si_-to-prevent-name-co.patch
Patch1: valve.patch
BuildRequires: meson >= 1.2.0
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: gettext
%if 0%{?with_hardware}
BuildRequires: kernel-headers
%endif
# We only check for the minimum version of pkgconfig(libdrm) needed so that the
# SRPMs for each arch still have the same build dependencies. See:
# https://bugzilla.redhat.com/show_bug.cgi?id=1859515
BuildRequires: pkgconfig(libdrm) >= 2.4.97
%if 0%{?with_libunwind}
BuildRequires: pkgconfig(libunwind)
%endif
BuildRequires: pkgconfig(expat)
BuildRequires: pkgconfig(zlib) >= 1.2.3
BuildRequires: pkgconfig(libzstd)
BuildRequires: pkgconfig(libselinux)
BuildRequires: pkgconfig(wayland-scanner)
BuildRequires: pkgconfig(wayland-protocols) >= 1.8
BuildRequires: pkgconfig(wayland-client) >= 1.11
BuildRequires: pkgconfig(wayland-server) >= 1.11
BuildRequires: pkgconfig(wayland-egl-backend) >= 3
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xext)
BuildRequires: pkgconfig(xdamage) >= 1.1
BuildRequires: pkgconfig(xfixes)
BuildRequires: pkgconfig(xcb-glx) >= 1.8.1
BuildRequires: pkgconfig(xxf86vm)
BuildRequires: pkgconfig(xcb)
BuildRequires: pkgconfig(x11-xcb)
BuildRequires: pkgconfig(xcb-dri2) >= 1.8
BuildRequires: pkgconfig(xcb-dri3)
BuildRequires: pkgconfig(xcb-present)
BuildRequires: pkgconfig(xcb-sync)
BuildRequires: pkgconfig(xshmfence) >= 1.1
BuildRequires: pkgconfig(dri2proto) >= 2.8
BuildRequires: pkgconfig(glproto) >= 1.4.14
BuildRequires: pkgconfig(xcb-xfixes)
BuildRequires: pkgconfig(xcb-randr)
BuildRequires: pkgconfig(xrandr) >= 1.3
BuildRequires: bison
BuildRequires: flex
%if 0%{?with_lmsensors}
BuildRequires: lm_sensors-devel
%endif
%if 0%{?with_vdpau}
BuildRequires: pkgconfig(vdpau) >= 1.1
%endif
%if 0%{?with_va}
BuildRequires: pkgconfig(libva) >= 0.38.0
%endif
%if 0%{?with_omx}
BuildRequires: pkgconfig(libomxil-bellagio)
%endif
BuildRequires: pkgconfig(libelf)
BuildRequires: pkgconfig(libglvnd) >= 1.3.2
BuildRequires: llvm16-devel
BuildRequires: pkgconfig(libclc)
BuildRequires: pkgconfig(SPIRV-Tools)
%if %{with valgrind}
BuildRequires: pkgconfig(valgrind)
%endif
BuildRequires: python3-devel
BuildRequires: python3-mako
BuildRequires: vulkan-headers
BuildRequires: glslang
%if 0%{?with_vulkan_hw}
BuildRequires: pkgconfig(vulkan)
%endif
%description
%{summary}.
%package filesystem
Summary: Mesa driver filesystem
Provides: mesa-dri-filesystem = %{?epoch:%{epoch}:}%{version}-%{release}
%description filesystem
%{summary}.
%package libGL
Summary: Mesa libGL runtime libraries
Requires: %{name}-libglapi%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: libglvnd-glx%{?_isa} >= 1:1.3.2
Recommends: %{name}-dri-drivers%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description libGL
%{summary}.
%package libGL-devel
Summary: Mesa libGL development package
Requires: %{name}-libGL%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: libglvnd-devel%{?_isa} >= 1:1.3.2
Provides: libGL-devel
Provides: libGL-devel%{?_isa}
Recommends: gl-manpages
%description libGL-devel
%{summary}.
%package libEGL
Summary: Mesa libEGL runtime libraries
Requires: libglvnd-egl%{?_isa} >= 1:1.3.2
Requires: %{name}-libgbm%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: %{name}-libglapi%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Recommends: %{name}-dri-drivers%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description libEGL
%{summary}.
%package libEGL-devel
Summary: Mesa libEGL development package
Requires: %{name}-libEGL%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: libglvnd-devel%{?_isa} >= 1:1.3.2
Requires: %{name}-khr-devel%{?_isa}
Provides: libEGL-devel
Provides: libEGL-devel%{?_isa}
%description libEGL-devel
%{summary}.
%package dri-drivers
Summary: Mesa-based DRI drivers
Requires: %{name}-filesystem%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: %{name}-libglapi%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%if 0%{?with_va}
Recommends: %{name}-va-drivers%{?_isa}
%endif
%description dri-drivers
%{summary}.
%if 0%{?with_omx}
%package omx-drivers
Summary: Mesa-based OMX drivers
Requires: %{name}-filesystem%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description omx-drivers
%{summary}.
%endif
%if 0%{?with_va}
%package va-drivers
Summary: Mesa-based VA-API video acceleration drivers
Requires: %{name}-filesystem%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Obsoletes: %{name}-vaapi-drivers < 22.2.0-5
%description va-drivers
%{summary}.
%endif
%if 0%{?with_vdpau}
%package vdpau-drivers
Summary: Mesa-based VDPAU drivers
Requires: %{name}-filesystem%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description vdpau-drivers
%{summary}.
%endif
%package libOSMesa
Summary: Mesa offscreen rendering libraries
Requires: %{name}-libglapi%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: libOSMesa
Provides: libOSMesa%{?_isa}
%description libOSMesa
%{summary}.
%package libOSMesa-devel
Summary: Mesa offscreen rendering development package
Requires: %{name}-libOSMesa%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description libOSMesa-devel
%{summary}.
%package libgbm
Summary: Mesa gbm runtime library
Provides: libgbm
Provides: libgbm%{?_isa}
Recommends: %{name}-dri-drivers%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
# If mesa-dri-drivers are installed, they must match in version. This is here to prevent using
# older mesa-dri-drivers together with a newer mesa-libgbm and its dependants.
# See https://bugzilla.redhat.com/show_bug.cgi?id=2193135 .
Requires: (%{name}-dri-drivers%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} if %{name}-dri-drivers%{?_isa})
%description libgbm
%{summary}.
%package libgbm-devel
Summary: Mesa libgbm development package
Requires: %{name}-libgbm%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: libgbm-devel
Provides: libgbm-devel%{?_isa}
%description libgbm-devel
%{summary}.
%if 0%{?with_xa}
%package libxatracker
Summary: Mesa XA state tracker
Provides: libxatracker
Provides: libxatracker%{?_isa}
%description libxatracker
%{summary}.
%package libxatracker-devel
Summary: Mesa XA state tracker development package
Requires: %{name}-libxatracker%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: libxatracker-devel
Provides: libxatracker-devel%{?_isa}
%description libxatracker-devel
%{summary}.
%endif
%package libglapi
Summary: Mesa shared glapi
Provides: libglapi
Provides: libglapi%{?_isa}
# If mesa-dri-drivers are installed, they must match in version. This is here to prevent using
# older mesa-dri-drivers together with a newer mesa-libglapi or its dependants.
# See https://bugzilla.redhat.com/show_bug.cgi?id=2193135 .
Requires: (%{name}-dri-drivers%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} if %{name}-dri-drivers%{?_isa})
%description libglapi
%{summary}.
%if 0%{?with_nine}
%package libd3d
Summary: Mesa Direct3D9 state tracker
%description libd3d
%{summary}.
%package libd3d-devel
Summary: Mesa Direct3D9 state tracker development package
Requires: %{name}-libd3d%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description libd3d-devel
%{summary}.
%endif
%package vulkan-drivers
Summary: Mesa Vulkan drivers
Requires: vulkan%{_isa}
Obsoletes: mesa-vulkan-devel < %{?epoch:%{epoch}:}%{version}-%{release}
%description vulkan-drivers
The drivers with support for the Vulkan API.
%prep
%autosetup -n %{name}-%{ver} -p1
cp %{SOURCE1} docs/
%build
# ensure standard Rust compiler flags are set
export RUSTFLAGS="%build_rustflags"
# We've gotten a report that enabling LTO for mesa breaks some games. See
# https://bugzilla.redhat.com/show_bug.cgi?id=1862771 for details.
# Disable LTO for now
%define _lto_cflags %{nil}
%meson \
-Dplatforms=x11,wayland \
-Ddri3=enabled \
-Dosmesa=true \
%if 0%{?with_hardware}
-Dgallium-drivers=swrast,virgl,nouveau%{?with_r300:,r300}%{?with_crocus:,crocus}%{?with_i915:,i915}%{?with_iris:,iris}%{?with_vmware:,svga}%{?with_radeonsi:,radeonsi}%{?with_r600:,r600}%{?with_freedreno:,freedreno}%{?with_etnaviv:,etnaviv}%{?with_tegra:,tegra}%{?with_vc4:,vc4}%{?with_v3d:,v3d}%{?with_kmsro:,kmsro}%{?with_lima:,lima}%{?with_panfrost:,panfrost}%{?with_vulkan_hw:,zink} \
%else
-Dgallium-drivers=swrast,virgl \
%endif
-Dgallium-vdpau=%{?with_vdpau:enabled}%{!?with_vdpau:disabled} \
-Dgallium-omx=%{?with_omx:bellagio}%{!?with_omx:disabled} \
-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=disabled \
-Dgallium-rusticl=false \
-Dvulkan-drivers=%{?vulkan_drivers} \
-Dvulkan-layers=device-select \
-Dshared-glapi=enabled \
-Dgles1=enabled \
-Dgles2=enabled \
-Dopengl=true \
-Dgbm=enabled \
-Dglx=dri \
-Degl=enabled \
-Dglvnd=true \
-Dintel-clc=disabled \
-Dmicrosoft-clc=disabled \
-Dllvm=enabled \
-Dshared-llvm=enabled \
-Dvalgrind=%{?with_valgrind:enabled}%{!?with_valgrind:disabled} \
-Dbuild-tests=false \
-Dselinux=true \
%if !0%{?with_libunwind}
-Dlibunwind=disabled \
%endif
%if !0%{?with_lmsensors}
-Dlmsensors=disabled \
%endif
-Dandroid-libbacktrace=disabled \
%{nil}
%meson_build
%install
%meson_install
# libvdpau opens the versioned name, don't bother including the unversioned
rm -vf %{buildroot}%{_libdir}/vdpau/*.so
# likewise glvnd
rm -vf %{buildroot}%{_libdir}/libGLX_mesa.so
rm -vf %{buildroot}%{_libdir}/libEGL_mesa.so
# XXX can we just not build this
rm -vf %{buildroot}%{_libdir}/libGLES*
# glvnd needs a default provider for indirect rendering where it cannot
# determine the vendor
ln -s %{_libdir}/libGLX_mesa.so.0 %{buildroot}%{_libdir}/libGLX_system.so.0
# this keeps breaking, check it early. note that the exit from eu-ftr is odd.
pushd %{buildroot}%{_libdir}
for i in libOSMesa*.so libGL.so ; do
eu-findtextrel $i && exit 1
done
popd
%files filesystem
%doc docs/Mesa-MLAA-License-Clarification-Email.txt
%dir %{_libdir}/dri
%if 0%{?with_hardware}
%if 0%{?with_vdpau}
%dir %{_libdir}/vdpau
%endif
%endif
%files libGL
%{_libdir}/libGLX_mesa.so.0*
%{_libdir}/libGLX_system.so.0*
%files libGL-devel
%dir %{_includedir}/GL/internal
%{_includedir}/GL/internal/dri_interface.h
%{_libdir}/pkgconfig/dri.pc
%{_libdir}/libglapi.so
%files libEGL
%{_datadir}/glvnd/egl_vendor.d/50_mesa.json
%{_libdir}/libEGL_mesa.so.0*
%files libEGL-devel
%dir %{_includedir}/EGL
%{_includedir}/EGL/eglext_angle.h
%{_includedir}/EGL/eglmesaext.h
%files libglapi
%{_libdir}/libglapi.so.0
%{_libdir}/libglapi.so.0.*
%files libOSMesa
%{_libdir}/libOSMesa.so.8*
%files libOSMesa-devel
%dir %{_includedir}/GL
%{_includedir}/GL/osmesa.h
%{_libdir}/libOSMesa.so
%{_libdir}/pkgconfig/osmesa.pc
%files libgbm
%{_libdir}/libgbm.so.1
%{_libdir}/libgbm.so.1.*
%files libgbm-devel
%{_libdir}/libgbm.so
%{_includedir}/gbm.h
%{_libdir}/pkgconfig/gbm.pc
%if 0%{?with_xa}
%files libxatracker
%if 0%{?with_hardware}
%{_libdir}/libxatracker.so.2
%{_libdir}/libxatracker.so.2.*
%endif
%files libxatracker-devel
%if 0%{?with_hardware}
%{_libdir}/libxatracker.so
%{_includedir}/xa_tracker.h
%{_includedir}/xa_composite.h
%{_includedir}/xa_context.h
%{_libdir}/pkgconfig/xatracker.pc
%endif
%endif
%if 0%{?with_nine}
%files libd3d
%dir %{_libdir}/d3d/
%{_libdir}/d3d/*.so.*
%files libd3d-devel
%{_libdir}/pkgconfig/d3d.pc
%{_includedir}/d3dadapter/
%{_libdir}/d3d/*.so
%endif
%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
%if 0%{?with_hardware}
%if 0%{?with_r300}
%{_libdir}/dri/r300_dri.so
%endif
%if 0%{?with_radeonsi}
%if 0%{?with_r600}
%{_libdir}/dri/r600_dri.so
%endif
%{_libdir}/dri/radeonsi_dri.so
%endif
%ifarch %{ix86} x86_64
%{_libdir}/dri/crocus_dri.so
%{_libdir}/dri/i915_dri.so
%{_libdir}/dri/iris_dri.so
%endif
%ifarch aarch64 x86_64 %{ix86}
%{_libdir}/dri/ingenic-drm_dri.so
%{_libdir}/dri/imx-drm_dri.so
%{_libdir}/dri/imx-lcdif_dri.so
%{_libdir}/dri/kirin_dri.so
%{_libdir}/dri/komeda_dri.so
%{_libdir}/dri/mali-dp_dri.so
%{_libdir}/dri/mcde_dri.so
%{_libdir}/dri/mxsfb-drm_dri.so
%{_libdir}/dri/rcar-du_dri.so
%{_libdir}/dri/stm_dri.so
%endif
%if 0%{?with_vc4}
%{_libdir}/dri/vc4_dri.so
%endif
%if 0%{?with_v3d}
%{_libdir}/dri/v3d_dri.so
%endif
%if 0%{?with_freedreno}
%{_libdir}/dri/kgsl_dri.so
%{_libdir}/dri/msm_dri.so
%endif
%if 0%{?with_etnaviv}
%{_libdir}/dri/etnaviv_dri.so
%endif
%if 0%{?with_tegra}
%{_libdir}/dri/tegra_dri.so
%endif
%if 0%{?with_lima}
%{_libdir}/dri/lima_dri.so
%endif
%if 0%{?with_panfrost}
%{_libdir}/dri/panfrost_dri.so
%endif
%{_libdir}/dri/nouveau_dri.so
%if 0%{?with_vmware}
%{_libdir}/dri/vmwgfx_dri.so
%endif
%endif
%if 0%{?with_kmsro}
%{_libdir}/dri/armada-drm_dri.so
%{_libdir}/dri/exynos_dri.so
%{_libdir}/dri/hx8357d_dri.so
%{_libdir}/dri/ili9225_dri.so
%{_libdir}/dri/ili9341_dri.so
%{_libdir}/dri/imx-dcss_dri.so
%{_libdir}/dri/mediatek_dri.so
%{_libdir}/dri/meson_dri.so
%{_libdir}/dri/mi0283qt_dri.so
%{_libdir}/dri/pl111_dri.so
%{_libdir}/dri/repaper_dri.so
%{_libdir}/dri/rockchip_dri.so
%{_libdir}/dri/st7586_dri.so
%{_libdir}/dri/st7735r_dri.so
%{_libdir}/dri/sun4i-drm_dri.so
%endif
%if 0%{?with_vulkan_hw}
%{_libdir}/dri/zink_dri.so
%endif
%if 0%{?with_omx}
%files omx-drivers
%{_libdir}/bellagio/libomx_mesa.so
%endif
%if 0%{?with_va}
%files va-drivers
%{_libdir}/dri/nouveau_drv_video.so
%if 0%{?with_r600}
%{_libdir}/dri/r600_drv_video.so
%endif
%if 0%{?with_radeonsi}
%{_libdir}/dri/radeonsi_drv_video.so
%endif
%{_libdir}/dri/virtio_gpu_drv_video.so
%endif
%if 0%{?with_vdpau}
%files vdpau-drivers
%{_libdir}/vdpau/libvdpau_nouveau.so.1*
%if 0%{?with_r600}
%{_libdir}/vdpau/libvdpau_r600.so.1*
%endif
%if 0%{?with_radeonsi}
%{_libdir}/vdpau/libvdpau_radeonsi.so.1*
%endif
%{_libdir}/vdpau/libvdpau_virtio_gpu.so.1*
%endif
%files vulkan-drivers
%{_libdir}/libvulkan_lvp.so
%{_datadir}/vulkan/icd.d/lvp_icd.*.json
%{_libdir}/libVkLayer_MESA_device_select.so
%{_datadir}/vulkan/implicit_layer.d/VkLayer_MESA_device_select.json
%if 0%{?with_vulkan_hw}
%{_libdir}/libvulkan_radeon.so
%{_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
%{_datadir}/vulkan/icd.d/intel_hasvk_icd.*.json
%endif
%ifarch aarch64 x86_64 %{ix86}
%{_libdir}/libvulkan_broadcom.so
%{_datadir}/vulkan/icd.d/broadcom_icd.*.json
%{_libdir}/libvulkan_freedreno.so
%{_datadir}/vulkan/icd.d/freedreno_icd.*.json
%{_libdir}/libvulkan_panfrost.so
%{_datadir}/vulkan/icd.d/panfrost_icd.*.json
%endif
%endif
%changelog
%autochangelog

View File

@ -0,0 +1,11 @@
diff -up mesa-22.3.0-rc4/src/util/00-mesa-defaults.conf.dma mesa-22.3.0-rc4/src/util/00-mesa-defaults.conf
--- mesa-22.3.0-rc4/src/util/00-mesa-defaults.conf.dma 2022-11-25 10:32:32.175879868 +1000
+++ mesa-22.3.0-rc4/src/util/00-mesa-defaults.conf 2022-11-25 10:32:43.743067470 +1000
@@ -653,6 +653,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" />

1737
spec_files/mesa/mesa.spec Normal file

File diff suppressed because it is too large Load Diff

View File

@ -27,15 +27,19 @@ index 8d280340091..cfa1baf6127 100644
struct wl_event_queue *queue; struct wl_event_queue *queue;
struct wl_shm *wl_shm; struct wl_shm *wl_shm;
@@ -155,6 +160,8 @@ struct wsi_wl_surface { @@ -157,8 +166,12 @@ struct wsi_wl_surface {
struct wsi_wl_swapchain { struct wsi_wl_swapchain {
struct wsi_swapchain base; struct wsi_swapchain base;
+ struct wl_event_queue *queue; + struct wl_event_queue *queue;
+ +
struct wsi_wl_surface *wsi_wl_surface; struct wsi_wl_surface *wsi_wl_surface;
struct wp_tearing_control_v1 *tearing_control;
+ struct gamescope_commit_queue_v1 *commit_queue;
+ bool can_timestamp;
struct wl_callback *frame; struct wl_callback *frame;
@@ -177,10 +184,7 @@ struct wsi_wl_swapchain { @@ -177,10 +184,7 @@ struct wsi_wl_swapchain {
pthread_mutex_t lock; /* protects all members */ pthread_mutex_t lock; /* protects all members */
uint64_t max_completed; uint64_t max_completed;
@ -642,17 +646,6 @@ index cfa1baf6127..d01ff68781e 100644
struct wl_buffer *buffer; struct wl_buffer *buffer;
bool busy; bool busy;
int shm_fd; int shm_fd;
@@ -163,6 +169,10 @@ struct wsi_wl_swapchain {
struct wl_event_queue *queue;
struct wsi_wl_surface *wsi_wl_surface;
+ struct wp_tearing_control_v1 *tearing_control;
+ struct wp_commit_queue_v1 *commit_queue;
+ struct wp_commit_timer_v1 *commit_timer;
+ bool can_timestamp;
struct wl_callback *frame;
@@ -178,13 +188,17 @@ struct wsi_wl_swapchain { @@ -178,13 +188,17 @@ struct wsi_wl_swapchain {
const uint64_t *drm_modifiers; const uint64_t *drm_modifiers;
@ -672,35 +665,25 @@ index cfa1baf6127..d01ff68781e 100644
} present_ids; } present_ids;
struct wsi_wl_image images[0]; struct wsi_wl_image images[0];
@@ -928,6 +942,15 @@ registry_handle_global(void *data, struct wl_registry *registry, @@ -801,6 +944,9 @@ registry_handle_global(void *data, struct wl_registry *registry,
if (strcmp(interface, wp_presentation_interface.name) == 0) { } else if (strcmp(interface, wp_tearing_control_manager_v1_interface.name) == 0) {
display->wp_presentation_notwrapped = display->tearing_control_manager =
wl_registry_bind(registry, name, &wp_presentation_interface, 1); wl_registry_bind(registry, name, &wp_tearing_control_manager_v1_interface, 1);
+ } else if (strcmp(interface, wp_tearing_control_v1_interface.name) == 0) { + } else if (strcmp(interface, gamescope_commit_queue_manager_v1_interface.name) == 0) {
+ display->tearing_control_manager =
+ wl_registry_bind(registry, name, &wp_tearing_control_manager_v1_interface, 1);
+ } else if (strcmp(interface, wp_commit_timing_manager_v1_interface.name) == 0) {
+ display->commit_timing_manager =
+ wl_registry_bind(registry, name, &wp_commit_timing_manager_v1_interface, 1);
+ } else if (strcmp(interface, wp_commit_queue_manager_v1_interface.name) == 0) {
+ display->commit_queue_manager = + display->commit_queue_manager =
+ wl_registry_bind(registry, name, &wp_commit_queue_manager_v1_interface, 1); + wl_registry_bind(registry, name, &gamescope_commit_queue_manager_v1_interface, 1);
} }
} }
@@ -954,6 +977,12 @@ wsi_wl_display_finish(struct wsi_wl_display *display) @@ -973,6 +973,8 @@ wsi_wl_display_finish(struct wsi_wl_display *display)
zwp_linux_dmabuf_v1_destroy(display->wl_dmabuf); zwp_linux_dmabuf_v1_destroy(display->wl_dmabuf);
if (display->wp_presentation_notwrapped) if (display->wp_presentation_notwrapped)
wp_presentation_destroy(display->wp_presentation_notwrapped); wp_presentation_destroy(display->wp_presentation_notwrapped);
+ if (display->commit_queue_manager) + if (display->commit_queue_manager)
+ wp_commit_queue_manager_v1_destroy(display->commit_queue_manager); + gamescope_commit_queue_manager_v1_destroy(display->commit_queue_manager);
+ if (display->commit_timing_manager) if (display->tearing_control_manager)
+ wp_commit_timing_manager_v1_destroy(display->commit_timing_manager); wp_tearing_control_manager_v1_destroy(display->tearing_control_manager);
+ if (display->tearing_control_manager)
+ wp_tearing_control_manager_v1_destroy(display->tearing_control_manager);
if (display->wl_display_wrapper) if (display->wl_display_wrapper)
wl_proxy_wrapper_destroy(display->wl_display_wrapper);
if (display->queue)
@@ -1875,6 +1904,16 @@ wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain *wsi_chain, @@ -1875,6 +1904,16 @@ wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain *wsi_chain,
else else
time_left = end_time - now; time_left = end_time - now;
@ -871,25 +854,17 @@ index cfa1baf6127..d01ff68781e 100644
wsi_swapchain_finish(&chain->base); wsi_swapchain_finish(&chain->base);
} }
@@ -2235,6 +2337,19 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, @@ -2263,6 +2365,11 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
if (pCreateInfo->oldSwapchain) { wp_tearing_control_v1_destroy(old_chain->tearing_control);
VK_FROM_HANDLE(wsi_wl_swapchain, old_chain, pCreateInfo->oldSwapchain); old_chain->tearing_control = NULL;
old_chain->wsi_wl_surface = NULL; }
+ if (old_chain->tearing_control) {
+ wp_tearing_control_v1_destroy(old_chain->tearing_control);
+ old_chain->tearing_control = NULL;
+ }
+ if (old_chain->commit_queue) { + if (old_chain->commit_queue) {
+ wp_commit_queue_v1_destroy(old_chain->commit_queue); + gamescope_commit_queue_v1_destroy(old_chain->commit_queue);
+ old_chain->commit_queue = NULL; + old_chain->commit_queue = NULL;
+ old_chain->can_timestamp = false; + old_chain->can_timestamp = false;
+ }
+ if (old_chain->commit_timer) {
+ wp_commit_timer_v1_destroy(old_chain->commit_timer);
+ old_chain->commit_timer = NULL;
+ } + }
} }
/* Take ownership of the wsi_wl_surface */ /* Take ownership of the wsi_wl_surface */
@@ -2337,7 +2452,16 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, @@ -2337,7 +2452,16 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
chain->queue); chain->queue);
@ -986,33 +961,6 @@ index d01ff68781e..5e05f0488dc 100644
struct wsi_wayland *wsi_wl; struct wsi_wayland *wsi_wl;
@@ -171,7 +169,6 @@ struct wsi_wl_swapchain {
struct wsi_wl_surface *wsi_wl_surface;
struct wp_tearing_control_v1 *tearing_control;
struct wp_commit_queue_v1 *commit_queue;
- struct wp_commit_timer_v1 *commit_timer;
bool can_timestamp;
struct wl_callback *frame;
@@ -945,9 +942,6 @@ registry_handle_global(void *data, struct wl_registry *registry,
} else if (strcmp(interface, wp_tearing_control_v1_interface.name) == 0) {
display->tearing_control_manager =
wl_registry_bind(registry, name, &wp_tearing_control_manager_v1_interface, 1);
- } else if (strcmp(interface, wp_commit_timing_manager_v1_interface.name) == 0) {
- display->commit_timing_manager =
- wl_registry_bind(registry, name, &wp_commit_timing_manager_v1_interface, 1);
} else if (strcmp(interface, wp_commit_queue_manager_v1_interface.name) == 0) {
display->commit_queue_manager =
wl_registry_bind(registry, name, &wp_commit_queue_manager_v1_interface, 1);
@@ -979,8 +973,6 @@ wsi_wl_display_finish(struct wsi_wl_display *display)
wp_presentation_destroy(display->wp_presentation_notwrapped);
if (display->commit_queue_manager)
wp_commit_queue_manager_v1_destroy(display->commit_queue_manager);
- if (display->commit_timing_manager)
- wp_commit_timing_manager_v1_destroy(display->commit_timing_manager);
if (display->tearing_control_manager)
wp_tearing_control_manager_v1_destroy(display->tearing_control_manager);
if (display->wl_display_wrapper)
@@ -2032,9 +2024,6 @@ set_timestamp(struct wsi_wl_swapchain *chain) @@ -2032,9 +2024,6 @@ set_timestamp(struct wsi_wl_swapchain *chain)
} }
@ -1041,17 +989,6 @@ index d01ff68781e..5e05f0488dc 100644
wsi_swapchain_finish(&chain->base); wsi_swapchain_finish(&chain->base);
} }
@@ -2346,10 +2333,6 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
old_chain->commit_queue = NULL;
old_chain->can_timestamp = false;
}
- if (old_chain->commit_timer) {
- wp_commit_timer_v1_destroy(old_chain->commit_timer);
- old_chain->commit_timer = NULL;
- }
}
/* Take ownership of the wsi_wl_surface */
@@ -2454,12 +2437,9 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, @@ -2454,12 +2437,9 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
chain->legacy_fifo_ready = true; chain->legacy_fifo_ready = true;
@ -1342,36 +1279,6 @@ index 5e05f0488dc..5f76491e7a1 100644
struct wsi_wayland *wsi_wl; struct wsi_wayland *wsi_wl;
@@ -168,7 +168,7 @@ struct wsi_wl_swapchain {
struct wsi_wl_surface *wsi_wl_surface;
struct wp_tearing_control_v1 *tearing_control;
- struct wp_commit_queue_v1 *commit_queue;
+ struct gamescope_commit_queue_v1 *commit_queue;
bool can_timestamp;
struct wl_callback *frame;
@@ -942,9 +942,9 @@ registry_handle_global(void *data, struct wl_registry *registry,
} else if (strcmp(interface, wp_tearing_control_v1_interface.name) == 0) {
display->tearing_control_manager =
wl_registry_bind(registry, name, &wp_tearing_control_manager_v1_interface, 1);
- } else if (strcmp(interface, wp_commit_queue_manager_v1_interface.name) == 0) {
+ } else if (strcmp(interface, gamescope_commit_queue_manager_v1_interface.name) == 0) {
display->commit_queue_manager =
- wl_registry_bind(registry, name, &wp_commit_queue_manager_v1_interface, 1);
+ wl_registry_bind(registry, name, &gamescope_commit_queue_manager_v1_interface, 1);
}
}
@@ -972,7 +972,7 @@ wsi_wl_display_finish(struct wsi_wl_display *display)
if (display->wp_presentation_notwrapped)
wp_presentation_destroy(display->wp_presentation_notwrapped);
if (display->commit_queue_manager)
- wp_commit_queue_manager_v1_destroy(display->commit_queue_manager);
+ gamescope_commit_queue_manager_v1_destroy(display->commit_queue_manager);
if (display->tearing_control_manager)
wp_tearing_control_manager_v1_destroy(display->tearing_control_manager);
if (display->wl_display_wrapper)
@@ -2025,8 +2025,8 @@ set_timestamp(struct wsi_wl_swapchain *chain) @@ -2025,8 +2025,8 @@ set_timestamp(struct wsi_wl_swapchain *chain)
timespec_from_nsec(&target_ts, target); timespec_from_nsec(&target_ts, target);
@ -1392,15 +1299,6 @@ index 5e05f0488dc..5f76491e7a1 100644
wsi_swapchain_finish(&chain->base); wsi_swapchain_finish(&chain->base);
} }
@@ -2329,7 +2329,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
old_chain->tearing_control = NULL;
}
if (old_chain->commit_queue) {
- wp_commit_queue_v1_destroy(old_chain->commit_queue);
+ gamescope_commit_queue_v1_destroy(old_chain->commit_queue);
old_chain->commit_queue = NULL;
old_chain->can_timestamp = false;
}
@@ -2438,7 +2438,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, @@ -2438,7 +2438,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
chain->legacy_fifo_ready = true; chain->legacy_fifo_ready = true;
struct wsi_wl_display *dpy = chain->wsi_wl_surface->display; struct wsi_wl_display *dpy = chain->wsi_wl_surface->display;
@ -1643,272 +1541,3 @@ index 72ff193d30a..996fc230673 100644
-- --
2.42.0 2.42.0
From 5879b667f90bf6e25e608f439ecd8ae047acc5aa Mon Sep 17 00:00:00 2001
From: Simon Ser <contact@emersion.fr>
Date: Fri, 26 Aug 2022 11:35:13 +0200
Subject: [PATCH 7/8] vulkan/wsi/wayland: add support for IMMEDIATE
Use the tearing-control-unstable-v1 protocol to indicate to the
Wayland compositor that tearing is acceptable.
Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18268>
---
meson.build | 2 +-
src/egl/wayland/wayland-drm/meson.build | 1 +
src/vulkan/wsi/meson.build | 1 +
src/vulkan/wsi/wsi_common_wayland.c | 84 +++++++++++++++++++------
4 files changed, 67 insertions(+), 21 deletions(-)
diff --git a/meson.build b/meson.build
index 59732981b8a..9a85e99446c 100644
--- a/meson.build
+++ b/meson.build
@@ -1924,7 +1924,7 @@ if with_platform_wayland
else
wl_scanner_arg = 'code'
endif
- dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.24')
+ dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.30')
dep_wayland_client = dependency('wayland-client', version : '>=1.18')
dep_wayland_server = dependency('wayland-server', version : '>=1.18')
if with_egl
diff --git a/src/egl/wayland/wayland-drm/meson.build b/src/egl/wayland/wayland-drm/meson.build
index a6f9bf2e10b..eae91e20998 100644
--- a/src/egl/wayland/wayland-drm/meson.build
+++ b/src/egl/wayland/wayland-drm/meson.build
@@ -63,6 +63,7 @@ wp_protos = {
#'commit-timing-v1': 'staging/commit-timing/commit-timing-v1.xml',
'linux-dmabuf-unstable-v1': 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml',
'presentation-time': 'stable/presentation-time/presentation-time.xml',
+ 'tearing-control-v1': 'staging/tearing-control/tearing-control-v1.xml',
}
wp_files = {}
foreach name, xml : wp_protos
diff --git a/src/vulkan/wsi/meson.build b/src/vulkan/wsi/meson.build
index 43e23ca716d..fb0fab69ac6 100644
--- a/src/vulkan/wsi/meson.build
+++ b/src/vulkan/wsi/meson.build
@@ -35,6 +35,7 @@ if with_platform_wayland
#files_vulkan_wsi += wp_files['commit-timing-v1']
files_vulkan_wsi += wp_files['linux-dmabuf-unstable-v1']
files_vulkan_wsi += wp_files['presentation-time']
+ files_vulkan_wsi += wp_files['tearing-control-v1']
endif
if with_platform_windows
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 5f76491e7a1..1b49553ea8c 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -44,6 +44,7 @@
#include "gamescope-commit-queue-v1-client-protocol.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h"
#include "presentation-time-client-protocol.h"
+#include "tearing-control-v1-client-protocol.h"
#include <util/compiler.h>
#include <util/hash_table.h>
@@ -106,6 +107,7 @@ struct wsi_wl_display {
struct wl_shm *wl_shm;
struct zwp_linux_dmabuf_v1 *wl_dmabuf;
struct zwp_linux_dmabuf_feedback_v1 *wl_dmabuf_feedback;
+ struct wp_tearing_control_manager_v1 *tearing_control_manager;
struct dmabuf_feedback_format_table format_table;
@@ -1170,11 +1172,6 @@ wsi_wl_surface_get_support(VkIcdSurfaceBase *surface,
return VK_SUCCESS;
}
-static const VkPresentModeKHR present_modes[] = {
- VK_PRESENT_MODE_MAILBOX_KHR,
- VK_PRESENT_MODE_FIFO_KHR,
-};
-
static uint32_t
wsi_wl_surface_get_min_image_count(const VkSurfacePresentModeEXT *present_mode)
{
@@ -1301,15 +1298,30 @@ wsi_wl_surface_get_capabilities2(VkIcdSurfaceBase *surface,
vk_outarray_append_typed(VkPresentModeKHR, &modes, mode) {
*mode = present_mode->presentMode;
}
- for (unsigned i = 0; i < ARRAY_SIZE(present_modes); i++) {
- if (present_modes[i] != present_mode->presentMode) {
- vk_outarray_append_typed(VkPresentModeKHR, &modes, mode) {
- *mode = present_modes[i];
- }
+ switch (present_mode->presentMode) {
+ case VK_PRESENT_MODE_MAILBOX_KHR:
+ vk_outarray_append_typed(VkPresentModeKHR, &modes, mode) {
+ *mode = VK_PRESENT_MODE_FIFO_KHR;
+ }
+ break;
+ case VK_PRESENT_MODE_FIFO_KHR:
+ vk_outarray_append_typed(VkPresentModeKHR, &modes, mode) {
+ *mode = VK_PRESENT_MODE_MAILBOX_KHR;
}
+ break;
+ default:
+ break;
}
} else {
- compat->presentModeCount = ARRAY_SIZE(present_modes);
+ switch (present_mode->presentMode) {
+ case VK_PRESENT_MODE_MAILBOX_KHR:
+ case VK_PRESENT_MODE_FIFO_KHR:
+ compat->presentModeCount = 2;
+ break;
+ default:
+ compat->presentModeCount = 1;
+ break;
+ }
}
break;
}
@@ -1401,20 +1413,42 @@ wsi_wl_surface_get_formats2(VkIcdSurfaceBase *icd_surface,
}
static VkResult
-wsi_wl_surface_get_present_modes(VkIcdSurfaceBase *surface,
+wsi_wl_surface_get_present_modes(VkIcdSurfaceBase *icd_surface,
struct wsi_device *wsi_device,
uint32_t* pPresentModeCount,
VkPresentModeKHR* pPresentModes)
{
+ VkIcdSurfaceWayland *surface = (VkIcdSurfaceWayland *)icd_surface;
+ struct wsi_wayland *wsi =
+ (struct wsi_wayland *)wsi_device->wsi[VK_ICD_WSI_PLATFORM_WAYLAND];
+
+ struct wsi_wl_display display;
+ if (wsi_wl_display_init(wsi, &display, surface->display, true,
+ wsi_device->sw))
+ return VK_ERROR_SURFACE_LOST_KHR;
+
+ VkPresentModeKHR present_modes[3];
+ uint32_t present_modes_count = 0;
+
+ /* The following two modes are always supported */
+ present_modes[present_modes_count++] = VK_PRESENT_MODE_MAILBOX_KHR;
+ present_modes[present_modes_count++] = VK_PRESENT_MODE_FIFO_KHR;
+
+ if (display.tearing_control_manager)
+ present_modes[present_modes_count++] = VK_PRESENT_MODE_IMMEDIATE_KHR;
+
+ assert(present_modes_count <= ARRAY_SIZE(present_modes));
+ wsi_wl_display_finish(&display);
+
if (pPresentModes == NULL) {
- *pPresentModeCount = ARRAY_SIZE(present_modes);
+ *pPresentModeCount = present_modes_count;
return VK_SUCCESS;
}
- *pPresentModeCount = MIN2(*pPresentModeCount, ARRAY_SIZE(present_modes));
+ *pPresentModeCount = MIN2(*pPresentModeCount, present_modes_count);
typed_memcpy(pPresentModes, present_modes, *pPresentModeCount);
- if (*pPresentModeCount < ARRAY_SIZE(present_modes))
+ if (*pPresentModeCount < present_modes_count)
return VK_INCOMPLETE;
else
return VK_SUCCESS;
@@ -2253,6 +2287,8 @@ wsi_wl_swapchain_chain_free(struct wsi_wl_swapchain *chain,
{
if (chain->frame)
wl_callback_destroy(chain->frame);
+ if (chain->tearing_control)
+ wp_tearing_control_v1_destroy(chain->tearing_control);
if (chain->wsi_wl_surface)
chain->wsi_wl_surface->chain = NULL;
@@ -2328,11 +2364,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
wp_tearing_control_v1_destroy(old_chain->tearing_control);
old_chain->tearing_control = NULL;
}
- if (old_chain->commit_queue) {
- gamescope_commit_queue_v1_destroy(old_chain->commit_queue);
- old_chain->commit_queue = NULL;
- old_chain->can_timestamp = false;
- }
+
}
/* Take ownership of the wsi_wl_surface */
@@ -2343,6 +2375,18 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
if (result != VK_SUCCESS)
goto fail;
+ if (chain->base.present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR) {
+ chain->tearing_control =
+ wp_tearing_control_manager_v1_get_tearing_control(wsi_wl_surface->display->tearing_control_manager,
+ wsi_wl_surface->surface);
+ if (!chain->tearing_control) {
+ result = VK_ERROR_OUT_OF_HOST_MEMORY;
+ goto fail;
+ }
+ wp_tearing_control_v1_set_presentation_hint(chain->tearing_control,
+ WP_TEARING_CONTROL_V1_PRESENTATION_HINT_ASYNC);
+ }
+
enum wsi_wl_buffer_type buffer_type;
struct wsi_base_image_params *image_params = NULL;
struct wsi_cpu_image_params cpu_image_params;
--
2.42.0
From 8aee550e8d1d92db188ced660911b21131eefcf8 Mon Sep 17 00:00:00 2001
From: Friedrich Vock <friedrich.vock@gmx.de>
Date: Fri, 1 Dec 2023 15:18:44 +0100
Subject: [PATCH 8/8] radv: Enable compute dispatch tunneling
Compute tunneling can considerably lower the latency of high-priority
compute work. Enabling it is beneficial in cases where high-priority
work is dispatched while the GPU is already busy with other work (e.g.
rendering on GFX). This is the case in VR compositors that dispatch
latency-sensitive compositing work to ACE while GFX is busy rendering
the next frame.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26462>
---
src/amd/vulkan/radv_device.c | 7 +++++++
src/amd/vulkan/si_cmd_buffer.c | 2 ++
2 files changed, 9 insertions(+)
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 71929671830..92ab8134066 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -904,6 +904,13 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr
*/
device->dispatch_initiator |= S_00B800_ORDER_MODE(1);
}
+ if (device->physical_device->rad_info.gfx_level >= GFX10) {
+ /* Enable asynchronous compute tunneling. The KMD restricts this feature
+ * to high-priority compute queues, so setting the bit on any other queue
+ * is a no-op. PAL always sets this bit as well.
+ */
+ device->dispatch_initiator |= S_00B800_TUNNEL_ENABLE(1);
+ }
/* Disable partial preemption for task shaders.
* The kernel may not support preemption, but PAL always sets this bit,
diff --git a/src/amd/vulkan/si_cmd_buffer.c b/src/amd/vulkan/si_cmd_buffer.c
index 7da3141edd1..9969fe5afbe 100644
--- a/src/amd/vulkan/si_cmd_buffer.c
+++ b/src/amd/vulkan/si_cmd_buffer.c
@@ -113,6 +113,8 @@ si_emit_compute(struct radv_device *device, struct radeon_cmdbuf *cs)
radeon_emit(cs, 0); /* R_00B894_COMPUTE_USER_ACCUM_1 */
radeon_emit(cs, 0); /* R_00B898_COMPUTE_USER_ACCUM_2 */
radeon_emit(cs, 0); /* R_00B89C_COMPUTE_USER_ACCUM_3 */
+
+ radeon_set_sh_reg(cs, R_00B9F4_COMPUTE_DISPATCH_TUNNEL, 0);
}
/* This register has been moved to R_00CD20_COMPUTE_MAX_WAVE_ID
--
2.42.0