summaryrefslogtreecommitdiff
path: root/building.html
blob: 33fd5fba84f1db741c5c500d8b986c1d13bb8043 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html> 

<head> 
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> 
<link href="wayland.css" rel="stylesheet" type="text/css">
<title>Wayland</title> 
</head>

<body>
<h1><a href="/"><img src="wayland.png" alt="Wayland logo"></a></h1>

<p>The instructions below assume some familiarity with git and
building and running experimental software.  And be prepared that this
project 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).</p>

<h2>Hardware / Drivers</h2>

<p>X output requires DRI2.  DRM output (without X) requires Kernel Mode
Setting (KMS) and the page flip ioctl.  These are supported by:</p>

<p><b>Intel</b>: i915 (June 2004) or newer cards.  DRM support has been
in the kernel since around 2.6.29.  Sandy Bridge chips require kernel
2.6.37.</p>

<p><b>AMD/ATI</b>: Requires open source driver (radeon/ati,
not fglrx/catalyst).  DRM output requires kernel version 2.6.38.
Cards probably work back to Radeon 7200 (2000).</p>

<p><b>nVidia</b>: Requires Nouveau (open source driver).  DRM output
requires a kernel built from the Nouveau git repository, details below.
Cards probably work back to Riva TNT (1998).</p>

<h2>Setting up the environment</h2>
<p>If you want to install in $HOME/install (or another location that won't
interfere with the rest of your system) you'll need to set the following
environment variables to get various libraries to link appropriately:</p>

<pre>LD_LIBRARY_PATH=$HOME/install/lib
PKG_CONFIG_PATH=$HOME/install/lib/pkgconfig/:$HOME/install/share/pkgconfig/
ACLOCAL="aclocal -I $HOME/install/share/aclocal"
C_INCLUDE_PATH=$HOME/install/include
LIBRARY_PATH=$HOME/install/lib
</pre>

<p>Do not set LD_LIBRARY_PATH as your default, it will break things.</p>

<h2>Wayland libraries</h2>

<p>Required to build Mesa with --with-egl-platforms=wayland,drm.</p>

<pre>    $ git clone git://anongit.freedesktop.org/wayland/wayland
    $ cd wayland
    $ ./autogen.sh --prefix=$HOME/install
    $ make
    $ make install
</pre>

<h2>Mesa</h2>

<p>Wayland uses the mesa EGL stack, and all extensions required to run
EGL on KMS are now upstream on the master branch.  You'll need to pull
it from git, because 7.10 does not include required commits related to
BGRA8888 and wayland-egl.  For this you'll also need a development
package for libdrm.</p>

<pre>    $ git clone git://anongit.freedesktop.org/git/mesa/drm
    $ cd drm
    $ ./autogen.sh --prefix=$HOME/install --enable-nouveau-experimental-api
    $ make &amp;&amp; make install

    $ git clone git://anongit.freedesktop.org/mesa/mesa
    $ cd mesa
    $ ./autogen.sh --prefix=$HOME/install --enable-gles2                   \
      --disable-gallium-egl --enable-gallium-nouveau --enable-gallium-r600 \
      --with-egl-platforms=wayland,drm
    $ make &amp;&amp; make install
</pre>

<p>We disable Gallium for Intel 915 and 965, which just means that libEGL
won't try to load the Gallium drivers directly.  The Gallium drivers will
be built as DRI drivers, which the EGL loader will load just fine.</p>


<h2>libxkbcommon</h2>

<p>Wayland needs libxkbcommon for translating evdev keycodes to
keysyms.  For this you'll need development packages for xproto,
kbproto, macros and libX11.</p>

<pre>    $ git clone git://anongit.freedesktop.org/xorg/proto/xproto
    $ cd xproto
    $ ./autogen.sh --prefix=$HOME/install
    $ make &amp;&amp; make install

    $ git clone git://anongit.freedesktop.org/xorg/proto/kbproto
    $ cd kbproto
    $ ./autogen.sh --prefix=$HOME/install
    $ make &amp;&amp; make install

    $ git clone git://anongit.freedesktop.org/xorg/util/macros
    $ cd macros
    $ ./autogen.sh --prefix=$HOME/install
    $ make &amp;&amp; make install

    $ git clone git://anongit.freedesktop.org/xorg/lib/libX11
    $ cd libX11
    $ ./autogen.sh --prefix=$HOME/install
    $ make &amp;&amp; make install

    $ git clone git://people.freedesktop.org/xorg/lib/libxkbcommon.git
    $ cd libxkbcommon/
    $ ./autogen.sh --prefix=$HOME/install --with-xkb-config-root=/usr/share/X11/xkb
    $ make &amp;&amp; make install
