gdm/0001-udev-Stick-with-wayland-on-hybrid-nvidia-with-vendor.patch

93 lines
4.6 KiB
Diff
Raw Normal View History

From 5d363136eccb0c00368112e1856bb37ed26c6b16 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 27 Sep 2022 10:00:11 -0400
Subject: [PATCH] udev: Stick with wayland on hybrid nvidia with vendor driver
F36 defaulted to wayland for users with hybrid graphics that
use the vendor nvidia driver.
We shouldn't change behavior so close to f37 release, so this
commit brings that behavior back.
---
data/61-gdm.rules.in | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/data/61-gdm.rules.in b/data/61-gdm.rules.in
index 5bc9941..d13f0b8 100644
--- a/data/61-gdm.rules.in
+++ b/data/61-gdm.rules.in
@@ -57,66 +57,68 @@ TEST{0711}!="/usr/bin/nvidia-sleep.sh", GOTO="gdm_disable_wayland"
TEST{0711}!="/usr/lib/systemd/system-sleep/nvidia", GOTO="gdm_disable_wayland"
IMPORT{program}="/bin/sh -c \"sed -e 's/: /=/g' -e 's/\([^[:upper:]]\)\([[:upper:]]\)/\1_\2/g' -e 's/[[:lower:]]/\U&/g' -e 's/^/NVIDIA_/' /proc/driver/nvidia/params\""
ENV{NVIDIA_PRESERVE_VIDEO_MEMORY_ALLOCATIONS}!="1", GOTO="gdm_disable_wayland"
IMPORT{program}="/bin/sh -c 'echo NVIDIA_HIBERNATE=`systemctl is-enabled nvidia-hibernate`'"
ENV{NVIDIA_HIBERNATE}!="enabled", GOTO="gdm_disable_wayland"
IMPORT{program}="/bin/sh -c 'echo NVIDIA_RESUME=`systemctl is-enabled nvidia-resume`'"
ENV{NVIDIA_RESUME}!="enabled", GOTO="gdm_disable_wayland"
IMPORT{program}="/bin/sh -c 'echo NVIDIA_SUSPEND=`systemctl is-enabled nvidia-suspend`'"
ENV{NVIDIA_SUSPEND}!="enabled", GOTO="gdm_disable_wayland"
LABEL="gdm_nvidia_end"
# If this machine has an internal panel, take note, since it's probably a laptop
# FIXME: It could be "ghost connectors" make this pop positive for some workstations
# in the wild. If so, we may have to fallback to looking at the chassis type from
# dmi data or acpi
KERNEL!="card[0-9]-eDP-*", GOTO="gdm_laptop_check_end"
SUBSYSTEM!="drm", GOTO="gdm_laptop_check_end"
ACTION!="add", GOTO="gdm_laptop_check_end"
RUN+="/usr/bin/touch /run/udev/gdm-machine-is-laptop"
GOTO="gdm_hybrid_nvidia_laptop_check"
LABEL="gdm_laptop_check_end"
# If this is a hybrid graphics setup, take note
KERNEL!="card[1-9]*", GOTO="gdm_hybrid_graphics_check_end"
KERNEL=="card[1-9]-*", GOTO="gdm_hybrid_graphics_check_end"
SUBSYSTEM!="drm", GOTO="gdm_hybrid_graphics_check_end"
ACTION!="add", GOTO="gdm_hybrid_graphics_check_end"
RUN+="/usr/bin/touch /run/udev/gdm-machine-has-hybrid-graphics"
LABEL="gdm_hybrid_graphics_check_end"
-# If this is a hybrid graphics laptop with vendor nvidia driver, disable wayland
+# If this is a hybrid graphics laptop with vendor nvidia driver default to wayland
+# It gives poor performance for multi-monitor, but Xorg fails some multi-monitor
+# setups too, and this is what we did in F36.
LABEL="gdm_hybrid_nvidia_laptop_check"
TEST!="/run/udev/gdm-machine-is-laptop", GOTO="gdm_hybrid_nvidia_laptop_check_end"
TEST!="/run/udev/gdm-machine-has-hybrid-graphics", GOTO="gdm_hybrid_nvidia_laptop_check_end"
TEST!="/run/udev/gdm-machine-has-vendor-nvidia-driver", GOTO="gdm_hybrid_nvidia_laptop_check_end"
-GOTO="gdm_disable_wayland"
+GOTO="gdm_end"
LABEL="gdm_hybrid_nvidia_laptop_check_end"
# Disable wayland in situation where we're in a guest with a virtual gpu and host passthrough gpu
LABEL="gdm_virt_passthrough_check"
TEST!="/run/udev/gdm-machine-has-hybrid-graphics", GOTO="gdm_virt_passthrough_check_end"
TEST!="/run/udev/gdm-machine-has-virtual-gpu", GOTO="gdm_virt_passthrough_check_end"
TEST!="/run/udev/gdm-machine-has-hardware-gpu", GOTO="gdm_virt_passthrough_check_end"
GOTO="gdm_disable_wayland"
LABEL="gdm_virt_passthrough_check_end"
# Disable wayland when there are multiple virtual gpus
LABEL="gdm_virt_multi_gpu_check"
TEST!="/run/udev/gdm-machine-has-hybrid-graphics", GOTO="gdm_virt_multi_gpu_check_end"
TEST!="/run/udev/gdm-machine-has-virtual-gpu", GOTO="gdm_virt_multi_gpu_check_end"
TEST=="/run/udev/gdm-machine-has-hardware-gpu", GOTO="gdm_virt_multi_gpu_check_end"
LABEL="gdm_virt_multi_gpu_check_end"
# Disable wayland when nvidia modeset is disabled or when drivers are a lower
# version than 470,
# For versions above 470 but lower than 510 prefer Xorg,
# Above 510, prefer Wayland.
KERNEL!="nvidia_drm", GOTO="gdm_nvidia_drm_end"
SUBSYSTEM!="module", GOTO="gdm_nvidia_drm_end"
ACTION!="add", GOTO="gdm_nvidia_drm_end"
# disable wayland if nvidia-drm modeset is not enabled
ATTR{parameters/modeset}!="Y", GOTO="gdm_disable_wayland"
# disable wayland for nvidia drivers versions lower than 470
ATTR{version}=="4[0-6][0-9].*|[0-3][0-9][0-9].*|[0-9][0-9].*|[0-9].*", GOTO="gdm_disable_wayland"
# For nvidia drivers versions Above 510, keep Wayland by default
ATTR{version}=="[5-9][1-9][0-9].*", GOTO="gdm_end"
--
2.35.1