Wayland logo

X Clients under Wayland (XWayland)

Wayland is a complete window system in itself, but even so, if we're migrating away from X, it makes sense to have a good backwards compatibility story. With a few changes, the Xorg server can be modified to use wayland input devices for input and forward either the root window or individual top-level windows as wayland surfaces. The server still runs the same 2D driver with the same acceleration code as it does when it runs natively. The main difference is that wayland handles presentation of the windows instead of KMS.

X on Wayland architecture diagram

Building XWayland

Follow the main Wayland build instructions first.

libxtrans

It may be necessary to build libxtrans from git://anongit.freedesktop.org/xorg/lib/libxtrans before building xserver on 32-bit systems.

X.org

    git clone git://anongit.freedesktop.org/xorg/xserver -b xwayland
    cd xserver
    ./autogen.sh --prefix=$WLD
    make
    make install
    cd ..

This gets you the latest Wayland enabled X server, until the Wayland enablement gets merged into the master branch.

DDX

The Device Dependent part of X. Only one of these is necessary. xf86-video-intel works with Intel open source video drivers. xf86-video-ati works with AMD Radeon open source drivers. xf86-video-wayland is implemented in software, so it works on all hardware, but is somewhat less complete. xf86-video-nouveau works with Nvidia / Nouveau.

    git clone git://anongit.freedesktop.org/xorg/driver/xf86-video-intel -b xwayland
    cd xf86-video-intel
    ./autogen.sh --prefix=$WLD
    make
    make install
    cd ..
    git clone https://github.com/RAOF/xf86-video-ati -b xwayland
    cd xf86-video-ati
    ./autogen.sh --prefix=$WLD
    make
    make install
    cd ..
    git clone git://anongit.freedesktop.org/xorg/driver/xf86-video-wayland
    cd xf86-video-wayland
    ./autogen.sh --prefix=$WLD
    make
    make install
    cd ..
    git clone https://github.com/RAOF/xf86-video-nouveau -b xwayland
    cd xf86-video-nouveau
    ./autogen.sh --prefix=$WLD
    make
    make install
    cd ..

Paths

Without this you will get the error "XKB: Failed to compile keymap".

    mkdir -p $WLD/share/X11/xkb/rules
    ln -s /usr/share/X11/xkb/rules/evdev $WLD/share/X11/xkb/rules/
    ln -s /usr/bin/xkbcomp $WLD/bin/

xorg.conf

Intel, ATI / AMD, and Nouveau DDXes probably do not require any xorg.conf modifications. If you use WLSHM, it requires a $WLD/etc/X11/xorg.conf containing:

Section "Device"
        Identifier "Device"
        Driver "wlshm"
EndSection

weston.ini

Add this to ~/.config/weston.ini (or use the --modules=xwayland.so command line argument):

    [core]
    modules=xwayland.so,desktop-shell.so

Running

Run weston under X, or weston-launch on KMS / DRM / outside of X. weston-launch requires that you enable systemd session support for weston-launch (by using systemd and having the systemd-login devel headers at configure time) or add yourself to the "weston-launch" group:

    sudo groupadd weston-launch
    sudo usermod -a -G weston-launch $USER
    # Log all the way out (of X, etc.)
    sudo chown root weston-launch
    sudo chmod +s weston-launch
    weston-launch

The weston console output will include "xserver listening on display :1". Within weston-terminal you will find $DISPLAY has already been set. Run an X client.

Weston listens on the X socket until a client attempts to connect, then launches X.org.