2010-09-15 00:41:26 +08:00
|
|
|
What is Wayland
|
|
|
|
|
|
|
|
Wayland is a project to define a protocol for a compositor to talk to
|
|
|
|
its clients as well as a library implementation of the protocol. The
|
|
|
|
compositor can be a standalone display server running on Linux kernel
|
|
|
|
modesetting and evdev input devices, an X applications, or a wayland
|
2010-11-09 14:31:30 +08:00
|
|
|
client itself. The clients can be traditional applications, X servers
|
2010-09-15 00:41:26 +08:00
|
|
|
(rootless or fullscreen) or other display servers.
|
|
|
|
|
|
|
|
The wayland protocol is essentially only about input handling and
|
|
|
|
buffer management. The compositor receives input events and forwards
|
|
|
|
them to the relevant client. The clients creates buffers and renders
|
|
|
|
into them and notifies the compositor when it needs to redraw. The
|
|
|
|
protocol also handles drag and drop, selections, window management and
|
|
|
|
other interactions that must go throught the compositor. However, the
|
|
|
|
protocol does not handle rendering, which is one of the features that
|
|
|
|
makes wayland so simple. All clients are expected to handle rendering
|
|
|
|
themselves, typically through cairo or OpenGL.
|
|
|
|
|
|
|
|
The wayland repository includes a compositor and a few clients, but
|
|
|
|
both the compositor and clients are essentially test cases.
|
|
|
|
|
|
|
|
|
|
|
|
Building Instructions
|
|
|
|
|
|
|
|
The instructions below assume some familiarity with git and building
|
|
|
|
and running experimental software. And be prepared that this project
|
2010-09-14 23:25:55 +08:00
|
|
|
isn't at all useful right now, it's still very much a prototype. When
|
|
|
|
the instructions suggest to clone a git repo, you can of course just
|
|
|
|
add a remote and fetch instead, if you have a clone of that repo
|
|
|
|
around already. I usually install all software I'm working on into
|
|
|
|
$HOME/install, so that's what I'll use in the instructions below, but
|
|
|
|
you can use your favorite directory of course or install over your
|
|
|
|
system copy (pass --prefix=/usr --sysconfdir=/etc, generally).
|
2008-11-05 23:37:20 +08:00
|
|
|
|
2008-11-04 04:31:30 +08:00
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
Modesetting
|
2008-11-04 04:31:30 +08:00
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
At this point, kernel modesetting is upstream for Intel, AMD and
|
|
|
|
nVidia chipsets. Most distributions ship with kernel modesetting
|
|
|
|
enabled by default and will work with Wayland out of the box. The
|
|
|
|
modesetting driver must also support the page flip ioctl, which only
|
|
|
|
the intel driver does at this point.
|
2008-11-04 04:31:30 +08:00
|
|
|
|
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
Building mesa
|
2008-11-04 04:31:30 +08:00
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
Wayland uses the mesa EGL stack, and all extensions required to run
|
|
|
|
EGL on KMS are now upstream on the master branch. The 7.9 release of
|
|
|
|
mesa will have all these extensions, but for now you'll need to build
|
|
|
|
mesa master:
|
2008-11-04 04:31:30 +08:00
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
$ git clone git://anongit.freedesktop.org/mesa/mesa
|
|
|
|
$ cd mesa
|
|
|
|
$ ./configure --prefix=$HOME/install --enable-egl --enable-gles2
|
|
|
|
$ make && make install
|
2008-11-04 04:31:30 +08:00
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
If you're using an intel chipset, it's best to also pass
|
|
|
|
--disable-gallium to ./configure, since otherwise libEGL will try to
|
|
|
|
load the gallium sw rasterizer before loading the Intel DRI driver.
|
2008-11-04 04:31:30 +08:00
|
|
|
|
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
libxkbcommon
|
2008-11-04 04:31:30 +08:00
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
Wayland needs libxkbcommon for translating evdev keycodes to keysyms.
|
|
|
|
There's a couple of repos around, and we're trying to consolidate the
|
2010-11-09 14:31:30 +08:00
|
|
|
development, but for wayland you'll need the repo from my git
|
2010-09-14 23:25:55 +08:00
|
|
|
repository. For this you'll need development packages for xproto,
|
|
|
|
kbproto and libX11.
|
2008-11-04 04:31:30 +08:00
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
$ git clone git://people.freedesktop.org/~krh/libxkbcommon.git
|
|
|
|
$ cd libxkbcommon/
|
|
|
|
$ ./autogen.sh --prefix=$HOME/install
|
|
|
|
$ make && make install
|
2008-11-04 04:31:30 +08:00
|
|
|
|
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
cairo-gl
|
2008-11-04 04:31:30 +08:00
|
|
|
|
2010-11-09 14:31:30 +08:00
|
|
|
The Wayland clients render using cairo-gl, which is an experimental
|
2010-09-14 23:25:55 +08:00
|
|
|
cairo backend. It has been available since cairo 1.10. Unless your
|
|
|
|
distribution ships cairo with the gl backend enabled, you'll need to
|
|
|
|
compile your own version of cairo:
|
2008-11-04 04:31:30 +08:00
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
$ git clone git://anongit.freedesktop.org/cairo
|
|
|
|
$ cd cairo
|
|
|
|
$ ./autogen.sh --prefix=$HOME/install --enable-gl
|
|
|
|
$ make && make install
|
2008-11-04 04:31:30 +08:00
|
|
|
|
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
Wayland
|
2008-11-04 04:31:30 +08:00
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
With mesa and libxkbcommon in place, we can checkout and build
|
|
|
|
Wayland. Aside from mesa, Wayland needs development packages for
|
|
|
|
gdk-pixbuf-2.0, libudev, libdrm, xcb-dri2, xcb-fixes (for X
|
|
|
|
compositor) cairo-gl, glib-2.0, gdk-2.0 (for poppler) and
|
|
|
|
poppler-glib:
|
2008-11-04 04:31:30 +08:00
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
$ git clone git://people.freedesktop.org/~krh/wayland
|
2010-11-08 17:59:53 +08:00
|
|
|
$ ./autogen.sh --prefix=$HOME/install
|
2010-09-14 23:25:55 +08:00
|
|
|
$ make && make install
|
2008-11-04 04:31:30 +08:00
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
Installing into a non-/usr prefix is fine, but the 70-wayland.rules
|
|
|
|
udev rule file has to be installed in /etc/udev/rules.d. Once
|
|
|
|
installed, either reboot or run
|
2008-11-04 04:31:30 +08:00
|
|
|
|
2010-09-14 23:25:55 +08:00
|
|
|
$ sudo udevadm trigger --subsystem-match=drm --subsystem-match=input
|
|
|
|
|
|
|
|
to make udev label the devices wayland will use.
|
|
|
|
|
|
|
|
If DISPLAY is set, the wayland compositor will run under X in a window
|
|
|
|
and take input from X. Otherwise it will run on the KMS framebuffer
|
|
|
|
and take input from evdev devices. Pick a background image that you
|
|
|
|
like and copy it to the Wayland source directory as background.jpg or
|
|
|
|
use the -b command line option:
|
|
|
|
|
|
|
|
$ ./wayland-system-compositor -b my-image.jpg
|
|
|
|
|
|
|
|
To run clients, switch to a different VT and run the client from
|
|
|
|
there. Or run it under X and start up the clients from a terminal
|
|
|
|
window. There are a few demo clients available, but they are all
|
|
|
|
pretty simple and mostly for testing specific features in the wayland
|
|
|
|
protocol: 'terminal' is a simple terminal emulator, not very compliant
|
|
|
|
at all, but works well enough for bash
|
|
|
|
|
|
|
|
'flower' moves a flower around the screen, testing the frame protocol
|
|
|
|
'gears' glxgears, but for wayland, currently broken
|
|
|
|
'image' loads the image files passed on the command line and shows them
|
|
|
|
|
|
|
|
'view' does the same for pdf files, but needs file URIs
|
|
|
|
(file:///path/to/pdf)
|