Blob Blame History Raw
From cc376327163a2c75487b07fa26880bf7a3b080fa Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 27 Sep 2022 09:04:54 -0400
Subject: [PATCH] udev: Allow wayland on hybrid vendor nvidia machines

We currently disable wayland on machines with the vendor
nvidia driver upstream if hybrid graphics are in place because there
is poor performance for multimonitor use cases.

But springing that change on users in F37 this late in the game
isn't nice, so instead default to Xorg and provide wayland as an
option in the menu.

https://bugzilla.redhat.com/show_bug.cgi?id=2128910
---
 data/61-gdm.rules.in | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/data/61-gdm.rules.in b/data/61-gdm.rules.in
index 5bc9941..7e17be0 100644
--- a/data/61-gdm.rules.in
+++ b/data/61-gdm.rules.in
@@ -57,66 +57,67 @@ 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, prefer xorg since
+# multimonitor has very poor performance
 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_prefer_xorg"
 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