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.
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.
News
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.