What are the steps to run Wayland on 21.04 with optimus nVIDIA?

12,647

The settings I adapted are:

  • add to /etc/modprobe.d/nvidia-graphics-drivers.conf:

    options nvidia_drm modeset=1
    
  • ensure #WaylandEnable=false is commented in /etc/gdm3/custom.conf

  • comment all lines with # in /usr/lib/udev/rules.d/61-gdm.rules

  • reboot and select "Gnome" (not "Gnome on Xorg") with cogwheel in login screen

  • check (output should be wayland):

    echo $XDG_SESSION_TYPE
    

My experience with Wayland:

Matlab and VMWare Workstation Player complain about missing OpenGL hardware acceleration. But overall I am very happy with Wayland. No special tricks needed for many applications like Spotify and Matlab which previously did not scale in Xorg. With Wayland Matlab scales perfectly out of the box. Also resume from suspend to RAM now works for the first time on this laptop. Though it takes 1 minute 45 seconds from power button to lock screen. VLC full screen also works great, previously not possible in Xorg.

Waiting for NVIDIA 470 series to have OpenGL hardware acceleration.

Up to now I only have one issue: connecting an external monitor to the HDMI connector freezes Ubuntu completely. Nothing is shown on the external monitor and power button hard reset is the only option.

I made a post on the nVIDIA linux forum: https://forums.developer.nvidia.com/t/465-24-02-ubuntu-21-04-wayland-no-external-monitor/176747

[EDIT] I found out that the Intel GPU is driving the display and that is what most probably causes a successful resume from suspend to RAM. But nVIDIA can be used for CUDA calculations via Matlab and Mathematica and also via Jupyter Notebook and libcudnn8. So nVIDIA GPU is available but does not drive the screen and that is most probably why connecting an external monitor leads to Ubuntu freeze. Even though:

prime-select query
nvidia

Does anybody know how to let Ubuntu Gnome on Wayland choose the nVIDIA GPU to drive the laptop display?

Share:
12,647

Related videos on Youtube

BertRAMAerts
Author by

BertRAMAerts

Updated on September 18, 2022

Comments

  • BertRAMAerts
    BertRAMAerts over 1 year

    I have a Dell Inspiron 7577 laptop with nVIDIA GeForce GTX 1060 with max-Q design and integrated Intel GPU, running Ubuntu 21.04. It has a HiDPI screen 3840x2160 and I use fractional scaling at 175% with Gnome. nVIDIA driver is latest 465.24.02 from https://launchpad.net/~oem-solutions-group/+archive/ubuntu/nvidia-driver-staging?field.series_filter=hirsute

    What are the steps to run Wayland on 21.04 with optimus nVIDIA?

  • Bruni
    Bruni almost 3 years
    +1 but would like to see some explanations to the first part of your answer. (why are these settings necessary and what they do)
  • muru
    muru almost 3 years
    If you have follow-up questions, please post them as a new question instead of editing an answer
  • Parithy Sivakumar
    Parithy Sivakumar almost 3 years
    It doesn't seem to work in few cases. GDM3 launches into wayland but the display is still being driven by intel whereas on xorg session it is driven by nvidia. Strange
  • Brandon Miller
    Brandon Miller over 2 years
    This is essentially an alpha build of Wayland, and ubuntu is still using xwayland afaik. We're not going to see full functionality until first, waylwand figures out their security protocol to allow surfaces to communicate... Essentially we'll get another VNC... Second, xwayland just isn't going to cut it. It's good for now to give people a preview, but what is eventually going to happen is full integration, not interop. Nvidia has, though, said they are willing to support wayland.... We will see. The Vulkan community is also pretty active in getting their frameworks up and running with it.
  • Beto Neto
    Beto Neto over 2 years
    My GTX 1060 mobile also leads to Ubuntu freeze using 2 monitors and wayland. Also, after upgrade to 21.10 I got a white-screen after logon informing "something went wrong" and I wasn't able to logon using waylang (only gets to work setting the grub nvidia_drm modeset). Currently I'm using X11 :(