README.md
README.xspice
1 1. Introduction
2 2. Building
3 2.1 Building from source on fedora
4 2.2 Building from source with your own Xserver
5 3. Running
6
7 = 1. Introduction =
8 Xspice is an X server and Spice server in one. It consists of a wrapper script
9 for executing Xorg with the right parameters and environment variables, a
10 module names spiceqxl_drv.so implementing three drivers: a video mostly
11 code identical to the guest qxl X driver, and keyboard and mouse reading from
12 the spice inputs channel.
13
14 Xspice allows regular X connections, while a spice client provides the keyboard
15 and mouse and video output.
16
17 Spice client disconnections don't impact X client connections.
18
19 Xserver's select loop is reused to service spice client sockets
20 and the qxl driver is reused together with some of the qemu qxl device code
21
22 The following changes have been done to the qxl driver.
23 * it creates only one memslot, covering the whole of memory (much like
24 spice does in simple display mode, i.e. vga, and the tester does)
25 * it invokes the whole of the qxl device from qemu, patching in both
26 directions.
27 * io becomes a function call instead of iob
28 * irq becomes a function call instead of setting a flag
29 * it runs spice server directly
30 * it is linked with spice-server.
31
32 The protocol is unchanged.
33
34 = 2. Building =
35 == 2.1 Building from source on fedora ==
36
37 The changes for ubuntu/debian should be minimal:
38 * location of drivers for Xorg (just where you put any qxl_drv.so etc.)
39 * location of Xorg config files
40
41 In fedora they are: (note the lib64 - replace with lib if running on 32 bit
42 fedora)
43
44 DRV_DIR=/usr/lib64/xorg/modules/drivers
45 XORG_CONF_DIR=/etc/X11
46
47 git clone git://anongit.freedesktop.org/xorg/driver/xf86-video-qxl xspice
48 sudo yum install spice-server-devel spice-protocol
49
50 cd xspice
51 autoreconf -i && ./configure --enable-xspice && make
52 sudo cp src/.libs/spiceqxl_drv.so $DRV_DIR
53 sudo cp spiceqxl.xorg $XORG_CONF_DIR
54
55 Note: spiceqxl.org is copied to $XORG_CONF_DIR because Xorg only looks in a
56 very particular config file path, and "." is not there (nor are absolute file
57 names allowed unless Xorg is run as root).
58
59 == 2.2 Building from source with your own Xserver ==
60
61 Building the whole xserver is lengthier but can be done without
62 any root permissions.
63
64 This assumes you already have spice-protocol and spice-server
65 installed into $TEST prefix below.
66
67 TEST=/store/test ( or TEST=$(pwd)/testxspice )
68 mkdir -p $TEST/src
69 cd $TEST/src
70
71 # grab xserver, xspice, xextproto, xkbcomp and more
72 for src in \
73 git://anongit.freedesktop.org/xorg/proto/xextproto \
74 git://anongit.freedesktop.org/xorg/proto/x11proto \
75 git://anongit.freedesktop.org/xorg/proto/fontsproto \
76 git://anongit.freedesktop.org/xorg/app/xkbcomp \
77 git://anongit.freedesktop.org/xorg/xserver \
78 git://anongit.freedesktop.org/xorg/lib/libxtrans \
79 git://anongit.freedesktop.org/xorg/lib/libxkbfile \
80 git://anongit.freedesktop.org/xkeyboard-config \
81 git://git.freedesktop.org/git/spice/spice-protocol \
82 git://git.freedesktop.org/git/spice/spice ;
83 do
84 git clone $src;
85 done
86
87 git clone git://anongit.freedesktop.org/xorg/driver/xf86-video-qxl xspice
88
89
90 build and install into some non common prefix (not to overwrite
91 your existing server) - note that this is just for testing. This
92 should all work with the default server as well, but that server
93 requires root generally and this is undesirable for testing (and
94 running actually).
95
96 export PKG_CONFIG_PATH=${TEST}/lib/pkgconfig:${TEST}/share/pkgconfig
97 export MAKEFLAGS="-j4"
98
99 #first build spice (or sudo yum install spice-devel or spice-server-devel)
100 sudo yum-builddep spice (or spice-server)
101 (cd spice-protocol; ./autogen.sh --prefix=$TEST && make install)
102 (cd spice; ./autogen.sh --prefix=$TEST && make install)
103
104 # now build xserver
105 sudo yum install xorg-x11-server-devel libxcb-util-devel xcb-util-keysyms-devel libXfont-devel
106 (cd xextproto; ./autogen.sh --prefix=$TEST --without-xmlto && make install)
107 (cd x11proto; ./autogen.sh --prefix=$TEST && make install)
108 (cd fontsproto; ./autogen.sh --prefix=$TEST && make install)
109 (cd libxtrans; ./autogen.sh --prefix=$TEST && make install)
110 (cd libxkbfile; ./autogen.sh --prefix=$TEST && make install)
111 (cd xkbcomp; ./autogen.sh --prefix=$TEST && make install)
112 (cd xkeyboard-config; ./autogen.sh --prefix=$TEST && make install)
113
114
115 # make sure DBUS_TYPE_UNIX_FD is defined (failed on my RHEL6 machine)
116 ADDSTR="#ifndef DBUS_TYPE_UNIX_FD\n"
117 ADDSTR+="#define DBUS_TYPE_UNIX_FD ((int) 'h')\n"
118 ADDSTR+="#endif"
119 sed -i "/define DBUS_TIMEOUT/ a$ADDSTR" \
120 xserver/hw/xfree86/os-support/linux/systemd-logind.c
121
122 # need ACLOCAL for libxtrans
123 export ACLOCAL="aclocal -I $TEST/share/aclocal"
124 (cd xserver; ./autogen.sh --prefix=$TEST && make install)
125
126 # and now xspice
127 (cd xspice; ./autogen.sh --prefix=$TEST --enable-xspice && make install)
128
129 mkdir -p $TEST/etc/X11
130 cp xspice/examples/spiceqxl.xorg.conf.example $TEST/etc/X11/spiceqxl.xorg.conf
131
132 # Possibly also build spice-vdagent:
133 sudo yum install libXrandr-devel libXinerama-devel
134 git clone git://anongit.freedesktop.org/spice/linux/vd_agent spice-vdagent
135 (cd spice-vdagent ; ./autogen.sh --prefix=$TEST && make install)
136
137 = 3. Running =
138 $XORG is either your own built $TEST/bin/Xorg or just the default Xorg
139
140 If you built your own Xorg server:
141 export PATH="$TEST/bin:$TEST/sbin:$PATH"
142 export LD_LIBRARY_PATH=${TEST}/lib
143 export XORG=$TEST/bin/Xorg # or /usr/bin/Xorg
144
145 == 3.1 Run Xorg directly ==
146 Run server with:
147 export XSPICE_PORT=5900
148 $XORG -noreset -config spiceqxl.xorg.conf :3.0
149
150 == 3.2 Run using the Xspice script ==
151 Or equivalently:
152
153 xspice/scripts/Xspice --port 5900 --disable-ticketing --xorg $XORG :3.0 [--vdagent]
154 (and many more options available -- see scripts/Xspice)
155
156 Run X clients as usual by setting DISPLAY=:3.0, for example
157 # DISPLAY=:3.0 firefox & or
158 # DISPLAY=:3.0 twm & DISPLAY=:3.0 xterm &
159
160 Run spice client:
161 sudo yum install virt-viewer
162 remote-viewer spice://localhost:5900
163
164