Wayland: A New X Server For Linux

Written by Michael Larabel in Software on 3 November 2008 at 01:00 PM EST. Page 1 of 1. 30 Comments.

It's no secret that much of the code-base that makes up the modern-day X.Org Server is old and in some places bloated. The X.Org Server continues to evolve and has received a number of major additions in recent times, but wouldn't a clean and lighter server that is designed around today's needs be ideal? Red Hat's Kristian Høgsberg has started a new project, which is currently known as Wayland, and is just that: a new lightweight X Server. Wayland isn't just a rewrite of the current X Server, but instead it's a small server that is designed around some of the latest graphics technologies such as kernel mode-setting and the Graphics Execution Manager. Wayland also has its own built-in compositing manager.

The Wayland display server is very simple: everything is direct rendered and composited. There is no complicated APIs or objects to deal with like there is now with the X.Org Server. In an email to Phoronix, Kristian Høgsberg, creator of Wayland and also responsible for much of the DRI2 work in the current X.Org Server, describes this project as "a new display server that implements just the tiny fraction of X features that we actually use when running a composited desktop. Which is essentially buffer management (close to what DRI2 does in X.org), input handling and hooks to allow a compositor to composite the desktop. All rendering is done client side as direct rendering (how OpenGL works today, but pixman and thus cairo, for example, could learn how to do direct rendering too), and modesetting and other hardware setup is done in the kernel. This takes a lot of complexity out of the server."

While still early on in development, Wayland is quite small in size. Right now the server and compositor amount to a little more than 3,200 lines of C code and in just a handful of files. Wayland relies upon the mode-setting being within the kernel and expects some of the other functionality to be provided by shared libraries. Wayland provides a compositor, but a custom compositor can be provided atop of this lightweight server. Device input support was only added to Wayland yesterday afternoon and it's still very rudimentary. Many other features are also lacking compared to X Server 1.5, but the project is very young.

Kristian had also stated:

"At the same time, I'm trying to fix some of the problems with composite that we still have in the X server; input redirection, window resizing, syncing to vblank, throttling of animations and atomic, consistent redrawing. X specifies what the end results of a series of rendering requests must look like, but how the display looks while it's in progress is not discussed. GTK+ and Qt works around this to some extent by using double buffering, but we still see lag between window decorations and window contents while resizing etc. The wayland tag line is "every frame is perfect", by which I mean that applications will be able to control the rendering enough that we'll never see tearing, lag, redrawing or flicker."

What could Wayland be used for? Wayland may end up being a server used by GDM, as the screensaver server, for a safe-mode display server, or for graphical text consoles, among other possible uses. Wayland could also be a great fit for embedded systems / appliance applications where a custom compositor would sit atop Wayland to provide the user-interface and the Wayland server would then bind it to the application.

"As a first step this may be a graphics core on which we can run the GDM X server, the user session X server and maybe a screen saver X server. This will allow us to implement smooth transitions between X servers, cross fading or spinning the cube. As a next step, maybe the screen saver could then be ported to be a native wayland applications, then GDM (probably need GTK+ ported, not sure this is feasible), and then the session shell (panel, file manager etc) could be ported at which point the user session is a native applications. We'd need a rootless X server for running X applications under this environment. At this point X is only one remote display protocol, we could run RDP applications side by side with X applications under a wayland session."

Though before you think this will replace the current X.Org Server, Kristian explains "at this point wayland is just a prototype/playground for some ideas I've been toying with." Granted, it was Linus Torvalds who started the Linux kernel as a hobby and never expected it to support anything beyond early AT hard disks. Should Wayland survive, which we hope it will, this lightweight display server created by Kristian Høgsberg could end up serving well for some purposes and is designed around the latest display technologies in X.Org. It will likely be a while before Wayland is prepared to enter the spotlight, but we will keep you posted. For those interested in checking out the code that currently makes up Wayland, its git repository is housed at FreeDesktop.org.

Needed for Wayland is kernel mode-setting and best supporting that right now is ATI and Intel hardware. Fedora 9 started out supporting KMS on Intel hardware (A Preview of Kernel-based Mode-Setting), but due to the invasive changes that have been made to the driver recently, its support has regressed a bit. In Fedora 10 the optimal experience is with ATI R400 and R500 graphics cards. For those with NVIDIA hardware looking to use kernel mode-setting, continuing to evolve is the reverse-engineered Nouveau driver.

Also encompassing kernel-based mode-setting and other recent graphics innovations is Plymouth, another Red Hat project. Plymouth is a replacement for Red Hat Graphical Boot (RHGB) and more information (along with demo videos) is available in A Closer Look At Red Hat's Plymouth.

If you enjoyed this article consider joining Phoronix Premium to view this site ad-free, multi-page articles on a single page, and other benefits. PayPal or Stripe tips are also graciously accepted. Thanks for your support.

Related Articles
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.