1*84e872a0SLloyd Pique<?xml version='1.0' encoding='utf-8' ?> 2*84e872a0SLloyd Pique<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ 3*84e872a0SLloyd Pique<!ENTITY % BOOK_ENTITIES SYSTEM "Wayland.ent"> 4*84e872a0SLloyd Pique%BOOK_ENTITIES; 5*84e872a0SLloyd Pique]> 6*84e872a0SLloyd Pique<chapter id="chap-Introduction"> 7*84e872a0SLloyd Pique <title>Introduction</title> 8*84e872a0SLloyd Pique <section id="sect-Motivation"> 9*84e872a0SLloyd Pique <title>Motivation</title> 10*84e872a0SLloyd Pique <para> 11*84e872a0SLloyd Pique Most Linux and Unix-based systems rely on the X Window System (or 12*84e872a0SLloyd Pique simply <emphasis>X</emphasis>) as the low-level protocol for building 13*84e872a0SLloyd Pique bitmap graphics interfaces. On these systems, the X stack has grown to 14*84e872a0SLloyd Pique encompass functionality arguably belonging in client libraries, 15*84e872a0SLloyd Pique helper libraries, or the host operating system kernel. Support for 16*84e872a0SLloyd Pique things like PCI resource management, display configuration management, 17*84e872a0SLloyd Pique direct rendering, and memory management has been integrated into the X 18*84e872a0SLloyd Pique stack, imposing limitations like limited support for standalone 19*84e872a0SLloyd Pique applications, duplication in other projects (e.g. the Linux fb layer 20*84e872a0SLloyd Pique or the DirectFB project), and high levels of complexity for systems 21*84e872a0SLloyd Pique combining multiple elements (for example radeon memory map handling 22*84e872a0SLloyd Pique between the fb driver and X driver, or VT switching). 23*84e872a0SLloyd Pique </para> 24*84e872a0SLloyd Pique <para> 25*84e872a0SLloyd Pique Moreover, X has grown to incorporate modern features like offscreen 26*84e872a0SLloyd Pique rendering and scene composition, but subject to the limitations of the 27*84e872a0SLloyd Pique X architecture. For example, the X implementation of composition adds 28*84e872a0SLloyd Pique additional context switches and makes things like input redirection 29*84e872a0SLloyd Pique difficult. 30*84e872a0SLloyd Pique </para> 31*84e872a0SLloyd Pique <mediaobject> 32*84e872a0SLloyd Pique <imageobject> 33*84e872a0SLloyd Pique <imagedata fileref="images/x-architecture.png" format="PNG" /> 34*84e872a0SLloyd Pique </imageobject> 35*84e872a0SLloyd Pique <textobject> 36*84e872a0SLloyd Pique <phrase> 37*84e872a0SLloyd Pique X architecture diagram 38*84e872a0SLloyd Pique </phrase> 39*84e872a0SLloyd Pique </textobject> 40*84e872a0SLloyd Pique </mediaobject> 41*84e872a0SLloyd Pique <para> 42*84e872a0SLloyd Pique The diagram above illustrates the central role of the X server and 43*84e872a0SLloyd Pique compositor in operations, and the steps required to get contents on to 44*84e872a0SLloyd Pique the screen. 45*84e872a0SLloyd Pique </para> 46*84e872a0SLloyd Pique <para> 47*84e872a0SLloyd Pique Over time, X developers came to understand the shortcomings of this 48*84e872a0SLloyd Pique approach and worked to split things up. Over the past several years, 49*84e872a0SLloyd Pique a lot of functionality has moved out of the X server and into 50*84e872a0SLloyd Pique client-side libraries or kernel drivers. One of the first components 51*84e872a0SLloyd Pique to move out was font rendering, with freetype and fontconfig providing 52*84e872a0SLloyd Pique an alternative to the core X fonts. Direct rendering OpenGL as a 53*84e872a0SLloyd Pique graphics driver in a client side library went through some iterations, 54*84e872a0SLloyd Pique ending up as DRI2, which abstracted most of the direct rendering 55*84e872a0SLloyd Pique buffer management from client code. Then cairo came along and provided 56*84e872a0SLloyd Pique a modern 2D rendering library independent of X, and compositing 57*84e872a0SLloyd Pique managers took over control of the rendering of the desktop as toolkits 58*84e872a0SLloyd Pique like GTK+ and Qt moved away from using X APIs for rendering. Recently, 59*84e872a0SLloyd Pique memory and display management have moved to the Linux kernel, further 60*84e872a0SLloyd Pique reducing the scope of X and its driver stack. The end result is a 61*84e872a0SLloyd Pique highly modular graphics stack. 62*84e872a0SLloyd Pique </para> 63*84e872a0SLloyd Pique 64*84e872a0SLloyd Pique </section> 65*84e872a0SLloyd Pique 66*84e872a0SLloyd Pique <section id="sect-Compositing-manager-display-server"> 67*84e872a0SLloyd Pique <title>The compositing manager as the display server</title> 68*84e872a0SLloyd Pique <para> 69*84e872a0SLloyd Pique Wayland is a new display server and compositing protocol, and Weston 70*84e872a0SLloyd Pique is the implementation of this protocol which builds on top of all the 71*84e872a0SLloyd Pique components above. We are trying to distill out the functionality in 72*84e872a0SLloyd Pique the X server that is still used by the modern Linux desktop. This 73*84e872a0SLloyd Pique turns out to be not a whole lot. Applications can allocate their own 74*84e872a0SLloyd Pique off-screen buffers and render their window contents directly, using 75*84e872a0SLloyd Pique hardware accelerated libraries like libGL, or high quality software 76*84e872a0SLloyd Pique implementations like those found in Cairo. In the end, what’s needed 77*84e872a0SLloyd Pique is a way to present the resulting window surface for display, and a 78*84e872a0SLloyd Pique way to receive and arbitrate input among multiple clients. This is 79*84e872a0SLloyd Pique what Wayland provides, by piecing together the components already in 80*84e872a0SLloyd Pique the eco-system in a slightly different way. 81*84e872a0SLloyd Pique </para> 82*84e872a0SLloyd Pique <para> 83*84e872a0SLloyd Pique X will always be relevant, in the same way Fortran compilers and VRML 84*84e872a0SLloyd Pique browsers are, but it’s time that we think about moving it out of the 85*84e872a0SLloyd Pique critical path and provide it as an optional component for legacy 86*84e872a0SLloyd Pique applications. 87*84e872a0SLloyd Pique </para> 88*84e872a0SLloyd Pique <para> 89*84e872a0SLloyd Pique Overall, the philosophy of Wayland is to provide clients with a way to 90*84e872a0SLloyd Pique manage windows and how their contents is displayed. Rendering is left 91*84e872a0SLloyd Pique to clients, and system wide memory management interfaces are used to 92*84e872a0SLloyd Pique pass buffer handles between clients and the compositing manager. 93*84e872a0SLloyd Pique </para> 94*84e872a0SLloyd Pique <mediaobject> 95*84e872a0SLloyd Pique <imageobject> 96*84e872a0SLloyd Pique <imagedata fileref="images/wayland-architecture.png" format="PNG" /> 97*84e872a0SLloyd Pique </imageobject> 98*84e872a0SLloyd Pique <textobject> 99*84e872a0SLloyd Pique <phrase> 100*84e872a0SLloyd Pique Wayland architecture diagram 101*84e872a0SLloyd Pique </phrase> 102*84e872a0SLloyd Pique </textobject> 103*84e872a0SLloyd Pique </mediaobject> 104*84e872a0SLloyd Pique <para> 105*84e872a0SLloyd Pique The figure above illustrates how Wayland clients interact with a 106*84e872a0SLloyd Pique Wayland server. Note that window management and composition are 107*84e872a0SLloyd Pique handled entirely in the server, significantly reducing complexity 108*84e872a0SLloyd Pique while marginally improving performance through reduced context 109*84e872a0SLloyd Pique switching. The resulting system is easier to build and extend than a 110*84e872a0SLloyd Pique similar X system, because often changes need only be made in one 111*84e872a0SLloyd Pique place. Or in the case of protocol extensions, two (rather than 3 or 4 112*84e872a0SLloyd Pique in the X case where window management and/or composition handling may 113*84e872a0SLloyd Pique also need to be updated). 114*84e872a0SLloyd Pique </para> 115*84e872a0SLloyd Pique </section> 116*84e872a0SLloyd Pique</chapter> 117