</pre>

<h2>cairo-gl</h2>

<p>The Wayland clients can render using cairo-gl, but fall back to
software when cairo-gl is not available.  cairo-gl is an experimental
cairo backend and 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.  For this you'll need a development
package for pixman.</p>

<pre>    $ git clone git://anongit.freedesktop.org/pixman
    $ cd pixman
    $ ./autogen.sh --prefix=$HOME/install
    $ make &amp;&amp; make install

    $ git clone git://anongit.freedesktop.org/cairo
    $ cd cairo
    $ ./autogen.sh --prefix=$HOME/install --enable-gl --enable-xcb
    $ make &amp;&amp; make install
</pre>

<h2>Wayland applications</h2>

<p>With mesa and libxkbcommon in place, we can checkout and build Wayland.
Aside from mesa, Wayland may need 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.</p>

<pre>    $ git clone git://anongit.freedesktop.org/wayland/wayland-demos
    $ cd wayland-demos
    $ ./autogen.sh --prefix=$HOME/install
    $ make
    $ make install
</pre>

<p>Installing into a non-/usr prefix is fine, but the 70-wayland.rules
udev rule file has to be copied to /etc/udev/rules.d.</p>

<pre>    $ sudo cp compositor/70-wayland.rules /etc/udev/rules.d/
</pre>

<p>Once installed, either reboot or run the following to make udev label
the devices wayland will use.</p>

<pre>    $ sudo udevadm trigger --subsystem-match=drm --subsystem-match=input
</pre>

<p>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:</p>

<pre>    $ ./compositor -b my-image.jpg
</pre>

<p>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: </p>

<ul>
  <li>'terminal' is a simple terminal emulator, not very compliant at all,
    but works well enough for bash</li>
  <li>'flower' draws a flower on the screen, testing the frame
    protocol</li>
  <li>'gears' glxgears, but for wayland</li>
  <li>'smoke' tests SHM buffer sharing</li>
  <li>'image' loads the image files passed on the command line and
    shows them</li>
  <li>'view' does the same for pdf files</li>
  <li>'resizor' demonstrates smooth window resizing
    (use up and down keys)</li>
  <li>'eventdemo' reports libtoytoolkit's 
    events to console (see eventdemo --help)</li>
</ul>

<h2>Notes</h2>

<p>Environment variables which will get you more debugging output:</p>

<pre>MESA_DEBUG=1
EGL_LOG_LEVEL=debug
LIBGL_DEBUG=verbose
WAYLAND_DEBUG=1
</pre>

<h2>Nouveau Kernel</h2>

<p>To use DRM output with nVidia, you need to build a kernel from the
Nouveau kernel git repository:<br>
(<a href="http://cgit.freedesktop.org/nouveau/linux-2.6/commit/?id=8e645575d469bf08c9d5d98a101ef4cfce6a9180">required commit</a>)
</p>

<pre>    $ git clone --depth 1 git://anongit.freedesktop.org/nouveau/linux-2.6
    $ cd linux-2.6
    $ cp /boot/config-`uname -r` .config # use .config of currently running kernel
    $ yes "" | make oldconfig            # use defaults for new options
    $ make clean &amp;&amp; make &amp;&amp; make modules &amp;&amp; sudo make modules_install &amp;&amp; sudo make install
    $ mkinitramfs -o initrd.img `make kernelversion`+
    $ sudo mv initrd.img /boot/initrd.img-`make kernelversion`+
    $ sudo update-grub
</pre> 
 
<p>To uninstall a kernel installed this way:</p>
 
<pre>    $ sudo rm /boot/initrd.img-`make kernelversion`+ /lib/modules/`make kernelversion`+
    $ sudo update-grub
</pre> 
</body>
</html>