Starting a full KDE Plasma session in Wayland

This week there will be the release of KDE SC 4.11 Beta 1 and this will come with an interesting new feature: an experimental Wayland backend inside KWin. This backend does not allow to manage Wayland clients, but uses another Wayland compositor as the rendering target. Instead of rendering to an X window, KWin renders to a Wayland surface. From an architecture point of view this means that there is a Wayland system compositor and KWin is running as a Wayland session compositor (although KWin is not yet a Wayland compositor).

Disclaimer: this is a highly experimental feature and not intended for productive usage. Please do not report any bug reports in the bug tracker. If you find an issue please open your editor, hack and submit a review request.

Now I expect that you are also excited about Wayland and that you want to run your KDE Plasma session on top of Wayland instead of X, right? So here are the instructions: First of all you need to change the “Tearing Prevention (VSync)” in KWin’s Advanced desktop effects settings to “Full scene repaints”. This is needed because KWin does not yet support the buffer-age extension needed to properly repaint in Wayland. Note: when using X11 you probably don’t want to use this option, it wastes quite some power.

The KDE Plasma session startup is controlled by a script called “startkde”. In order to start the KDE Plasma session with Wayland we also need this script, but need to have a few environment variables set to tell KWin that it should use Wayland. So best copy this script and call it” startkde-wayland”. Edit this file and add the following exports after the shebang:

export DISPLAY=:99
export WAYLAND_DISPLAY=wayland-system-0
export KWIN_OPENGL_INTERFACE=egl_wayland

Now all we need is another small shell script to start Wayland, Xvfb and the modified startkde script. Let’s call it kwayland:

#!/bin/sh
weston-launch -- --socket=wayland-system-0 &
Xvfb -screen 0 1366x768x24 :99 &
startkde-wayland &

Please change the screen resolution to the one used by your screen. KWin is not yet able to update the resolution of the X server to what Weston uses. This also means that you cannot change the resolution or add multiple screens (as I said: it’s an experimental feature).

Now log out of your running KDE session, switch to a tty and stop the still running X server. With X out of the way you can start the kwayland script. You should see Weston starting and shortly afterwards KWin should take over. If everything is configured correctly you should see the normal splash screen (seems like my system is not configured correctly).

Once the system is fully started you can just use it. If everything works fine, you should not even notice any difference, though there are still limitations, like only the three mouse buttons of my touchpad are supported 😉 I would post a screenshot but it’s fairly uninteresting as one cannot see a difference.

This blog post was written in a KDE Plasma session running in Wayland.

26 Replies to “Starting a full KDE Plasma session in Wayland”

    1. I have not yet done any proper benchmarking. It’s also very difficult to say as in the end you are comparing apples with oranges.

      1. I’m not interested in 59 fps vs 61 fps comparisons. I’m more interested on usability: is wayland fast enough as X?

    1. I hope you understand that I cannot provide personalized support, so I’m giving a few general comments:

      • Ensure KWin is compiled with Wayland support
      • Ensure the OpenGL compositor in KWin is selected and working
      • Ensure to have Xvfb installed
  1. Did anyone manager to capture a screenshot or video of this in action? I’m interested to see it, but I currently don’t have any machines on which I could try this.

  2. I must admit that I’m quite confused by this.. What is done by KWin and what is done by Weston whether XWayland is used here or not..
    For example Weston doesn’t have ‘closing window’ protocol, but does-it matter here? I think no because Weston is only the system compositor here, is-it correct?
    What about the application showed here, how do they communicate with KWin? Using X no? or Wayland?

    1. XWayland is not used. Weston is just used to get input events and to render to. As communication with windows X11 is used. As written in the post: we don’t support Wayland clients yet.

  3. “Now I expect that you are also excited about Wayland and that you want to run your KDE Plasma session on top of Wayland instead of X, right?”

    Yes!

    Now we need something like KDE/Wayland session user can select before login in the session that will complement/compete with Unity (mobile)/Mir session probably available by the end of the year.

  4. “Regarding performance, are there differencies between X and Wayland with Kwin?”

    It’s too early in my opinion to do real use case testing on larger scale but one experience i had with RebeccaBlackOS playing windowed HD video on Intel laptop… The thing didn’t tear regardless of what i trowed at it or by moving media player window around the screen. I could produce tearing on X.org easily.

    That impressed me quite a bit for sure and i wondered why exactly isn’t this stuff available to wider audience ATM!

    1. I had the same experience when I saw krh demoing video playback. My only comment was “it doesn’t tear”.

  5. Thanks for sharing these instructions with us. It is great to have the possibility to see some initial results of your hard work.

    Just a quick question. Is it normal that glxinfo reports “OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.2, 256 bits)”, i.e., the “classic” intel i965 mesa driver is not used? I am on Intel Ivybridge HD 4000.

    Thanks a lot in advance.

    1. Yeah, glx is not supported on xvfb. I hadn’t noticed yet when I posted that blog post as I used egl/Wayland for KWin. We’ll need XWayland to get that properly working.

Comments are closed.