Why You Should Use Wayland

The Case for the Wayland Desktop

Wayland is a display server protocol that serves as a replacement for the now 36 year old X windowing system that originally was used for drawing windows on UNIX operating systems. Its various implementations have evolved throughout the years with the current implementation being that of Xorg server. X’s age and sclerotic development has made the case stronger than ever for Wayland. It is far newer (initial release was 12 years ago) and it fixes a lot of the long standing architectural issues that plague X.

Architecture

Wayland is a more coherent protocol which is more integrated and streamlined than X. The most egregious issue with X in regard to its structure is that the most of the components are completely decoupled from one another.

xorg

This diagram show how Xorg server accepts input events. Most of the work is done through the evdev interface, which is handled in the kernel. Once this is done, however, it is sent to the Xorg server that processes the event. It must ascertain what window is affected by the event and send this information to X client (your desktop environment or window manager). The rendering request is then sent back to the server (because the server doesn’t know where the windows are located). The compositor is then sent information from the server containing the bounding region of the rendering. The compositor then recompiles the region, but must go through the server to do so. Finally, the server will then copy the compositor buffer by buffer and sent this to the Kernel Modesetting (KMS) API.

wayland

In wayland, the compositor, display server, and window manager are all one. The wasted intermediate steps have been eliminated; evdev and KMS are controlled directly by compositor and it can send the input events to the clients which in turn can send the damage event for re-rendering straight to the compositor. Furthermore, rendering is done directly with the GPU via the DRI interface.

Security

Wayland is considerably more secure than Xorg. For one, wayland doesn’t need to be ran as root. It also implements explicit application grab, which makes it harder to implement malicious software that read from input information like keyloggers. More broadly, windows don’t have the permission to position themselves or read context from other windows. Having less unmaintained legacy code reduces the attack surface as well.

Backwards Compatibility

Wayland has full backwards compatibility of legacy X applications via XWayland.

xwayland

Xwayland runs an instance of Xorg server under wayland, with wayland still managing the windows themselves. Do note that while using XWayland, all security benefits of wayland are rendered moot.

A Growing List of Compositors

It was once the case a mere few years ago that the only wayland compliant compositors were the GNOME and KDE desktop environments and the reference implementation (weston). Now, there are numerous compositors for those who want something more akin to light weight Xorg window managers. Sway is arguably the most solid of the bunch in this realm. It is meant as a full replacement for the i3 window manager. Plenty others have been made recently, such as dwl (dwm replacement), waymonad (xmonad replacement), hikari (inspired by cwm), and more.

Gaming Performance is Nearly There

Other than a huge outlier (Unigine Heaven), most games are running with practically identical performance under XWayland. Wayland (currently only under sway) can handle variable refresh rate with multiple monitors, which Xorg is unable to do. Because the compositor is integrated into the server, you’ll never have to worry about screen tearing again. Any SDL2 based game can run natively under wayland; for steam users, make sure you’re linking steam against your native system libraries.

way-gaming

Most Applications Support It

The GTK toolkit has wayland support built in as does EFL. QT has a plugin that allows any QT based application to run natively under wayland. Any application that doesn’t can run under XWayland.

Why You Shouldn’t

Wayland is still in heavy development and isn’t for some people. Most GPUs will work fantastic with wayland, except for Nvidia. Nvidia has very limited support of compositor (only GNOME, KDE, and weston) and lacks 3D acceleration support for XWayland, so games will not run very well.

There are also plenty of window managers and desktop environments that do not have wayland counterparts. If it’s the case that your favorite desktop environment/window manager is Xorg only, it’s best to wait.