Running kwin wayland on Nvidia

Note: If you are visiting from the future please refer to the wiki here which will be more up-to-date than this blog post.


I recently switched to running wayland fulltime on all my machines, including my Nvidia box. It was good that I did as it seems Qt regressed, fortunately I was able to fix it just in time for the final Qt LTS.

I've also updated the wiki with the steps needed to run nvidia wayland whilst I had the information fresh.

Steps

Pre-requisites

You need a very up-to-date Qt. Make sure you have >= Qt5.15.0 or 4bd13402f0293e85b8dfdf92254e250ac28094c7 cherry-picked.

Mode setting

Check our driver is running in modesettings mode

cat /sys/module/nvidia_drm/parameters/modeset

It should print "Y"

If not, modify your kernel command line and add the line nvidia-drm.modeset=1. Search for "kernel parameters" in your distribution's documentation. Though https://wiki.archlinux.org/index.php/Kernel_parameters is typically a good guide for any distro.

Tell kwin to run with EGLStreams.

You should set the environment variable "KWIN_DRM_USE_EGL_STREAMS=1"

The easiest place is to add a file /etc/profile.d/kwin.sh with the line
export KWIN_DRM_USE_EGL_STREAMS=1

Verify this is working with the command line tool env after rebooting.

Login

Select "Plasma (wayland)" from your login manager
Enjoy your beautiful super-fast accelerated wayland desktop!

That's a lot of steps!

Obviously this number of manual steps is unnacceptable and I hope to reduce this over the next Plasma cycle.

With the user telemetry we get from Plasma users, we know a sizable amount of X11 users run the proprietory nvidia wayland driver. Ultimately user experience comes first above all else, so it is important.

Clearing up some facts on Nvidia and wayland

I read a lot of misinformation that on the wayland nvidia situation on the social medias. I'll try and clarfify some bits.

  • You cannot say "Nvidia doesn't support wayland". This doesn't make any sense. There's no relevant part of wayland for it to support or not support.

  • You can say "Nvidia doesn't support GBM" . A system for passing buffers (window contents) between places. Despite the name "Generic" Buffer Manager, GBM is very closely tied to Mesa. Mesa is the base of effectively all the open source Linux drivers.


  • You cannot say "Nvidia doesn't follow /the/ standard". There are a few. EGLStreams actually is a fully defined open standard defined in Khronos, which is as much of a core extension as possible. It's used by multiple vendors, albeit mostly horrible Mali chips

  • You can say it would be better if there was just one magic implementation that compositors and toolkits had to support. Maybe Vulkan (or more specifically WSI) will fix it 🙂


  • You cannot say that the experience of using wayland apps is worse on wayland. Practically it's just as fast, accelerated with all the shiny effects.

  • You can say that the experience of using GL X11 apps on wayland is worse. As XWayland doesn't have EGLStream support data gets copied the slow way. If you're playing an X game or doing some Blender work this is noticable.


  • You cannot say that KDE devs won't fix it. As this post starts with me literally fixing a toolkit when it came up!

  • You can say that Nvidia wayland experience has fewer testers. Though like all things wayland this is something you can help with! Get involved, file bugs, come join us on #kwin on Freenode. Start your kwin wayland hacking journey!

5 thoughts on “Running kwin wayland on Nvidia”

  1. Almost worked :'(

    On previous attempts to run plasma wayland session, my laptop would freeze. Now it doesn’t freeze, and I can see a broken screen (wallpaper not showing, but a prompt window looks fine). Mouse works, keyboard does not. Menus don’t show, so that’s as far as I can get.
    Damn it, it looked like it was going to work :/

  2. Thanks for this blog post. Having experienced just a black screen when trying to start a Wayland KDE session on my NVIDIA machine, this will definitely come handy for setting it up.

    I smiled when I read “That’s a lot of steps!”. Basically it are only two (2) steps. However I agree that it should “just run” without manual interaction ideally.

    “I hope to reduce this over the next Plasma cycle” – Do you happen to have any links to bug reports or Phabricator tasks to follow the progress on that?

  3. I needed to put “export KWIN_DRM_USE_EGL_STREAMS=1” in ~/.config/plasma-workspace/env/kwin.sh

    /etc/profiles.d/env/kwin.sh didn’t load the variable
    ~/.bashrc loaded the variable but perhaps not soon enough as I still experienced extreme lag

    KDE is looking great under Wayland now

    I’m not sure how I feel about Nvidia, it’s easy to fall into defending or hating them based on whether you own one of their cards. I personally feel that they could do more; as the biggest player in the industry, they could at least be as helpful as the smaller guys.

  4. For what it’s worth, I’ve never seen EGLStreams implemented in a Mali device (apart from a derivative version which only shipped in a very particular non-consumer SoC SDK), but the Mali proprietary driver does implement GBM, and has done for some years.

  5. Hi
    I presume it’s a prerequisite to run under Nvidia driver? Or nouveau can be used?
    I’m currently running nouveau and tried Wayland session but all I got was a blank screen… Although, mouse pointer was moving 🙂
    Can anyone be a little bit of enlightening?

Leave a Reply

Your email address will not be published. Required fields are marked *