README.md
README.xspice
11. Introduction
22. Building
32.1 Building from source on fedora
42.2 Building from source with your own Xserver
53. Running
6
7= 1. Introduction =
8Xspice is an X server and Spice server in one. It consists of a wrapper script
9for executing Xorg with the right parameters and environment variables, a
10module names spiceqxl_drv.so implementing three drivers: a video mostly
11code identical to the guest qxl X driver, and keyboard and mouse reading from
12the spice inputs channel.
13
14Xspice allows regular X connections, while a spice client provides the keyboard
15and mouse and video output.
16
17Spice client disconnections don't impact X client connections.
18
19Xserver's select loop is reused to service spice client sockets
20and the qxl driver is reused together with some of the qemu qxl device code
21
22The 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
32The protocol is unchanged.
33
34= 2. Building =
35== 2.1 Building from source on fedora ==
36
37The 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
41In fedora they are: (note the lib64 - replace with lib if running on 32 bit
42fedora)
43
44DRV_DIR=/usr/lib64/xorg/modules/drivers
45XORG_CONF_DIR=/etc/X11
46
47git clone git://anongit.freedesktop.org/xorg/driver/xf86-video-qxl xspice
48sudo yum install spice-server-devel spice-protocol
49
50cd xspice
51autoreconf -i && ./configure --enable-xspice && make
52sudo cp src/.libs/spiceqxl_drv.so $DRV_DIR
53sudo cp spiceqxl.xorg $XORG_CONF_DIR
54
55Note: spiceqxl.org is copied to $XORG_CONF_DIR because Xorg only looks in a
56very particular config file path, and "." is not there (nor are absolute file
57names allowed unless Xorg is run as root).
58
59== 2.2 Building from source with your own Xserver ==
60
61Building the whole xserver is lengthier but can be done without
62any root permissions.
63
64This assumes you already have spice-protocol and spice-server
65installed into $TEST prefix below.
66
67TEST=/store/test ( or TEST=$(pwd)/testxspice )
68mkdir -p $TEST/src
69cd $TEST/src
70
71# grab xserver, xspice, xextproto, xkbcomp and more
72for 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 ;
83do
84 git clone $src;
85done
86
87git clone git://anongit.freedesktop.org/xorg/driver/xf86-video-qxl xspice
88
89
90build and install into some non common prefix (not to overwrite
91your existing server) - note that this is just for testing. This
92should all work with the default server as well, but that server
93requires root generally and this is undesirable for testing (and
94running actually).
95
96export PKG_CONFIG_PATH=${TEST}/lib/pkgconfig:${TEST}/share/pkgconfig
97export MAKEFLAGS="-j4"
98
99#first build spice (or sudo yum install spice-devel or spice-server-devel)
100sudo 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
105sudo 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)
116ADDSTR="#ifndef DBUS_TYPE_UNIX_FD\n"
117ADDSTR+="#define DBUS_TYPE_UNIX_FD ((int) 'h')\n"
118ADDSTR+="#endif"
119sed -i "/define DBUS_TIMEOUT/ a$ADDSTR" \
120 xserver/hw/xfree86/os-support/linux/systemd-logind.c
121
122# need ACLOCAL for libxtrans
123export 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
129mkdir -p $TEST/etc/X11
130cp xspice/examples/spiceqxl.xorg.conf.example $TEST/etc/X11/spiceqxl.xorg.conf
131
132# Possibly also build spice-vdagent:
133sudo yum install libXrandr-devel libXinerama-devel
134git 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
140If you built your own Xorg server:
141export PATH="$TEST/bin:$TEST/sbin:$PATH"
142export LD_LIBRARY_PATH=${TEST}/lib
143export XORG=$TEST/bin/Xorg # or /usr/bin/Xorg
144
145== 3.1 Run Xorg directly ==
146Run server with:
147export XSPICE_PORT=5900
148$XORG -noreset -config spiceqxl.xorg.conf :3.0
149
150== 3.2 Run using the Xspice script ==
151Or equivalently:
152
153xspice/scripts/Xspice --port 5900 --disable-ticketing --xorg $XORG :3.0 [--vdagent]
154(and many more options available -- see scripts/Xspice)
155
156Run 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
160Run spice client:
161sudo yum install virt-viewer
162remote-viewer spice://localhost:5900
163
164