Enable wayland Gnome/GDM with Nvidia and make gestures+suspend work

Goal:
My mission was to enable wayland (or xwayland?) on Nvidia, more specifically allow to choose between xorg and wayland on GDM at login, and make that settings wheel appear in the lower right corner at login. I skimmed our forum, the arch wiki and arch forum. I managed to make it work, but also realize I was way over my head with some of these commands. Suggestions, changes, explanations welcome :grin:

Reasoning:
I just installed gnome on my Lenovo thinkpad P1. This comes with hybrid intel/nvidia. This time around I decided to disable hybrid in bios, and only run the dedicated GPU. Downside is that Gnome runs xorg by default with my Nvidia card. Then all the gestures were disabled. I tried running touchegg plus gesture extension on xorg but the experience was not great, actually pretty bad. Once wayland is enabled, gestures now work beautifully.

My hardware infos
$ inxi -Fxxi
System:
  Host: topaz Kernel: 5.15.67-1-lts arch: x86_64 bits: 64 compiler: gcc
    v: 12.2.0 Desktop: GNOME v: 42.4 tk: GTK v: 3.24.34 wm: gnome-shell dm: GDM
    Distro: EndeavourOS base: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 20QT005CUS v: ThinkPad P1 Gen 2
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: LENOVO model: 20QT005CUS v: SDK0T08861 WIN
    serial: <superuser required> UEFI: LENOVO v: N2OET57W (1.44 )
    date: 08/08/2022
Battery:
  ID-1: BAT0 charge: 42.2 Wh (58.4%) condition: 72.3/80.4 Wh (89.9%)
    volts: 15.0 min: 15.4 model: Celxpert 5B10W13953 serial: 1707
    status: discharging
CPU:
  Info: 8-core model: Intel Core i9-9880H bits: 64 type: MT MCP
    arch: Coffee Lake level: v3 rev: D cache: L1: 512 KiB L2: 2 MiB L3: 16 MiB
  Speed (MHz): avg: 800 min/max: 800/4800 cores: 1: 800 2: 800 3: 800
    4: 800 5: 800 6: 800 7: 800 8: 800 9: 800 10: 800 11: 800 12: 800 13: 800
    14: 800 15: 800 16: 800 bogomips: 73598
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
  Device-1: NVIDIA TU117GLM [Quadro T2000 Mobile / Max-Q] vendor: Lenovo
    driver: nvidia v: 515.65.01 arch: Turing pcie: speed: 2.5 GT/s lanes: 16
    ports: active: none off: eDP-1 empty: DP-1,DP-2,HDMI-A-1 bus-ID: 01:00.0
    chip-ID: 10de:1fb8
  Device-2: Chicony Integrated Camera type: USB driver: uvcvideo
    bus-ID: 1-8:2 chip-ID: 04f2:b67c
  Display: wayland server: X.org v: 1.21.1.4 with: Xwayland v: 22.1.3
    compositor: gnome-shell driver: X: loaded: nvidia unloaded: modesetting
    alternate: fbdev,nouveau,nv,vesa gpu: nvidia,nvidia-nvswitch
    display-ID: 0
  Monitor-1: eDP-1 model: BOE Display 0x0809 res: 3840x2160 dpi: 279
    diag: 398mm (15.7")
  OpenGL: renderer: Quadro T2000/PCIe/SSE2 v: 4.6.0 NVIDIA 515.65.01
    direct render: Yes

Solution:

  1. Disable hybrid in bios (thats just for me to only use dedicated gpu…)
  1. Edit grub and check that nvidia_drm.modeset=1 is added as kernel parameter. In EOS it seems it is added as default currently, nice!

  2. To force-enable Wayland, override udev rules

ln -s /dev/null /etc/udev/rules.d/61-gdm.rules
  1. (NEW) Preserve video memory after suspend, this avoids glitches after suspend…
sudo nano /etc/modprobe.d/nvidia-power-management.conf

edit file and save

options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/path/to/tmp-nvidia

enable nvidia-resume and nvidia-resume (please read reference below)

sudo systemctl enable nvidia-resume.service
sudo systemctl enable nvidia-suspend.service

Reading source:

That’s it, enjoy!

points 4-5 redundant (old, doesn't work)

4. Add a pacman hook for nvidia (is that necessary?)

sudo nano /etc/pacman.d/hooks/nvidia.hook

edit file and save

[Trigger]
Operation=Install
Operation=Upgrade
Operation=Remove
Type=Package
Target=nvidia

[Action]
Description=Update Nvidia module in initcpio
Depends=mkinitcpio
When=PostTransaction
Exec=/usr/bin/mkinitcpio -P

5. invoke automatically nvidia modprobe (is that necessary?)

sudo nano /etc/udev/rules.d/70-nvidia.rules

edit file and save

ACTION=="add", DEVPATH=="/bus/pci/drivers/nvidia", RUN+="/usr/bin/nvidia-modprobe -c0 -u"

~~ points 4) to 6) taken from https://bbs.archlinux.org/viewtopic.php?id=275184 ~~

Points 4 to 6 are not generally needed and will cause more issues than they solve.

Also read the note on the Arch wiki page:

Thanks for the feedback! I read the wiki, but the note is one of these things were I can’t follow anymore with multiple links and definitions. I will need to spend a bit more time. However, 2) and 3) seem to make it work properly. The wiki says that newer Nvidia should not block Wayland, so strange that it does it for my hardware. Since it is newer with Nvidia 515, I assume it should not block it. Unless eos install ads a rule somewhere to make Nvidia hybrid work, but I doubt it.

From my and your links above…

“As of GDM 42 and NVIDIA driver 510, GDM defaults to Wayland. For older NVIDIA drivers (in between version 470 and 510), GDM has chipset-dependent udev rules to use Xorg rather than Wayland. To force-enable Wayland, override these rules by creating the following symlink:”

I am also wondering what this does exactly…

It overrides /usr/share/udev/rules.d/61-gdm.rules with an empty version, so no rules (blocking Wayland) are applied.

1 Like

I run into some major graphic glitches after suspend. Trying to find more infos on the Arch wiki, added a new point 4 in progress from what I found so far…

Yup, point 4 should deal with that.

Ok it works!

1 Like