What Is Wayland and What Does It Mean for Linux Users?

Wayland Desktop

Ever since Fedora 25 boldly introduced the Wayland graphics stack by default in 2016, it’s been installed as the primary option in several Linux distros. You may even be using it now if you’re reading this from a Linux machine. Even as Wayland has been around for a while, it’s still a topic of intrigue among people who have been accustomed to using the older, ubiquitous X11 protocol through Xorg.

This guide briefly goes over what Wayland is, what it does, and why developers are flocking to it in droves!

Tip: learn the most effective ways to speed up your Linux PC.

What Is Wayland?

To display the windows on your screen and correctly draw every one of their elements, Linux needs a way to communicate with your graphics hardware and displays. From 1984 to 2016, most distros used a display protocol called the “X window system core protocol” (or just X). Wayland appeared at the end of this period, presenting an alternative that is lighter, has more security, and is more optimized to work on modern display technologies.

Display protocols can’t work by themselves to draw things on your screen, though. They need to be implemented in pieces of software known as display servers. For X, the reigning champion for a very long time has been Xorg.

wayland-xorg-xsession

In Wayland, the display server will often just be the window manager your desktop environment uses. For GNOME, it’s Mutter. In KDE Plasma, it’s KWin. Instead of having a separate standalone process running the server, the window manager makes calls to a library within the system to communicate with graphics hardware. In most cases, that would be wlroots.

This allows GNOME’s Mutter, for example, to write data into the framebuffer directly, instead of using a middleman (much like how Xorg is used), tangibly improving performance.

How Does Wayland Work?

Display servers give information to the kernel and graphics hardware so that they can rapidly pass things on to the display. They receive this information through applications that communicate with them using their respective protocols. An application designed to work with X, for example, cannot communicate with a Wayland server.

Wayland Displayserver

Wayland solves this through something called XWayland, which acts as a compatibility layer that allows X client-server interaction to be translated into something that Wayland can “understand.”

In Wayland, the server and compositor are one and the same. Every desktop environment that uses Wayland makes calls to a library that implements the Wayland protocol to draw effects, such as transparency, window blurring, transition animations, and drop shadows, that give windows a sense of dimension.

Wayland brings all of these functions closer to the kernel, and you’ll often feel it by the “smoothness” that you experience in the graphical environment.

Instead of drawing through the use of a third-party software, Wayland calls what is known as the Direct Rendering Manager (DRM) buffer in the kernel to draw things.

You may notice that in Wayland, the steps are much simpler and the process straightforward. This leads to greater performance in graphically intense situations and makes it easier for developers to make applications that run under this protocol.

Good to know: issues with the display server or graphic driver can cause screen tearing. Find out what screen tearing is and how to fix it.

How to Try Wayland

Most Linux distributions have decided to go with Wayland as a default option, so you may even be using it right now! You can easily check this by opening a terminal and typing echo $XDG_SESSION_TYPE.

There are some holdouts, like Linux Mint, due to the slow development cycle of its desktop environments and the debate on whether Wayland is truly mature enough to run on the distro.

At the moment, installing Ubuntu 22.04 or later – or any currently-supported version of Fedora – offers the most painless way to experience Wayland.

wayland-gnome-wayland-session

In any other distro, if it’s using a current version of GNOME or KDE Plasma, it has the option to use Wayland.

If you’re using Arch Linux, you may have to follow these steps:

  1. If you’re running GNOME, there’s nothing to do, as your display manager (GDM) supports it by default. If you’re running KDE Plasma with its default display manager, you have to grab the “git” version of it from the AUR:
yay -S sddm-git

or

paru -S sddm-git
  1. If you did anything in step 1, check that the systemd service didn’t get disabled or something:
sudo systemctl enable sddm
  1. Install XWayland:
sudo pacman -S xorg-xwayland

That’s it! The next time you boot your system, you’ll have the option to select Wayland as the display protocol for your desktop environment on your login screen.

If you want to debug events to see why something is not working properly, run:

qdbus org.kde.KWin /KWin org.kde.KWin.showDebugConsole

Frequently Asked Questions

What drivers currently support Wayland?

Since Nvidia released version 495.44 on October 26, 2021, all major graphics card manufacturers (AMD, Nvidia, and Intel) have implemented full support for Wayland in their drivers with Generic Buffer Management (GBM), which is currently the gold standard for implementations of the display protocol.

Will Wayland stop keyloggers?

X11 has long been known to be vulnerable to something known as the “unauthorized access attack” (CVE-1999-0526), which allows applications to take unwarranted screenshots, tap into keyboard and mouse events, etc., to gain access to usernames and passwords. Although Wayland has security measures in place to prevent these sorts of attacks, this protection is only within the realm of serving graphics to your display. An application can still, in practice, listen to other types of messages sent to the kernel through the keyboard.

In short, avoid overconfidence in your machine, as Wayland enhances your security in niche ways!

How does Wayland perform with gaming?

In some niche cases, you’ll notice some improvements when gaming with Wayland, but games that render through Xorg may have small graphical issues. Some overlay applications (like WTRTI, which provides an overlay for War Thunder, for example) may not work at all, as it’s an XWayland window trying to talk to another XWayland window, which can be very difficult. Your mileage may vary, and you may be just as pleased with some results as you would be disappointed in others.

Is this post useful?
Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Miguel Leiva-Gomez
Miguel Leiva-Gomez - Staff Writer

Miguel has been a business growth and technology expert for more than a decade and has written software for even longer. From his little castle in Romania, he presents cold and analytical perspectives to things that affect the tech world.