1+ SUBSYSTEM!="pci", GOTO="gdm_pci_device_end"
2+ ACTION!="bind", ACTION!="add", GOTO="gdm_pci_device_end"
3+
4+ # cirrus
5+ ATTR{vendor}=="0x1013", ATTR{device}=="0x00b8", ATTR{subsystem_vendor}=="0x1af4", ATTR{subsystem_device}=="0x1100", RUN+="/usr/bin/touch /run/udev/gdm-machine-has-virtual-gpu", ENV{GDM_MACHINE_HAS_VIRTUAL_GPU}="1", GOTO="gdm_pci_device_end"
6+ # virtio
7+ ATTR{vendor}=="0x1af4", ATTR{device}=="0x1050", ATTR{subsystem_vendor}=="0x1af4", ATTR{subsystem_device}=="0x1100", RUN+="/usr/bin/touch /run/udev/gdm-machine-has-virtual-gpu", ENV{GDM_MACHINE_HAS_VIRTUAL_GPU}="1", GOTO="gdm_pci_device_end"
8+ # qxl
9+ ATTR{vendor}=="0x1b36", ATTR{device}=="0x0100", RUN+="/usr/bin/touch /run/udev/gdm-machine-has-virtual-gpu", ENV{GDM_MACHINE_HAS_VIRTUAL_GPU}="1", GOTO="gdm_pci_device_end"
10+ # vga
11+ ATTR{vendor}=="0x1234", ATTR{device}=="0x1111", RUN+="/usr/bin/touch /run/udev/gdm-machine-has-virtual-gpu", ENV{GDM_MACHINE_HAS_VIRTUAL_GPU}="1", GOTO="gdm_pci_device_end"
12+
13+ # disable Wayland on Hi1710 chipsets
14+ ATTR{vendor}=="0x19e5", ATTR{device}=="0x1711", GOTO="gdm_disable_wayland"
15+
16+ LABEL="gdm_pci_device_end"
17+
18+ # (vos) commented: IMPORT{cmdline}="nomodeset", GOTO="gdm_disable_wayland"
19+ # disable Wayland if modesetting is disabled
20+ KERNEL!="card[0-9]*", GOTO="gdm_nomodeset_end"
21+ KERNEL=="card[0-9]-*", GOTO="gdm_nomodeset_end"
22+ SUBSYSTEM!="drm", GOTO="gdm_nomodeset_end"
23+ # but keep it enabled for simple framebuffer drivers
24+ DRIVERS=="simple-framebuffer", GOTO="gdm_nomodeset_end"
25+ IMPORT{parent}="GDM_MACHINE_HAS_VIRTUAL_GPU"
26+ ENV{GDM_MACHINE_HAS_VIRTUAL_GPU}!="1", RUN+="/usr/bin/touch /run/udev/gdm-machine-has-hardware-gpu"
27+ # IMPORT{cmdline}="nomodeset", GOTO="gdm_disable_wayland"
28+ LABEL="gdm_nomodeset_end"
29+
30+ # The vendor nvidia driver has multiple modules that need to be loaded before GDM can make an
31+ # informed choice on which way to proceed, so force GDM to wait until NVidia's modules are
32+ # loaded before starting up.
33+ KERNEL!="nvidia", GOTO="gdm_nvidia_end"
34+ SUBSYSTEM!="module", GOTO="gdm_nvidia_end"
35+ ACTION!="add", GOTO="gdm_nvidia_end"
36+ RUN+="/usr/bin/touch /run/udev/gdm-machine-has-vendor-nvidia-driver"
37+
38+ # Import nvidia kernel parameters
39+ 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\""
40+
41+ # Check if S0ix-based power management is available
42+ # If it is, there's no need to check for the suspend/resume services
43+ ENV{NVIDIA_ENABLE_S0IX_POWER_MANAGEMENT}=="1", GOTO="gdm_nvidia_suspend_end"
44+
45+ # Check if suspend/resume services necessary for working wayland support is available
46+ TEST{0711}!="/usr/bin/nvidia-sleep.sh", GOTO="gdm_disable_wayland"
47+ TEST{0711}!="/usr/lib/systemd/system-sleep/nvidia", GOTO="gdm_disable_wayland"
48+
49+ ENV{NVIDIA_PRESERVE_VIDEO_MEMORY_ALLOCATIONS}!="1", GOTO="gdm_disable_wayland"
50+ IMPORT{program}="/bin/sh -c 'echo NVIDIA_HIBERNATE=`systemctl is-enabled nvidia-hibernate`'"
51+ ENV{NVIDIA_HIBERNATE}!="enabled", GOTO="gdm_disable_wayland"
52+ IMPORT{program}="/bin/sh -c 'echo NVIDIA_RESUME=`systemctl is-enabled nvidia-resume`'"
53+ ENV{NVIDIA_RESUME}!="enabled", GOTO="gdm_disable_wayland"
54+ IMPORT{program}="/bin/sh -c 'echo NVIDIA_SUSPEND=`systemctl is-enabled nvidia-suspend`'"
55+ ENV{NVIDIA_SUSPEND}!="enabled", GOTO="gdm_disable_wayland"
56+ LABEL="gdm_nvidia_suspend_end"
57+ LABEL="gdm_nvidia_end"
58+
59+ # If this machine has an internal panel, take note, since it's probably a laptop
60+ # FIXME: It could be "ghost connectors" make this pop positive for some workstations
61+ # in the wild. If so, we may have to fallback to looking at the chassis type from
62+ # dmi data or acpi
63+ KERNEL!="card[0-9]-eDP-*", GOTO="gdm_laptop_check_end"
64+ SUBSYSTEM!="drm", GOTO="gdm_laptop_check_end"
65+ ACTION!="add", GOTO="gdm_laptop_check_end"
66+ RUN+="/usr/bin/touch /run/udev/gdm-machine-is-laptop"
67+ GOTO="gdm_hybrid_nvidia_laptop_check"
68+ LABEL="gdm_laptop_check_end"
69+
70+ # (vos) commented the whole block
71+ # If this is a hybrid graphics setup, take note
72+ # KERNEL!="card[1-9]*", GOTO="gdm_hybrid_graphics_check_end"
73+ # KERNEL=="card[1-9]-*", GOTO="gdm_hybrid_graphics_check_end"
74+ # SUBSYSTEM!="drm", GOTO="gdm_hybrid_graphics_check_end"
75+ # ACTION!="add", GOTO="gdm_hybrid_graphics_check_end"
76+ # IMPORT{program}="/bin/sh -c \"echo GDM_NUMBER_OF_GRAPHICS_CARDS=`ls -1d /sys/class/drm/card[0-9] | wc -l`\""
77+ # ENV{GDM_NUMBER_OF_GRAPHICS_CARDS}=="1", RUN+="/usr/bin/rm -f /run/udev/gdm-machine-has-hybrid-graphics"
78+ # ENV{GDM_NUMBER_OF_GRAPHICS_CARDS}!="1", RUN+="/usr/bin/touch /run/udev/gdm-machine-has-hybrid-graphics"
79+ # LABEL="gdm_hybrid_graphics_check_end"
80+
81+ # Disable wayland in situation where we're in a guest with a virtual gpu and host passthrough gpu
82+ LABEL="gdm_virt_passthrough_check"
83+ TEST!="/run/udev/gdm-machine-has-hybrid-graphics", GOTO="gdm_virt_passthrough_check_end"
84+ TEST!="/run/udev/gdm-machine-has-virtual-gpu", GOTO="gdm_virt_passthrough_check_end"
85+ TEST!="/run/udev/gdm-machine-has-hardware-gpu", GOTO="gdm_virt_passthrough_check_end"
86+ GOTO="gdm_disable_wayland"
87+ LABEL="gdm_virt_passthrough_check_end"
88+
89+ # Disable wayland when there are multiple virtual gpus
90+ LABEL="gdm_virt_multi_gpu_check"
91+ TEST!="/run/udev/gdm-machine-has-hybrid-graphics", GOTO="gdm_virt_multi_gpu_check_end"
92+ TEST!="/run/udev/gdm-machine-has-virtual-gpu", GOTO="gdm_virt_multi_gpu_check_end"
93+ TEST=="/run/udev/gdm-machine-has-hardware-gpu", GOTO="gdm_virt_multi_gpu_check_end"
94+ LABEL="gdm_virt_multi_gpu_check_end"
95+
96+ # Disable wayland when nvidia modeset is disabled
97+ KERNEL!="nvidia_drm", GOTO="gdm_nvidia_drm_end"
98+ SUBSYSTEM!="module", GOTO="gdm_nvidia_drm_end"
99+ ACTION!="add", GOTO="gdm_nvidia_drm_end"
100+ # disable wayland if nvidia-drm modeset is not enabled
101+ ATTR{parameters/modeset}!="Y", GOTO="gdm_disable_wayland"
102+ LABEL="gdm_nvidia_drm_end"
103+
104+ GOTO="gdm_end"
105+
106+ LABEL="gdm_prefer_xorg"
107+ RUN+="/usr/libexec/gdm-runtime-config set daemon PreferredDisplayServer xorg"
108+ GOTO="gdm_end"
109+
110+ LABEL="gdm_disable_wayland"
111+ RUN+="/usr/libexec/gdm-runtime-config set daemon WaylandEnable false"
112+ GOTO="gdm_end"
113+
114+ LABEL="gdm_end"
0 commit comments