Some tweaks to WaylandSurfaceItem API.
[profile/ivi/qtwayland.git] / README
1 This document is heavily inspired by the Building Wayland document:
2 http://wayland.freedesktop.org/building.html
3
4 However, it is slightly more messy
5 :) If you encounter things you find unclear, and know of a better way of
6 expressing it, then please send a patch:)
7
8 Qt-Compositor is meant as a toolbox for making new funky Wayland compositors.
9
10 As of today(15 march, 2011) it is not trivial to get Wayland to
11 work on all platforms. This document explains how to get Wayland and the
12 Qt-Compositor examples running with a raster backend on a Ubuntu 10.10 system.
13
14 Pre-requisites: Git
15
16 1. To build wayland we need libffi + libffi headers
17 # sudo apt-get install libffi libffi-dev
18
19 Qt-Compositor contains a copy of the Wayland libraries. We have not changed
20 them in any way, but they are provided for convenience so that you can compile
21 everything using qmake. However, I suggest you use the official Wayland
22 libraries. The only dependency they have is to ffi. The demos has some more
23 dependencies, but we are not going to compile those.
24
25 2. Clone Wayland from: git://anongit.freedesktop.org/wayland/wayland
26 # git clone git://anongit.freedesktop.org/wayland/wayland
27
28 3. Compile Wayland: #./autogen.sh -prefix=$HOME/install && make && make install
29
30 4. Set your PKG_CONFIG_PATH so that the location of the Wayland libraries are
31 picked up by Qt's configure. 
32 # export PKG_CONFIG_PATH=$HOME/install/lib/pkgconfig/
33
34 5. When Qt is configured it will check for pkg-config for GLES2. To figure out
35 what version Qt will pick up, then do:
36 # pkg-config --libs glesv2
37
38 6. Set the library path to pick up the Wayland libraries
39 # export LD_LIBRARY_PATH=$HOME/install/lib
40
41 7. While we are at it export the runtime path as well
42 # export XDG_RUNTIME_DIR=$HOME
43
44 8. Get the build dependencies that you need for QtGui.
45 # sudo apt-get build-dep libqt4-gui
46
47 One of the dependencies that the wayland-demos compositor and client
48 applications has is xkbcommon. The Qt-Lighthouse wayland plugin has code to
49 read xkbcommon codes sent over the wayland protocol, so that Qt-Lighthouse
50 clients on Wayland will get keyboard functionality in other compositors.
51 However, Qt-Compositor doesn't have this requirement. The support for xkbcommon
52 is picked up by configure. If it is not detected the Wayland plug-in will be
53 compiled with the: QT_NO_WAYLAND_XKB.
54
55 To be able to just compile xkbcommon on ubuntu without compiling xproto,
56 kbproto, macros and libX11 I apply this patch to libxkbcommon:
57 http://pastebin.com/YTcxFukh
58
59 Its a good idea to use out of source builds when building Qt. A good setup
60 could be: $HOME/dev/qt-src/lighthouse where lighthouse is where you have a
61 complete checkout of the lighthouse repository.  Then you can have ie.:
62 $HOME/dev/qt-builds/lighthouse-debug
63
64 9. Clone Lighthouse from gitorious
65 # git clone git@gitorious.org:+qt-developers/qt/lighthouse.git
66 # $HOME/dev/qt-src/lighthouse
67 (you might want to use git remote etc. if you already have a clone of
68 qt-master)
69
70 10. Configure and compile Qt-Lighthouse. So from
71 $HOME/dev/qt-builds/lighthouse-debug do: ../../qt-src/lighthouse/configure -qpa
72 -developer-build && make
73
74 11. OK, now we have Lighthouse and Wayland libs on our system. To try Wayland
75 out we want the compositor to render into a XWindow(this is for development).
76 So we need to compile up a X back-end for lighthouse. They don't get built
77 automatically (yet). The Wayland plug-in will be ma
78
79 Go into the directory: $HOME/dev/qt-src/lighthouse/src/plugins/platforms/xcb
80 # make
81
82 12. When this is done, you are ready to compile the qwidget-compositor.  Enter
83 the directory with $QT-COMPOSITOR-DIR/examples/qwidget-compositor #qmake &&
84 make
85
86 Makes generates a executable in $QT-COMPOSITOR-DIR/bin. Execute it and pass in
87 -platform xcb
88 # $QT-COMPOSITOR-DIR/bin/qt-compositor -platform xcb
89
90 This should give you a blank window. If you now open a another terminal with
91 LD_LIBRARY_PATH set and run a simple Qt example with the -platform Wayland, it
92 should render into this window.
93
94 This gives us the raster back-end. It is possible to run Qt with scenegraph and
95 sending GL surfaces from clients to the compositor. However, it requires some
96 more setup. Please follow the instructions on the Wayland
97 page (http://wayland.freedesktop.org/building.html) closely. 
98
99 At the time of writing, the Building Wayland instructions note that a patch is
100 required for the linux kernel for using the Nouveau driver. On ubuntu systems
101 its real easy to build new kernels (takes a bit of time thoguh). I followed
102 these instructions:
103 http://www.howtoforge.com/kernel_compilation_ubuntu