| technology | networking - Graeme Messina
Why Use Wayland versus X11?
Wayland and X11 are two different display server technologies that allow you to see your desktop and manage the windows that each application and tool generates on the desktop. They have a lot in common but also some key differences — mainly in the way that the graphical data is relayed between application, window manager/compositor. In this post, we will compare Wayland to X11, look at the advantages of each one, and learn more about window management in Linux.
What is Wayland?
Simply put, Wayland is a display server protocol that seeks to replace X11. It is not an application or a downloadable program. Instead, it is a standard or specification that needs to be adopted by window managers and desktop e12/1nvironments. Wayland is designed to be easier to use than X11. X11 has been around for a while, and is starting to show its age thanks to legacy code that bloats the system.
Wayland is trying to develop a new way of managing your graphical system and how you interact with it. Wayland also aims to be easier to integrate into Linux systems with more straight-forward code. As it stands currently, Wayland has support in the GNOME desktop environment and some other platforms such as KDE’s KWin. It has been in development for some time, which has left many people wondering if it will actually materialize as a viable alternative to X11.
Why Use Wayland?
X11 (version 11 of X Server) has been in use since 1987, so it is well past its expiration date. For a complete list of X releases check out their website. The reality is that it has been developed over a very long period, which still contains many legacy components within its code that make it very difficult to develop any further.
Part of this legacy structure is the client/server model that it employs to render windows. Long ago, a server would handle all the rendering requests and a rendering workstation would receive the graphics and windows that the server created.
X11 is primarily a display protocol, so it was designed to render graphics over the network. This is why it is possible to forward X11 sessions over SSH, giving you a secure remote session to a graphical desktop on a networked server or PC.
The client’s applications need to communicate with the X11 server before the compositor (window manager) can generate the window that is needed for the application to render properly. This is reliable, but it is very slow by modern standards, and when comparing it to newer systems, such as Wayland.
Wayland uses a simple, modern approach: client side rendering. This cuts out any server type component that acts as a middleman, and lets the application communicate directly with the compositor that it wishes to render a window for. This makes load times much quicker in theory and is technically easier to implement, thanks to the simplified codebase that Wayland brings to the table.
How Does Wayland Work?
The basic concept behind the process model for Wayland is that it is the server and client combined, which means it communicates directly with the compositor. This means that applications that wish to use Wayland need to give all of their display information to Wayland.
These parameters include screen size of the window, position and state (minimized, maximized etc). The application itself draws the window that it will run in, instead of like in the case of the X11 server that needed to relay this information back and forth between the application and the compositor. This process is the client side rendering aspect that we mentioned above.
However, this means that applications that wish to support Wayland will need to be updated or rewritten entirely as a different version to support this new standard. This has slowed down adoption to a certain extent, but most popular Linux distributions have made it available as part of their environments.
Why Use Wayland Instead of X11?
The first and most obvious reason why you would want to use Wayland instead of X11 is the reduced latency between opening an application and having it render on your desktop. It also makes tasks such as dragging windows, resizing them or switching them to full screen feel that much more smooth and modern.
The simpler code that has been written for this protocol also gives it a performance edge over X11. If you also consider that Wayland is a newer project, it has had less time to gather deprecated and bloated code, making it more agile and reactive than the aged X11 protocol.
Wayland has also been designed with security in mind and is not vulnerable to the same types of attacks that X11 is, such as the Unauthenticated Access exploit, although this has been patched in later releases for the most part.
The protocol that Wayland uses also makes it easier for designers and developers alike to create cross-platform apps, which have always suffered from problems rendering on Linux due to compatibility issues between various versions of GTK or Qt.
Who Created Wayland and Who Supports It?
Wayland was created by a project called the Wayland project. This is a different entity than X11, which was created by the Open Group as an extension of XFree86’s design.
Some examples of Linux distributions that support Wayland are:
- Fedora 25+
- Debian Stretch (unstable)
- Gentoo Linux
- openSUSE 42.x+
- Mageia Cauldron.
When Will Wayland be Released?
The alpha version of Wayland 1.19.0 was released January 27, 2021. Most of the hardware that supports Wayland is Intel’s open source driver or AMD’s open source driver. Raspberry Pi and Android both support Wayland out of the box with no need for any additional drivers.
What Might Stop Wayland's Release or Slow Down its Adoption
Wayland has been in development for a long time, so it is quite possible that unexpected issues could delay it even further. It has released multiple improvements and currently posts these to this website when they unveil new versions.
There is currently no working draft to make it a standard. This means Wayland will need to be adopted by the Linux Foundation and other organizations who can help with development, testing, and promoting its use before it becomes an official standard.
Because Wayland is a protocol it takes quite a different approach to traditional X11 programmed applications, which also hampers its adoption. There isn’t currently an official draft standard to make Wayland the standard, which means that it could still be some time before it becomes accepted as a mainstream alternative to X11.
Final Analysis: Which is best?
As things stand, X11 is probably still the better choice, just from a compatibility perspective. X11 has been in use for a very long time by computing standards, and it is reliable and stable. This stability comes at a performance cost, however. If you are running production systems or systems that rely on legacy applications, then X11 will be the better choice for you.
If you are looking to experiment and try out something new, then Wayland is a great way to do just that. It is lightweight, and it will not take up as many resources on your system as X11 would, although modern systems tend to handle X11 just fine.
There are also a lot of new features that you can experiment with, like GPU sharing or Wayland specific compositors to try out. It all boils down to what you want to do with your graphical system, what kind of environment you will be running your system in, and compatibility between your applications and Wayland.
In the final analysis, you should try installing a fresh OS with X11 and Wayland and then test it for yourself. This is by far the best way to see what works best for your own specific needs. There is no right answer because both Wayland and X11 are great options with their own pluses and minuses that make them unique in different ways. The choice is yours.