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!

9 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?

    1. I have just tried it on my machine with Nvidia GPU. Seems to work and I am writing this comment from Wayland.

      Unfortunately the session is rather unstable (changing monitor settings does not always apply them correctly; crashes when changing global theme etc.), possibly related to the Nvidia setup. So I’ll probably stay with X11 for now on that machine.

  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?

  6. so nvidia rtx 2070 drivers for opensuse tumbleweed that 06 drivers seem to have ghosting happening in wayland when you select anything under its Application Launcher, with the nvidia proparty drivers , how do I fix this problem I tried opensuse MicoOS had the nvidia drivers working next thing I knew the drivers got disabled on their own not sure if it was a system update, but under tumbleweed they seem to work fine in X11 but the wayland mode is getting buggy , I don’t think its a problem with fedora 38 nvidia drivers this problem seems to be only related to the opensuse drivers installed with
    https://en.opensuse.org/SDB:NVIDIA_drivers this page, I have secure boot on with opensuse tumbleweed, so I did that pages installed info, is the info not correct or does it need some updated info?

  7. https://en.opensuse.org/SDB:NVIDIA_the_hard_way

    I think this is the problem but I am not sure?
    I had to add to things that were not installed

    sudo zypper install nvidia-utils-G06

    sudo zypper install xrefresh

    but the command comes back with this message

    ERROR: Error resolving target specification ” (No targets match target specification), specified in
    assignment ‘CurrentMetaMode=nvidia-auto-select +0+0 { ForceCompositionPipeline = }’.

    Tearing

    One solution for persistent tearing is:

    nvidia-settings -> x server display configuration -> advanced -> force composition pipeline

    Warning: Saving this to /etc/X11/xorg.conf via the nvidia-settings GUI might adversely affect loading your desktop.

    Alternatively, a simple script can be used to turn it on from the command line. For example:

    Create /home//bin/fcp

    nvidia-settings –assign CurrentMetaMode=”nvidia-auto-select +0+0 { ForceCompositionPipeline = $1 }”
    xrefresh

    Make it executable:

    chmod +x /home//bin/fcp

    Turn it on:

    fcp 1

    Turn it off:

    fcp 0

    xrefresh can be installed via zypper. It might be needed to avoid a blank screen.

    Ctrl+Alt+F1 then Ctrl+Alt+F7 can also help in that situation.

  8. monitor is GIGA-BYTE TECHNOLOGY, LTD. M28U (3840×2160@150%) in plasma if that info helps, again the my gigabyte desktop I have running linux has an nvidia rtx 2070 3D card, and I am getting what seems like tearing when moving from one icon to others icons with mouse in the Application Launcher in opensuse Tumbleweed again I didn’t notice these problems with MicroOS just tumbleweed, I was once able to get the drivers working under opensuse MicroOS but that snap and snap-store was not working for it, which can work under tumbleweed, I know that theres also flathub and flatpack that work in both, but if snap doesn’t work I fingure there might be other titles of software not working yet under MicroOS or will never work under it because of how that software works, again I think when it did the automatic updates, it might of broke the nvidia drivers I had installed using https://en.opensuse.org/SDB:NVIDIA_drivers pages info for MicroOS, if that page is outdated can you email me a updated page, I used the terminal in order to make it work under both, I also have some expectience with ubuntu, kubuntu and debian based linux, and I used arch linux, but with secure boot on only a few distro’s work out of the box for it.

Leave a Reply

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