[gdm/disable-hybrid-nvidia: 1/5] data: Disable GDM on hybrid graphics laptops with vendor NVidia driver




commit 3c743105026e55e53e9a7a586e101ce8f419aa24
Author: Ray Strode <rstrode redhat com>
Date:   Tue Feb 15 08:36:28 2022 -0500

    data: Disable GDM on hybrid graphics laptops with vendor NVidia driver
    
    We really don't want wayland on hybrid graphics laptops, because
    certain connectors won't work right now.
    
    This commit tries to detect the case and disable it.

 data/61-gdm.rules.in | 49 +++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 45 insertions(+), 4 deletions(-)
---
diff --git a/data/61-gdm.rules.in b/data/61-gdm.rules.in
index e9c726977..d087746f6 100644
--- a/data/61-gdm.rules.in
+++ b/data/61-gdm.rules.in
@@ -9,6 +9,42 @@ DRIVERS=="simple-framebuffer", GOTO="gdm_nomodeset_end"
 IMPORT{cmdline}="nomodeset", GOTO="gdm_disable_wayland"
 LABEL="gdm_nomodeset_end"
 
+# The vendor nvidia driver has multiple modules that need to be loaded before GDM can make an
+# informed choice on which way to proceed, so force GDM to wait until NVidia's modules are
+# loaded before starting up.
+KERNEL!="nvidia", GOTO="gdm_nvidia_end"
+SUBSYSTEM!="module", GOTO="gdm_nvidia_end"
+ACTION!="add", GOTO="gdm_nvidia_end"
+RUN+="/usr/bin/touch /run/udev/gdm-waiting-on-udev"
+RUN+="/usr/bin/touch /run/udev/gdm-machine-has-vendor-nvidia-driver"
+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"
+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
+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"
+LABEL="gdm_hybrid_nvidia_laptop_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,
@@ -21,7 +57,7 @@ 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"
+ATTR{version}=="[5-9][1-9][0-9].*", GOTO="gdm_stop_waiting_on_udev"
 # For nvidia drivers versions 470-495, prefer Xorg by default
 GOTO="gdm_prefer_xorg"
 LABEL="gdm_nvidia_drm_end"
@@ -29,11 +65,16 @@ LABEL="gdm_nvidia_drm_end"
 GOTO="gdm_end"
 
 LABEL="gdm_prefer_xorg"
-RUN+="@libexecdir@/gdm-runtime-config set daemon PreferredDisplayServer xorg"
-GOTO="gdm_end"
+RUN+="/usr/libexec/gdm-runtime-config set daemon PreferredDisplayServer xorg"
+GOTO="gdm_stop_waiting_on_udev"
 
 LABEL="gdm_disable_wayland"
-RUN+="@libexecdir@/gdm-runtime-config set daemon WaylandEnable false"
+RUN+="/usr/libexec/gdm-runtime-config set daemon WaylandEnable false"
+GOTO="gdm_stop_waiting_on_udev"
+
+LABEL="gdm_stop_waiting_on_udev"
+RUN+="/usr/bin/rm -f /run/udev/gdm-waiting-on-udev"
 GOTO="gdm_end"
 
 LABEL="gdm_end"
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]