Wayland display server protocol
Long and Short Routes
In X11, the kernel transmits a mouse click via the evdev driver [8]. The X server determines which window the event is intended for and sends it to the client responsible for the window. One problem with this approach is that the position of the window is controlled by the compositor and not by X itself. Because a mouse click can change elements in the window or open a new window, the client sends a request to render to the X server. The X server then forwards this request to the graphics driver, which delegates the rendering to the hardware. The X server then calculates the geometry and position of the area to be rendered and sends a report called a damage event to the compositor, which provides the information that something has changed in the window and that an area of the display must be redrawn. The commands for this redraw again have to go through the X server.
The X server carries around a lot of baggage, but it doesn't actually have much functionality that is still useful today. The X server is the middleman, and these days it just generates unnecessary steps between the application and the compositor and between the compositor and the graphics hardware.
In Wayland, the compositor is also the display server (Figure 5). The kernel hands over events directly to the compositor. Wayland allows the compositor to transmit events directly to the clients and then lets clients send back damage events directly to the compositor. For example, the compositor looks for which window the event is intended. Thanks to its scene graph [9], the compositor knows exactly which changes have already been made to the window (Figure 6).
The event is forwarded directly to the clients, and the clients calculate the rendering themselves and send feedback to the compositor, stating that the window has been updated. The compositor redraws the window and sends a system call (ioctl
) to the Kernel Mode Setting (KMS) [10] to request a pageflip. The clients can't take over the rendering themselves because of the Direct Rendering Infrastructure (DRI) [11], which allows common video buffer storage for the client and server. This means that the client can link to a rendering library (e.g., OpenGL, Vulkan, or the rendering engines Qt or Gtk+), which then writes directly in the shared buffer.
The only supposed disadvantage of Wayland compared with X11 is that X11 is network capable, whereas Wayland is not. However, with the Remote Desktop Protocol (RDP) or Virtual Network Computing (VNC), users today have options for sending desktops or individual GUI application via the network. An RDP or VNC server based directly on Wayland is also conceivable. For security reasons, however, much more focus is placed on one of X11's weaknesses: In the past, the X server corresponded directly with the hardware, so it traditionally ran with root privileges. Thanks to KMS, today the X server theoretically can run without root privileges, but this option is hardly ever used. Wayland, on the other hand, doesn't require root privileges because it communicates with the hardware via the kernel.
Wayland's State of Development
Wayland and its reference compositor Weston are now up to version 1.9. The protocol itself is considered quite mature and no longer receives new functions, so developers of compositors for KDE, Gnome, Enlightenment, Sailfish OS, Tizen, and others have time to finish and test their Wayland implementations. The Weston reference compositor [14], on the other hand, provides new experimental technologies and interfaces.
New features include atomic kernel mode switching [15], which promises a completely flicker-free view change. A library that can manage the input devices of various compositors and that aims to replace drivers such as evdev, synaptics, or wacom was already integrated with libinput in Weston 1.5 (Figure 7). Fedora has used libinput for managing input and output devices since version 22.
![](/var/linux_magazin/storage/images/issues/2016/186/wayland/figure-7/669712-1-eng-US/Figure-7_large.png)
Fedora has offered experimental support for Wayland for more than a year. The Fedora Rawhide distribution takes that support one step further and, as of recently, supports Wayland by default. Users might need to edit the /etc/gdm/custom.conf
file to receive a conventional X.Org session. Because not everyone wants to test Rawhide, the Fedora developers promise to implement Wayland bug fixes quickly so that users remain fairly close to the current state of development when updating their system.
The Test Course
To test Wayland using a Live image of Fedora 23, the user needs to create a password after starting the Live medium to obtain the Wayland option. To do so, just click the down arrow in the top right corner of the desktop, select Live System User | Account Settings, and enter a password. Fedora places value on passwords that are as safe as possible and therefore makes you create secure passwords.
Once you've created a secure password, go to Live System User | Log Out, and you'll be taken to the login manager, where you can select the Wayland session by clicking the cogwheel to the left of Sign In (Figure 8). The next thing to do is import the latest updates. The quickest way to import updates is in a terminal using the
sudo dnf upgrade
command. If you want to check whether a Gnome Wayland session is running, you can use the
ls -l $XDG_RUNTIME_DIR/wayland-0
command. A socket will be displayed in /run/user/1000
if this command is successful.
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.