summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2021-09-08 19:22:23 +0200
committerRay Strode <halfline@gmail.com>2021-09-22 18:18:43 +0000
commite29606c4b63452e851b02da86b1c71f585aa6200 (patch)
treeb110fd7ff71a048c44fb50c892392e11f8b5be89 /data
parent536491641156ba88beab2c881278b09e52df6813 (diff)
downloadgdm-e29606c4b63452e851b02da86b1c71f585aa6200.tar.gz
gdm.rules: Keep wayland enabled in all nvidia configurations allowing it
Nvidia drivers since version 470 supports both native wayland and accelerated Xwayland. The latter also works in hybrid configurations using nvidia Optimus (the session will run using the main integrated GPU, but it will be possible to use switcherooctl to run applications using the discrete nvidia card). However, the gdm rules were including a line that was supposed to disable such scenario, but it didn't actually work as expected, so we can safely remove it, without changing the behavior. At the same time we can tune the rules so that, when the nvidia-drm module is loaded, if the driver version is minor than 470, wayland is disabled.
Diffstat (limited to 'data')
-rw-r--r--data/61-gdm.rules.in35
1 files changed, 27 insertions, 8 deletions
diff --git a/data/61-gdm.rules.in b/data/61-gdm.rules.in
index 8566bf55..1156f0d3 100644
--- a/data/61-gdm.rules.in
+++ b/data/61-gdm.rules.in
@@ -1,10 +1,29 @@
# disable Wayland on Hi1710 chipsets
-ATTR{vendor}=="0x19e5", ATTR{device}=="0x1711", RUN+="@libexecdir@/gdm-runtime-config set daemon WaylandEnable false"
-# disable Wayland on hybrid systems with vendor nvidia driver
-# default to Xorg on single gpu vendor nvidia systems
-DRIVER=="nvidia", ENV{GDM_HAS_VENDOR_NVIDIA_DRIVER}="1"
-DRIVER=="nvidia", RUN+="@libexecdir@/gdm-runtime-config set daemon PreferredDisplayServer xorg"
-SUBSYSTEM=="drm", KERNEL=="card[1-9]*", ENV{GDM_HAS_NVIDIA_DRIVER}=="1", RUN+="@libexecdir@/gdm-runtime-config set daemon WaylandEnable false"
-ACTION=="add", SUBSYSTEM=="module", KERNEL=="nvidia_drm", ATTR{parameters/modeset}=="N", RUN+="@libexecdir@/gdm-runtime-config set daemon WaylandEnable false"
+ATTR{vendor}=="0x19e5", ATTR{device}=="0x1711", GOTO="gdm_disable_wayland"
+
# disable Wayland if modesetting is disabled
-IMPORT{cmdline}="nomodeset", RUN+="@libexecdir@/gdm-runtime-config set daemon WaylandEnable false"
+IMPORT{cmdline}="nomodeset", SUBSYSTEM=="drm", KERNEL=="card[0-9]*", GOTO="gdm_disable_wayland"
+
+# Disable wayland when nvidia modeset is disabled or when drivers are a lower
+# version than 470, in any case always prefer Xorg
+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"
+GOTO="gdm_prefer_xorg"
+LABEL="gdm_nvidia_drm_end"
+
+GOTO="gdm_end"
+
+LABEL="gdm_prefer_xorg"
+RUN+="@libexecdir@/gdm-runtime-config set daemon PreferredDisplayServer xorg"
+GOTO="gdm_end"
+
+LABEL="gdm_disable_wayland"
+RUN+="@libexecdir@/gdm-runtime-config set daemon WaylandEnable false"
+GOTO="gdm_end"
+
+LABEL="gdm_end"