From e4ca490fa7ec3654cf35a169e9ae544b33fa9e7e Mon Sep 17 00:00:00 2001 From: Jan Palus Date: Thu, 10 Mar 2022 00:17:52 +0100 Subject: [PATCH] up to 22.0.0 - classic drivers were dropped (r100, r200, i915, i965, nouveau) - OpenSWR was dropped --- Mesa.spec | 170 +++---------------------------- panfrost_xwayland_hang.patch | 187 ----------------------------------- 2 files changed, 12 insertions(+), 345 deletions(-) delete mode 100644 panfrost_xwayland_hang.patch diff --git a/Mesa.spec b/Mesa.spec index a9ef50b..8826edc 100644 --- a/Mesa.spec +++ b/Mesa.spec @@ -4,7 +4,7 @@ # # Conditional build: %bcond_without gallium # gallium drivers -%bcond_with gallium_i915 # gallium i915 driver instead of dri i915 driver +%bcond_without gallium_i915 # gallium i915 driver %bcond_without gallium_nouveau # gallium nouveau driver %bcond_without gallium_radeon # gallium radeon drivers %bcond_without gallium_zink # gallium zink driver (based on vulkan) @@ -21,8 +21,6 @@ %bcond_without xa # XA state tracker (for vmwgfx xorg driver) %bcond_without radv # disable build of the radeon Vulkan driver %bcond_with sse2 # SSE2 instructions -%bcond_with swr # OpenSWR software rasterizer (x86 SIMD only; due to broken design - # propagates AVX code over Gallium DRI megadriver, swrast pipe driver and libOSMesa) %bcond_with hud_extra # HUD block/NIC I/O HUD stats support %bcond_with lm_sensors # HUD lm_sensors support %bcond_with tests # tests @@ -32,7 +30,7 @@ # (until they start to be somehow versioned themselves) %define glapi_ver 7.1.0 # other packages -%define libdrm_ver 2.4.107 +%define libdrm_ver 2.4.109 %define dri2proto_ver 2.8 %define glproto_ver 1.4.14 %define zlib_ver 1.2.8 @@ -48,7 +46,6 @@ %undefine with_nine %undefine with_omx %undefine with_opencl -%undefine with_swr %undefine with_va %undefine with_xa %endif @@ -62,10 +59,6 @@ %undefine with_ocl_icd %endif -%ifnarch %{ix86} %{x8664} x32 -%undefine with_swr -%endif - %if %{with gallium_radeon} || %{with gallium_nouveau} %define with_vdpau 1 %define with_xvmc 1 @@ -78,16 +71,15 @@ Summary: Free OpenGL implementation Summary(pl.UTF-8): Wolnodostępna implementacja standardu OpenGL Name: Mesa -Version: 21.3.7 -Release: 2 +Version: 22.0.0 +Release: 1 License: MIT (core) and others - see license.html file Group: X11/Libraries #Source0: ftp://ftp.freedesktop.org/pub/mesa/mesa-%{version}.tar.xz ## Source0-md5: 7c61a801311fb8d2f7b3cceb7b5cf308 Source0: https://gitlab.freedesktop.org/mesa/mesa/-/archive/mesa-%{version}/mesa-mesa-%{version}.tar.bz2 -# Source0-md5: 2a9dbccda11a6b07fe2b110c71fc8bd8 +# Source0-md5: 0efeea580ac9f0040d5054b1c74846dd Patch0: zink_x32.patch -Patch1: panfrost_xwayland_hang.patch URL: https://www.mesa3d.org/ %{?with_opencl_spirv:BuildRequires: SPIRV-LLVM-Translator-devel >= 8.0.1.3} %{?with_gallium_zink:BuildRequires: Vulkan-Loader-devel} @@ -110,7 +102,7 @@ BuildRequires: libxcb-devel >= 1.13 %{?with_radv:BuildRequires: llvm-devel >= %{llvm_ver}} %{?with_opencl:BuildRequires: llvm-libclc} %{?with_omx:BuildRequires: libomxil-bellagio-devel} -BuildRequires: meson >= 0.52 +BuildRequires: meson >= 0.53 BuildRequires: ninja >= 1.5 BuildRequires: pkgconfig BuildRequires: pkgconfig(talloc) >= 2.0.1 @@ -124,9 +116,10 @@ BuildRequires: python3-Mako >= 0.8.0 BuildRequires: rpmbuild(macros) >= 2.007 BuildRequires: sed >= 4.0 %{?with_opencl_spirv:BuildRequires: spirv-tools-devel >= 2018.0} +BuildRequires: udev-devel # wayland-{client,server} %{?with_wayland:BuildRequires: wayland-devel >= %{wayland_ver}} -%{?with_wayland:BuildRequires: wayland-protocols >= 1.8} +%{?with_wayland:BuildRequires: wayland-protocols >= 1.24} %{?with_wayland:BuildRequires: wayland-egl-devel >= %{wayland_ver}} BuildRequires: xorg-lib-libX11-devel BuildRequires: xorg-lib-libXext-devel >= 1.0.5 @@ -362,7 +355,6 @@ Summary: OSMesa (off-screen renderer) library Summary(pl.UTF-8): Biblioteka OSMesa (renderująca bitmapy w pamięci) License: MIT Group: Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} %description libOSMesa @@ -616,52 +608,11 @@ Nine Direct3D9 driver API. %description d3d-devel -l pl.UTF-8 API sterownika Direct3D9 Nine. -%package dri-driver-ati-radeon-R100 -Summary: X.org DRI driver for ATI R100 card family -Summary(pl.UTF-8): Sterownik X.org DRI dla rodziny kart ATI R100 -License: MIT -Group: X11/Libraries -Requires: zlib >= %{zlib_ver} -Suggests: xorg-driver-video-amdgpu -Suggests: xorg-driver-video-ati -Obsoletes: X11-driver-radeon-dri < 1:7.0.0 -Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} -Conflicts: xorg-xserver-libglx(glapi) < %{glapi_ver} - -%description dri-driver-ati-radeon-R100 -X.org DRI driver for ATI R100 card family (Radeon 7000-7500). It -supports R100, RV100, RS100, RV200, RS200, RS250. - -%description dri-driver-ati-radeon-R100 -l pl.UTF-8 -Sterownik X.org DRI dla rodziny kart ATI R100 (Radeon 7000-7500). -Obsługuje układy R100, RV100, RS100, RV200, RS200, RS250. - -%package dri-driver-ati-radeon-R200 -Summary: X.org DRI driver for ATI R200 card family -Summary(pl.UTF-8): Sterownik X.org DRI dla rodziny kart ATI R200 -License: MIT -Group: X11/Libraries -Requires: zlib >= %{zlib_ver} -Suggests: xorg-driver-video-amdgpu -Suggests: xorg-driver-video-ati -Obsoletes: X11-driver-radeon-dri < 1:7.0.0 -Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} -Conflicts: xorg-xserver-libglx(glapi) < %{glapi_ver} - -%description dri-driver-ati-radeon-R200 -X.org DRI driver for ATI R200 card family (Radeon 8500-92xx). It -supports R200, RV250, RV280, RS300, RS350 chips. - -%description dri-driver-ati-radeon-R200 -l pl.UTF-8 -Sterownik X.org DRI dla rodziny kart ATI R200 (Radeon 8500-92xx). -Obsługuje układy R200, RV250, RV280, RS300, RS350. - %package dri-driver-ati-radeon-R300 Summary: X.org DRI driver for ATI R300 card family Summary(pl.UTF-8): Sterownik X.org DRI dla rodziny kart ATI R300 License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} Suggests: xorg-driver-video-amdgpu Suggests: xorg-driver-video-ati @@ -688,7 +639,6 @@ Summary: X.org DRI driver for ATI R600 card family Summary(pl.UTF-8): Sterownik X.org DRI dla rodziny kart ATI R600 License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: radeon-ucode Requires: zlib >= %{zlib_ver} Suggests: xorg-driver-video-amdgpu @@ -715,7 +665,6 @@ Summary: X.org DRI driver for ATI Southern Islands card family Summary(pl.UTF-8): Sterownik X.org DRI dla rodziny kart ATI Southern Islands License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: radeon-ucode Requires: zlib >= %{zlib_ver} Suggests: xorg-driver-video-amdgpu @@ -740,7 +689,6 @@ Summary: X.org DRI driver for Vivante 3D chips Summary(pl.UTF-8): Sterownik X.org DRI dla układów Vivante 3D License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} #Suggests: xorg-driver-video-? Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} @@ -757,7 +705,6 @@ Summary: X.org DRI driver for Adreno chips Summary(pl.UTF-8): Sterownik X.org DRI dla układów Adreno License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} Suggests: xorg-driver-video-freedreno Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} @@ -774,8 +721,8 @@ Summary: X.org DRI driver for Intel Gen4-Gen7 chips Summary(pl.UTF-8): Sterownik X.org DRI dla układów Intel Gen4-Gen7 License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} +Obsoletes: Mesa-dri-driver-intel-i965 < 22.0.0 Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} Conflicts: xorg-xserver-libglx(glapi) < %{glapi_ver} @@ -790,9 +737,6 @@ Summary: X.org DRI driver for Intel i915 card family Summary(pl.UTF-8): Sterownik X.org DRI dla rodziny kart Intel i915 License: MIT Group: X11/Libraries -%if %{with gallium_i915} -%{?with_swr:Requires: cpuinfo(avx)} -%endif Requires: zlib >= %{zlib_ver} Obsoletes: Mesa-dri-driver-intel-i830 < 6.5 Obsoletes: X11-driver-i810-dri < 1:7.0.0 @@ -807,39 +751,11 @@ X.org DRI driver for Intel i915 card family (830, 845, 852/855, 865, Sterownik X.org DRI dla rodziny kart Intel i915 (830, 845, 852/855, 865, 915, 945, G33, Q33, Q35, Pineview). -%package dri-driver-intel-i965 -Summary: X.org DRI driver for Intel i965 card family -Summary(pl.UTF-8): Sterownik X.org DRI dla rodziny kart Intel i965 -License: MIT -Group: X11/Libraries -Requires: zlib >= %{zlib_ver} -Obsoletes: Mesa-dri-driver-intel-i830 < 6.5 -Obsoletes: X11-driver-i810-dri < 1:7.0.0 -Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} -Conflicts: xorg-xserver-libglx(glapi) < %{glapi_ver} - -%description dri-driver-intel-i965 -X.org (non-Gallium) DRI driver for Intel i965 card family (946GZ, -965G, 965Q, 965GM, 965GME, GM45, G41, B43, Q45/Q43, G45/G43, Ironlake, -Sandybridge, Ivybridge, Haswell, Ray Trail, Broadwell, Cherrytrail, -Braswell, Cherryview, Skylake, Broxton, Kabylake, Coffeelake, -Geminilake, Whiskey Lake, Comet Lake, Cannonlake, Ice Lake, Elkhart -Lake). - -%description dri-driver-intel-i965 -l pl.UTF-8 -Sterownik X.org DRI (nie Gallium) dla rodziny kart Intel i965 (946GZ, -965G, 965Q, 965GM, 965GME, GM45, G41, B43, Q45/Q43, G45/G43, Ironlake, -Sandybridge, Ivybridge, Haswell, Ray Trail, Broadwell, Cherrytrail, -Braswell, Cherryview, Skylake, Broxton, Kabylake, Coffeelake, -Geminilake, Whiskey Lake, Comet Lake, Cannonlake, Ice Lake, Elkhart -Lake). - %package dri-driver-intel-iris Summary: X.org DRI driver for Intel Iris (Gen8+) card family Summary(pl.UTF-8): Sterownik X.org DRI dla rodziny kart Intel Iris (Gen8+) License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} Conflicts: xorg-xserver-libglx(glapi) < %{glapi_ver} @@ -859,7 +775,6 @@ Summary: X.org Gallium DRI driver using KMS Render-Only architecture Summary(pl.UTF-8): Sterownik X.org DRI Gallium wykorzystujący architekturę KMS Render-Only License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} #Suggests: xorg-driver-video-? Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} @@ -877,7 +792,6 @@ Summary: X.org DRI driver for Mali Utgard chips Summary(pl.UTF-8): Sterownik X.org DRI dla układów Mali Utgard License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} #Suggests: xorg-driver-video-??? Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} @@ -894,9 +808,6 @@ Summary: X.org DRI driver for NVIDIA card family Summary(pl.UTF-8): Sterownik X.org DRI dla rodziny kart NVIDIA License: MIT Group: X11/Libraries -%if %{with gallium_nouveau} -%{?with_swr:Requires: cpuinfo(avx)} -%endif Requires: zlib >= %{zlib_ver} Suggests: xorg-driver-video-nouveau Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} @@ -913,7 +824,6 @@ Summary: X.org DRI driver for Mali Midgard/Bifrost chips Summary(pl.UTF-8): Sterownik X.org DRI dla układów Mali Midgard/Bifrost License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} #Suggests: xorg-driver-video-??? Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} @@ -930,7 +840,6 @@ Summary: X.org DRI software rasterizer driver Summary(pl.UTF-8): Sterownik X.org DRI obsługujący rysowanie programowe License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} Conflicts: xorg-xserver-libglx(glapi) < %{glapi_ver} @@ -946,7 +855,6 @@ Summary: X.org DRI driver for Tegra SoC chips Summary(pl.UTF-8): Sterownik X.org DRI dla układów SoC Tegra License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} #Suggests: xorg-driver-video-??? Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} @@ -963,7 +871,6 @@ Summary: X.org DRI driver for Broadcom VC5 chips Summary(pl.UTF-8): Sterownik X.org DRI dla układów Broadcom VC5 License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} Suggests: xorg-driver-video-modesetting Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} @@ -980,7 +887,6 @@ Summary: X.org DRI driver for Broadcom VC4 chips Summary(pl.UTF-8): Sterownik X.org DRI dla układów Broadcom VC4 License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} Suggests: xorg-driver-video-modesetting Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} @@ -997,7 +903,6 @@ Summary: X.org DRI driver for QEMU VirGL Summary(pl.UTF-8): Sterownik X.org DRI dla QEMU VirGL License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} Conflicts: xorg-xserver-libglx(glapi) < %{glapi_ver} @@ -1013,7 +918,6 @@ Summary: X.org DRI driver for VMware Summary(pl.UTF-8): Sterownik X.org DRI dla VMware License: MIT Group: X11/Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} Suggests: xorg-driver-video-vmware Conflicts: xorg-xserver-libglx(glapi) > %{glapi_ver} @@ -1188,7 +1092,6 @@ Southern Islands. Summary: Software (swrast) driver for Mesa Gallium dynamic pipe loader Summary(pl.UTF-8): Sterownik programowy (swrast) dla dynamicznego systemu potoków szkieletu Mesa Gallium Group: Libraries -%{?with_swr:Requires: cpuinfo(avx)} Requires: zlib >= %{zlib_ver} Obsoletes: Mesa-gbm-driver-swrast < 11.1.1 Obsoletes: Mesa-opencl-driver-swrast < 9.1 @@ -1216,23 +1119,6 @@ virtual video adapter. Sterownik vmwgfx dla dynamicznego systemu potoków szkieletu Mesa Gallium. Obsługuje wirtualną kartę graficzną VMware. -%package swr -Summary: OpenSWR software rasterizer modules for Mesa -Summary(pl.UTF-8): Moduły programowego rasteryzera OpenSWR dla Mesy -Group: Libraries -Requires: cpuinfo(avx) -Requires: zlib >= %{zlib_ver} - -%description swr -OpenSWR software rasterizer modules for Mesa, utilizing x86 AVX or -VX2 instruction sets. They can be loaded by swrast pipe driver or -OSMesa library. - -%description swr -l pl.UTF-8 -Moduły programowego rasteryzera OpenSWR dla Mesy, wykorzystujące -zestawy instrukcji x86 AVX lub AVX2. Mogą być wczytywane przez -sterownik potoków swrast lub bibliotekę OSMesa. - %package -n libva-driver-gallium Summary: VA driver for Gallium State Tracker Summary(pl.UTF-8): Sterowniki VA do Gallium @@ -1513,7 +1399,6 @@ radv - eksperymentalny sterownik Vulkan dla GPU firmy AMD. %prep %setup -q -n mesa-mesa-%{version} %patch0 -p1 -%patch1 -p1 %build %if %{with opencl} @@ -1523,20 +1408,10 @@ if [ "$(llvm-config --has-rtti)" != "YES" ] ; then fi %endif -dri_drivers="nouveau r100 r200 \ -%if %{without gallium} -swrast -%endif -%ifarch %{ix86} %{x8664} x32 -i965 %{!?with_gallium_i915:i915} \ -%endif -" - -dri_drivers=$(echo $dri_drivers | xargs | tr ' ' ',') gallium_drivers="virgl swrast %{?with_gallium_zink:zink} \ %ifarch %{ix86} %{x8664} x32 -svga iris %{?with_swr:swr} %{?with_gallium_i915:i915} crocus \ +svga iris %{?with_gallium_i915:i915} crocus \ %endif %if %{with gallium_radeon} r300 r600 radeonsi \ @@ -1572,7 +1447,6 @@ vulkan_drivers=$(echo $vulkan_drivers | xargs | tr ' ' ',') %meson build \ -Dplatforms=x11%{?with_wayland:,wayland} \ -Ddri3=enabled \ - -Ddri-drivers=${dri_drivers} \ -Ddri-drivers-path=%{_libdir}/xorg/modules/dri \ -Degl=%{?with_egl:enabled}%{!?with_egl:disabled} \ -Dgallium-drivers=${gallium_drivers} \ @@ -1858,14 +1732,6 @@ rm -rf $RPM_BUILD_ROOT ### drivers: dri -%files dri-driver-ati-radeon-R100 -%defattr(644,root,root,755) -%attr(755,root,root) %{_libdir}/xorg/modules/dri/radeon_dri.so - -%files dri-driver-ati-radeon-R200 -%defattr(644,root,root,755) -%attr(755,root,root) %{_libdir}/xorg/modules/dri/r200_dri.so - %if %{with gallium_radeon} %files dri-driver-ati-radeon-R300 %defattr(644,root,root,755) @@ -1883,13 +1749,8 @@ rm -rf $RPM_BUILD_ROOT %ifarch %{ix86} %{x8664} x32 %files dri-driver-intel-i915 %defattr(644,root,root,755) -%attr(755,root,root) %{_libdir}/xorg/modules/dri/i830_dri.so %attr(755,root,root) %{_libdir}/xorg/modules/dri/i915_dri.so -%files dri-driver-intel-i965 -%defattr(644,root,root,755) -%attr(755,root,root) %{_libdir}/xorg/modules/dri/i965_dri.so - %if %{with gallium} %files dri-driver-intel-crocus %defattr(644,root,root,755) @@ -1903,7 +1764,6 @@ rm -rf $RPM_BUILD_ROOT %files dri-driver-nouveau %defattr(644,root,root,755) -%attr(755,root,root) %{_libdir}/xorg/modules/dri/nouveau_vieux_dri.so %if %{with gallium_nouveau} %attr(755,root,root) %{_libdir}/xorg/modules/dri/nouveau_dri.so %endif @@ -1937,6 +1797,7 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) %{_libdir}/xorg/modules/dri/imx-drm_dri.so %attr(755,root,root) %{_libdir}/xorg/modules/dri/ingenic-drm_dri.so %attr(755,root,root) %{_libdir}/xorg/modules/dri/kirin_dri.so +%attr(755,root,root) %{_libdir}/xorg/modules/dri/komeda_dri.so %attr(755,root,root) %{_libdir}/xorg/modules/dri/mali-dp_dri.so %attr(755,root,root) %{_libdir}/xorg/modules/dri/mcde_dri.so %attr(755,root,root) %{_libdir}/xorg/modules/dri/mediatek_dri.so @@ -1944,6 +1805,7 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) %{_libdir}/xorg/modules/dri/mi0283qt_dri.so %attr(755,root,root) %{_libdir}/xorg/modules/dri/mxsfb-drm_dri.so %attr(755,root,root) %{_libdir}/xorg/modules/dri/pl111_dri.so +%attr(755,root,root) %{_libdir}/xorg/modules/dri/rcar-du_dri.so %attr(755,root,root) %{_libdir}/xorg/modules/dri/repaper_dri.so %attr(755,root,root) %{_libdir}/xorg/modules/dri/rockchip_dri.so %attr(755,root,root) %{_libdir}/xorg/modules/dri/st7586_dri.so @@ -2051,14 +1913,6 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) %{_libdir}/gallium-pipe/pipe_vmwgfx.so %endif %endif - -# currently disabled as cannot be built with swrast -%if %{with swr} -%files swr -%defattr(644,root,root,755) -%attr(755,root,root) %{_libdir}/libswrAVX.so* -%attr(755,root,root) %{_libdir}/libswrAVX2.so* -%endif %endif ### drivers: va diff --git a/panfrost_xwayland_hang.patch b/panfrost_xwayland_hang.patch deleted file mode 100644 index ba96177..0000000 --- a/panfrost_xwayland_hang.patch +++ /dev/null @@ -1,187 +0,0 @@ -From 74e4a5018b85af139dca06f3a614667d3d16748d Mon Sep 17 00:00:00 2001 -From: Alyssa Rosenzweig -Date: Tue, 22 Feb 2022 11:24:58 -0500 -Subject: [PATCH 1/2] panfrost: Fix FD resource_get_handle - -When handle->type is WINSYS_HANDLE_TYPE_FD, the caller wants a file descriptor -for the BO backing the resource. We previously had two paths for this: - -1. If rsrc->scanout is available, we prime the GEM handle from the KMS device - (rsrc->scanout->handle) to a file descriptor via the KMS device. - -2. If rsrc->scanout is not available, we prime the GEM handle from the GPU - (bo->gem_handle) to a file descriptor via the GPU device. - -In both cases, the caller passes in a resource (with BO) and expects out a file -descriptor. There are no direct GEM handles in the function signature; the -caller doesn't care which GEM handle we prime to get the file descriptor. In -principle, both paths produce the same file descriptor for the same BO, since -both GEM handles represent the same underlying resource (viewed from different -devices). - -On grounds of redundancy alone, it makes sense to remove the rsrc->scanout path. -Why have a path that only works sometimes, when we have another path that works -always? - -In fact, the issues with the rsrc->scanout path are deeper. rsrc->scanout is -populated by renderonly_create_gpu_import_for_resource, which does the -following: - -1. Get a file descriptor for the resource by resource_get_handle with - WINSYS_HANDLE_TYPE_FD -2. Prime the file descriptor to a GEM handle via the KMS device. - -Here comes strike number 2: in order to get a file descriptor via the KMS -device, we had to /already/ get a file descriptor via the GPU device. If we go -down the KMS device path, we effectively round trip: - - GPU handle -> fd -> KMS handle -> fd - -There is no good reason to do this; if everything works, the fd is the same in -each case. If everything works. If. - -The lifetimes of the GPU handle and the KMS handle are not necessarily bound. In -principle, a resource can be created with scanout (constructing a KMS handle). -Then the KMS view can be destroyed (invalidating the GEM handle for the KMS -device), even though the underlying resource is still valid. Notice the GPU -handle is still valid; its lifetime is tied to the resource itself. Then a -caller can ask for the FD for the resource; as the resource is still valid, this -is sensible. Under the scanout path, we try to get the FD by priming the GEM -handle on the KMS device... but that GEM handle is no longer valid, causing the -PRIME ioctl to fail with ENOENT. On the other hand, if we primed the GPU GEM -handle, everything works as expected. - -These edge cases are not theoretical; recent versions of Xwayland trigger this -ENOENT, causing issue #5758 on all Panfrost devices. As far as I can tell, no -other kmsro driver has this 'special' kmsro path; the only part of -resource_get_handle that needs special handling for kmsro is getting a KMS -handle. - -Let's remove the broken, useless path, fix Xwayland, bring us in line with other -drivers, and delete some code. - -Thank you for coming to my ted talk. - -Closes: #5758 -Fixes: 7da251fc721 ("panfrost: Check in sources for command stream") -Signed-off-by: Alyssa Rosenzweig -Reported-and-tested-by: Jan Palus -Reviewed-by: Simon Ser -Reviewed-by: James Jones -Acked-by: Daniel Stone ---- - src/gallium/drivers/panfrost/pan_resource.c | 30 +++++---------------- - 1 file changed, 7 insertions(+), 23 deletions(-) - -diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c -index f473f71099e..094332862ff 100644 ---- a/src/gallium/drivers/panfrost/pan_resource.c -+++ b/src/gallium/drivers/panfrost/pan_resource.c -@@ -165,31 +165,15 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen, - return true; - } - } else if (handle->type == WINSYS_HANDLE_TYPE_FD) { -- if (scanout) { -- struct drm_prime_handle args = { -- .handle = scanout->handle, -- .flags = DRM_CLOEXEC, -- }; -+ int fd = panfrost_bo_export(rsrc->image.data.bo); - -- int ret = drmIoctl(dev->ro->kms_fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args); -- if (ret == -1) -- return false; -- -- handle->stride = scanout->stride; -- handle->handle = args.fd; -- -- return true; -- } else { -- int fd = panfrost_bo_export(rsrc->image.data.bo); -- -- if (fd < 0) -- return false; -+ if (fd < 0) -+ return false; - -- handle->handle = fd; -- handle->stride = rsrc->image.layout.slices[0].line_stride; -- handle->offset = rsrc->image.layout.slices[0].offset; -- return true; -- } -+ handle->handle = fd; -+ handle->stride = rsrc->image.layout.slices[0].line_stride; -+ handle->offset = rsrc->image.layout.slices[0].offset; -+ return true; - } - - return false; --- -GitLab - - -From 43b5b452e23243ee178e6fd3c3f5b02fa1dabd71 Mon Sep 17 00:00:00 2001 -From: Alyssa Rosenzweig -Date: Tue, 22 Feb 2022 11:30:05 -0500 -Subject: [PATCH 2/2] panfrost: Simplify panfrost_resource_get_handle - -Unify the exit paths to clean up the logic. There are logically three modes we -support (KMS without renderonly, KMS with renderonly, and FD); these each -correspond to a leg of a small if statement. Outside of the small if's, -everything else should be identical. - -Signed-off-by: Alyssa Rosenzweig -Reviewed-by: Simon Ser -Reviewed-by: James Jones -Acked-by: Daniel Stone ---- - src/gallium/drivers/panfrost/pan_resource.c | 23 ++++++++------------- - 1 file changed, 9 insertions(+), 14 deletions(-) - -diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c -index 094332862ff..477bf1d7ce1 100644 ---- a/src/gallium/drivers/panfrost/pan_resource.c -+++ b/src/gallium/drivers/panfrost/pan_resource.c -@@ -153,17 +153,10 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen, - handle->modifier = rsrc->image.layout.modifier; - rsrc->modifier_constant = true; - -- if (handle->type == WINSYS_HANDLE_TYPE_SHARED) { -- return false; -+ if (handle->type == WINSYS_HANDLE_TYPE_KMS && dev->ro) { -+ return renderonly_get_handle(scanout, handle); - } else if (handle->type == WINSYS_HANDLE_TYPE_KMS) { -- if (dev->ro) { -- return renderonly_get_handle(scanout, handle); -- } else { -- handle->handle = rsrc->image.data.bo->gem_handle; -- handle->stride = rsrc->image.layout.slices[0].line_stride; -- handle->offset = rsrc->image.layout.slices[0].offset; -- return true; -- } -+ handle->handle = rsrc->image.data.bo->gem_handle; - } else if (handle->type == WINSYS_HANDLE_TYPE_FD) { - int fd = panfrost_bo_export(rsrc->image.data.bo); - -@@ -171,12 +164,14 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen, - return false; - - handle->handle = fd; -- handle->stride = rsrc->image.layout.slices[0].line_stride; -- handle->offset = rsrc->image.layout.slices[0].offset; -- return true; -+ } else { -+ /* Other handle types not supported */ -+ return false; - } - -- return false; -+ handle->stride = rsrc->image.layout.slices[0].line_stride; -+ handle->offset = rsrc->image.layout.slices[0].offset; -+ return true; - } - - static bool --- -GitLab - -- 2.44.0