Skip to contentSkip to conversation

initial spice support.

PATCH Superseded Gerd Hoffmann 3 participants 20 messages Aug 27, 2010 – Aug 31, 2010 Kbuild

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover initial spice support.

Hi,

Here comes v4 of the iniial spice support patch series, hopefully the final version. It brings just the very basic bits:

* Detect spice in configure, Makefile windup.
* Support for keyboard, mouse and tablet.
* Support for simple display output (works as DisplayChangeListener, plays with any gfx card, sends simple draw commands to update dirty regions).

Note that this patch series does *not* yet contain the qxl paravirtual gfx card. That will come as part of a additional patch series after sorting the vgabios support.

The patches are also available in the git repository at:
git://anongit.freedesktop.org/spice/qemu submit.4

Changes since v3:
* Drop global spice_server variable, provide a thin wrapper function instead so spice interfaces can be registered without needing spice_server.
* Update locking comments.

Changes since v2:
* Add copyright headers to the files.
* Add dprint for debug logging.
* Add mapping for buttons and leds.
* Add comments for locking+threads.
* Drop includes which qemu-common.h brings in.
* Compile -spice switch unconditionally.
* Hook up spice init using module.h, drop #ifdefs.
* Misc minor tweaks.

Gerd Hoffmann (10):
Use display types for local display only. Use machine_init() to register virtfs config options. add pflib: PixelFormat conversion library.
configure: add logging
add spice into the configure file
spice: core bits
spice: add keyboard
spice: add mouse
spice: simple display
spice: add tablet support

 Makefile.objs      |    3 +
 configure          |   42 +++++-
 fsdev/qemu-fsdev.c |    9 +
 pflib.c            |  213 +++++++++++++++++++++++++++
 pflib.h            |   20 +++
 qemu-config.c      |   18 +++
 qemu-config.h      |    1 +
 qemu-options.hx    |   21 +++
 sysemu.h           |    1 -
 ui/qemu-spice.h    |   41 +++++
 ui/spice-core.c    |  183 +++++++++++++++++++++++
 ui/spice-display.c |  410 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 ui/spice-display.h |   69 +++++++++
 ui/spice-input.c   |  208 ++++++++++++++++++++++++++
 vl.c               |   49 ++++--
 15 files changed, 1269 insertions(+), 19 deletions(-)
 create mode 100644 pflib.c
 create mode 100644 pflib.h
 create mode 100644 ui/qemu-spice.h
 create mode 100644 ui/spice-core.c
 create mode 100644 ui/spice-display.c
 create mode 100644 ui/spice-display.h
 create mode 100644 ui/spice-input.c
#1 lore raw

PATCH v4 1/10 Use display types for local display only.

This patch drops DT_VNC. The display types are only used to select select the local display (i.e. curses, sdl, coca, ...). Remote displays (for now only vnc, spice will follow) can be enabled independently.

---
 sysemu.h |    1 -
 vl.c     |   24 +++++++++++++-----------
 2 files changed, 13 insertions(+), 12 deletions(-)
sysemu.h +0 -1
index a1f6466..b81a70e 100644
@@ -94,7 +94,6 @@ typedef enum DisplayType
     DT_DEFAULT,
     DT_CURSES,
     DT_SDL,
-    DT_VNC,
     DT_NOGRAPHIC,
 } DisplayType;
 
vl.c +13 -11
index 91d1684..d90b275 100644
@@ -172,6 +172,7 @@ static const char *data_dir;
 const char *bios_name = NULL;
 enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
 DisplayType display_type = DT_DEFAULT;
+int display_remote = 0;
 const char* keyboard_layout = NULL;
 ram_addr_t ram_size;
 const char *mem_path = NULL;
@@ -2468,7 +2469,7 @@ int main(int argc, char **argv, char **envp)
                 }
                 break;
 	    case QEMU_OPTION_vnc:
-                display_type = DT_VNC;
+                display_remote++;
 		vnc_display = optarg;
 		break;
             case QEMU_OPTION_no_acpi:
@@ -2898,17 +2899,17 @@ int main(int argc, char **argv, char **envp)
     /* just use the first displaystate for the moment */
     ds = get_displaystate();
 
-    if (display_type == DT_DEFAULT) {
+    if (display_type == DT_DEFAULT && !display_remote) {
 #if defined(CONFIG_SDL) || defined(CONFIG_COCOA)
         display_type = DT_SDL;
 #else
-        display_type = DT_VNC;
         vnc_display = "localhost:0,to=99";
         show_vnc_port = 1;
 #endif
     }
         
 
+    /* init local displays */
     switch (display_type) {
     case DT_NOGRAPHIC:
         break;
@@ -2926,7 +2927,12 @@ int main(int argc, char **argv, char **envp)
         cocoa_display_init(ds, full_screen);
         break;
 #endif
-    case DT_VNC:
+    default:
+        break;
+    }
+
+    /* init remote displays */
+    if (vnc_display) {
         vnc_display_init(ds);
         if (vnc_display_open(ds, vnc_display) < 0)
             exit(1);
@@ -2934,12 +2940,10 @@ int main(int argc, char **argv, char **envp)
         if (show_vnc_port) {
             printf("VNC server running on `%s'\n", vnc_display_local_addr(ds));
         }
-        break;
-    default:
-        break;
     }
-    dpy_resize(ds);
 
+    /* display setup */
+    dpy_resize(ds);
     dcl = ds->listeners;
     while (dcl != NULL) {
         if (dcl->dpy_refresh != NULL) {
@@ -2949,12 +2953,10 @@ int main(int argc, char **argv, char **envp)
         }
         dcl = dcl->next;
     }
-
-    if (display_type == DT_NOGRAPHIC || display_type == DT_VNC) {
+    if (ds->gui_timer == NULL) {
         nographic_timer = qemu_new_timer(rt_clock, nographic_update, NULL);
         qemu_mod_timer(nographic_timer, qemu_get_clock(rt_clock));
     }
-
     text_consoles_set_display(ds);
 
     if (gdbstub_dev && gdbserver_start(gdbstub_dev) < 0) {
Signature · 1 line
1.7.1
#2 lore raw

PATCH v4 2/10 Use machine_init() to register virtfs config options.

In reply to Gerd Hoffmann
---
 fsdev/qemu-fsdev.c |    9 +++++++++
 vl.c               |    5 -----
 2 files changed, 9 insertions(+), 5 deletions(-)
fsdev/qemu-fsdev.c +9 -0
index ad69b0e..280b8f5 100644
@@ -16,6 +16,7 @@
 #include "qemu-queue.h"
 #include "osdep.h"
 #include "qemu-common.h"
+#include "qemu-config.h"
 
 static QTAILQ_HEAD(FsTypeEntry_head, FsTypeListEntry) fstype_entries =
     QTAILQ_HEAD_INITIALIZER(fstype_entries);
@@ -75,3 +76,11 @@ FsTypeEntry *get_fsdev_fsentry(char *id)
     }
     return NULL;
 }
+
+static void fsdev_register_config(void)
+{
+    qemu_add_opts(&qemu_fsdev_opts);
+    qemu_add_opts(&qemu_virtfs_opts);
+}
+machine_init(fsdev_register_config);
+
vl.c +0 -5
index d90b275..40bf30b 100644
@@ -1856,11 +1856,6 @@ int main(int argc, char **argv, char **envp)
     tb_size = 0;
     autostart= 1;
 
-#ifdef CONFIG_VIRTFS
-    qemu_add_opts(&qemu_fsdev_opts);
-    qemu_add_opts(&qemu_virtfs_opts);
-#endif
-
     /* first pass of option parsing */
     optind = 1;
     while (optind < argc) {
Signature · 1 line
1.7.1
#3 lore raw

PATCH v4 3/10 add pflib: PixelFormat conversion library.

In reply to Gerd Hoffmann
---
 Makefile.objs |    1 +
 pflib.c       |  213 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 pflib.h       |   20 ++++++
 3 files changed, 234 insertions(+), 0 deletions(-)
 create mode 100644 pflib.c
 create mode 100644 pflib.h
Makefile.objs +1 -0
index 4a1eaa1..edfca87 100644
@@ -83,6 +83,7 @@ common-obj-y += qemu-char.o savevm.o #aio.o
 common-obj-y += msmouse.o ps2.o
 common-obj-y += qdev.o qdev-properties.o
 common-obj-y += block-migration.o
+common-obj-y += pflib.o
 
 common-obj-$(CONFIG_BRLAPI) += baum.o
 common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o
pflib.c new file +213 -0

213 lines not on this page · raw message

pflib.h new file +20 -0
new file mode 100644
index 0000000..b70c313
@@ -0,0 +1,20 @@
+#ifndef __QEMU_PFLIB_H
+#define __QEMU_PFLIB_H
+
+/*
+ * PixelFormat conversion library.
+ *
+ * Author: Gerd Hoffmann <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+typedef struct QemuPfConv QemuPfConv;
+
+QemuPfConv *qemu_pf_conv_get(PixelFormat *dst, PixelFormat *src);
+void qemu_pf_conv_run(QemuPfConv *conv, void *dst, void *src, uint32_t cnt);
+void qemu_pf_conv_put(QemuPfConv *conv);
+
+#endif
Signature · 1 line
1.7.1
#4 lore raw

PATCH v4 4/10 configure: add logging

In reply to Gerd Hoffmann

Write compile commands and messages to config.log. Useful for debugging configure.

---
 configure |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
configure +5 -2
index 146dac0..0639b33 100755
@@ -16,15 +16,18 @@ TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
 TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
 
 trap "rm -f $TMPC $TMPO $TMPE ; exit" EXIT INT QUIT TERM
+rm -f config.log
 
 compile_object() {
-  $cc $QEMU_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
+  echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log
+  $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
 }
 
 compile_prog() {
   local_cflags="$1"
   local_ldflags="$2"
-  $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags > /dev/null 2> /dev/null
+  echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log
+  $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1
 }
 
 # check whether a command is available to this shell (may be either an
Signature · 1 line
1.7.1
#5 lore raw

PATCH v4 5/10 add spice into the configure file

In reply to Gerd Hoffmann
---
 configure |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
configure +35 -0
index 0639b33..b391165 100755
@@ -320,6 +320,7 @@ pkgversion=""
 check_utests="no"
 user_pie="no"
 zero_malloc=""
+spice=""
 
 # OS specific
 if check_define __linux__ ; then
@@ -621,6 +622,10 @@ for opt do
   ;;
   --enable-kvm) kvm="yes"
   ;;
+  --disable-spice) spice="no"
+  ;;
+  --enable-spice) spice="yes"
+  ;;
   --enable-profiler) profiler="yes"
   ;;
   --enable-cocoa)
@@ -900,6 +905,8 @@ echo "  --enable-docs            enable documentation build"
 echo "  --disable-docs           disable documentation build"
 echo "  --disable-vhost-net      disable vhost-net acceleration support"
 echo "  --enable-vhost-net       enable vhost-net acceleration support"
+echo "  --disable-spice          disable spice"
+echo "  --enable-spice           enable spice"
 echo ""
 echo "NOTE: The object files are built at the place where configure is launched"
 exit 1
@@ -2050,6 +2057,29 @@ if compile_prog "" ""; then
     gcc_attribute_warn_unused_result=yes
 fi
 
+# spice probe
+if test "$spice" != "no" ; then
+  cat > $TMPC << EOF
+#include <spice.h>
+int main(void) { spice_server_new(); return 0; }
+EOF
+  spice_cflags=$($pkgconfig --cflags spice-protocol spice-server 2>/dev/null)
+  spice_libs=$($pkgconfig --libs spice-protocol spice-server 2>/dev/null)
+  if $pkgconfig --atleast-version=0.5.3 spice-server &&\
+     compile_prog "$spice_cflags" "$spice_libs" ; then
+    spice="yes"
+    libs_softmmu="$libs_softmmu $spice_libs"
+    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
+  else
+    if test "$spice" = "yes" ; then
+      feature_not_found "spice"
+    fi
+    spice="no"
+  fi
+fi
+
+##########################################
+
 ##########################################
 # check if we have fdatasync
 
@@ -2192,6 +2222,7 @@ echo "preadv support    $preadv"
 echo "fdatasync         $fdatasync"
 echo "uuid support      $uuid"
 echo "vhost-net support $vhost_net"
+echo "spice support     $spice"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -2429,6 +2460,10 @@ if test "$fdatasync" = "yes" ; then
   echo "CONFIG_FDATASYNC=y" >> $config_host_mak
 fi
 
+if test "$spice" = "yes" ; then
+  echo "CONFIG_SPICE=y" >> $config_host_mak
+fi
+
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
   echo "CONFIG_BSD=y" >> $config_host_mak
Signature · 1 line
1.7.1
#6 lore raw

PATCH v4 6/10 spice: core bits

In reply to Gerd Hoffmann

Add -spice command line switch. Has support setting passwd and port for now. With this patch applied the spice client can successfully connect to qemu. You can't do anything useful yet though.

---
 Makefile.objs   |    2 +
 qemu-config.c   |   18 ++++++
 qemu-config.h   |    1 +
 qemu-options.hx |   21 +++++++
 ui/qemu-spice.h |   39 ++++++++++++
 ui/spice-core.c |  181 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 vl.c            |   15 +++++
 7 files changed, 277 insertions(+), 0 deletions(-)
 create mode 100644 ui/qemu-spice.h
 create mode 100644 ui/spice-core.c
Makefile.objs +2 -0
index edfca87..1a53027 100644
@@ -88,6 +88,8 @@ common-obj-y += pflib.o
 common-obj-$(CONFIG_BRLAPI) += baum.o
 common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o
 
+common-obj-$(CONFIG_SPICE) += ui/spice-core.o
+
 audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
 audio-obj-$(CONFIG_SDL) += sdlaudio.o
 audio-obj-$(CONFIG_OSS) += ossaudio.o
qemu-config.c +18 -0
index 3abe655..4c47cd0 100644
@@ -336,6 +336,24 @@ static QemuOptsList qemu_cpudef_opts = {
     },
 };
 
+QemuOptsList qemu_spice_opts = {
+    .name = "spice",
+    .head = QTAILQ_HEAD_INITIALIZER(qemu_spice_opts.head),
+    .desc = {
+        {
+            .name = "port",
+            .type = QEMU_OPT_NUMBER,
+        },{
+            .name = "password",
+            .type = QEMU_OPT_STRING,
+        },{
+            .name = "disable-ticketing",
+            .type = QEMU_OPT_BOOL,
+        },
+        { /* end if list */ }
+    },
+};
+
 static QemuOptsList *vm_config_groups[32] = {
     &qemu_drive_opts,
     &qemu_chardev_opts,
qemu-config.h +1 -0
index 533a049..20d707f 100644
@@ -3,6 +3,7 @@
 
 extern QemuOptsList qemu_fsdev_opts;
 extern QemuOptsList qemu_virtfs_opts;
+extern QemuOptsList qemu_spice_opts;
 
 QemuOptsList *qemu_find_opts(const char *group);
 void qemu_add_opts(QemuOptsList *list);
qemu-options.hx +21 -0
index 453f129..87bd451 100644
@@ -670,6 +670,27 @@ STEXI
 Enable SDL.
 ETEXI
 
+DEF("spice", HAS_ARG, QEMU_OPTION_spice,
+    "-spice <args>   enable spice\n", QEMU_ARCH_ALL)
+STEXI
+@item -spice @var{option}[,@var{option}[,...]]
+@findex -spice
+Enable the spice remote desktop protocol. Valid options are
+
+@table @option
+
+@item port=<nr>
+Set the TCP port spice is listening on.
+
+@item password=<secret>
+Set the password you need to authenticate.
+
+@item disable-ticketing
+Allow client connects without authentication.
+
+@end table
+ETEXI
+
 DEF("portrait", 0, QEMU_OPTION_portrait,
     "-portrait       rotate graphical output 90 deg left (only PXA LCD)\n",
     QEMU_ARCH_ALL)
ui/qemu-spice.h new file +39 -0
new file mode 100644
index 0000000..50faefb
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef QEMU_SPICE_H
+#define QEMU_SPICE_H
+
+#ifdef CONFIG_SPICE
+
+#include <spice.h>
+
+#include "qemu-option.h"
+#include "qemu-config.h"
+
+extern int using_spice;
+
+void qemu_spice_init(void);
+int qemu_spice_add_interface(SpiceBaseInstance *sin);
+
+#else  /* CONFIG_SPICE */
+
+#define using_spice 0
+
+#endif /* CONFIG_SPICE */
+
+#endif /* QEMU_SPICE_H */
ui/spice-core.c new file +181 -0

181 lines not on this page · raw message

vl.c +15 -0
index 40bf30b..a8c2a33 100644
@@ -161,6 +161,8 @@ int main(int argc, char **argv)
 #include "cpus.h"
 #include "arch_init.h"
 
+#include "ui/qemu-spice.h"
+
 //#define DEBUG_NET
 //#define DEBUG_SLIRP
 
@@ -2599,6 +2601,19 @@ int main(int argc, char **argv, char **envp)
                     }
                     break;
                 }
+            case QEMU_OPTION_spice:
+                olist = qemu_find_opts("spice");
+                if (!olist) {
+                    fprintf(stderr, "spice is not supported by this qemu build.\n");
+                    exit(1);
+                }
+                opts = qemu_opts_parse(olist, optarg, 0);
+                if (!opts) {
+                    fprintf(stderr, "parse error: %s\n", optarg);
+                    exit(1);
+                }
+                display_remote++;
+                break;
             case QEMU_OPTION_writeconfig:
                 {
                     FILE *fp;
Signature · 1 line
1.7.1
#7 lore raw

PATCH v4 7/10 spice: add keyboard

In reply to Gerd Hoffmann

Open keyboard channel. Now you can type into the spice client and the keyboard events are sent to your guest. You'll need some other display like vnc to actually see the guest responding to them though.

---
 Makefile.objs    |    2 +-
 ui/qemu-spice.h  |    1 +
 ui/spice-core.c  |    2 +
 ui/spice-input.c |   82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 86 insertions(+), 1 deletions(-)
 create mode 100644 ui/spice-input.c
Makefile.objs +1 -1
index 1a53027..20e6ad7 100644
@@ -88,7 +88,7 @@ common-obj-y += pflib.o
 common-obj-$(CONFIG_BRLAPI) += baum.o
 common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o
 
-common-obj-$(CONFIG_SPICE) += ui/spice-core.o
+common-obj-$(CONFIG_SPICE) += ui/spice-core.o ui/spice-input.o
 
 audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
 audio-obj-$(CONFIG_SDL) += sdlaudio.o
ui/qemu-spice.h +1 -0
index 50faefb..175c961 100644
@@ -28,6 +28,7 @@
 extern int using_spice;
 
 void qemu_spice_init(void);
+void qemu_spice_input_init(void);
 int qemu_spice_add_interface(SpiceBaseInstance *sin);
 
 #else  /* CONFIG_SPICE */
ui/spice-core.c +2 -0
index 178d740..07d6a0c 100644
@@ -161,6 +161,8 @@ void qemu_spice_init(void)
 
     spice_server_init(spice_server, &core_interface);
     using_spice = 1;
+
+    qemu_spice_input_init();
 }
 
 int qemu_spice_add_interface(SpiceBaseInstance *sin)
ui/spice-input.c new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
1.7.1
#8 lore raw

PATCH v4 8/10 spice: add mouse

In reply to Gerd Hoffmann

Open mouse channel. Now you can move the guests mouse pointer. No tablet / absolute positioning (yet) though.

---
 ui/spice-input.c |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)
ui/spice-input.c +49 -0
index efecc22..afb4d61 100644
@@ -71,12 +71,61 @@ static void kbd_leds(void *opaque, int ledstate)
     spice_server_kbd_leds(&kbd->sin, ledstate);
 }
 
+/* mouse bits */
+
+typedef struct QemuSpiceMouse {
+    SpiceMouseInstance sin;
+} QemuSpiceMouse;
+
+static int map_buttons(int spice_buttons)
+{
+    int qemu_buttons = 0;
+
+    /*
+     * Note: SPICE_MOUSE_BUTTON_* specifies the wire protocol but this
+     * isn't what we get passed in via interface callbacks for the
+     * middle and right button ...
+     */
+    if (spice_buttons & SPICE_MOUSE_BUTTON_MASK_LEFT)
+        qemu_buttons |= MOUSE_EVENT_LBUTTON;
+    if (spice_buttons & 0x04 /* SPICE_MOUSE_BUTTON_MASK_MIDDLE */)
+        qemu_buttons |= MOUSE_EVENT_MBUTTON;
+    if (spice_buttons & 0x02 /* SPICE_MOUSE_BUTTON_MASK_RIGHT */)
+        qemu_buttons |= MOUSE_EVENT_RBUTTON;
+    return qemu_buttons;
+}
+
+static void mouse_motion(SpiceMouseInstance *sin, int dx, int dy, int dz,
+                         uint32_t buttons_state)
+{
+    kbd_mouse_event(dx, dy, dz, map_buttons(buttons_state));
+}
+
+static void mouse_buttons(SpiceMouseInstance *sin, uint32_t buttons_state)
+{
+    kbd_mouse_event(0, 0, 0, map_buttons(buttons_state));
+}
+
+static const SpiceMouseInterface mouse_interface = {
+    .base.type          = SPICE_INTERFACE_MOUSE,
+    .base.description   = "mouse",
+    .base.major_version = SPICE_INTERFACE_MOUSE_MAJOR,
+    .base.minor_version = SPICE_INTERFACE_MOUSE_MINOR,
+    .motion             = mouse_motion,
+    .buttons            = mouse_buttons,
+};
+
 void qemu_spice_input_init(void)
 {
     QemuSpiceKbd *kbd;
+    QemuSpiceMouse *mouse;
 
     kbd = qemu_mallocz(sizeof(*kbd));
     kbd->sin.base.sif = &kbd_interface.base;
     qemu_spice_add_interface(&kbd->sin.base);
     qemu_add_led_event_handler(kbd_leds, kbd);
+
+    mouse = qemu_mallocz(sizeof(*mouse));
+    mouse->sin.base.sif = &mouse_interface.base;
+    qemu_spice_add_interface(&mouse->sin.base);
 }
Signature · 1 line
1.7.1
#9 lore raw

PATCH v4 9/10 spice: simple display

In reply to Gerd Hoffmann

With that patch applied you'll actually see the guests screen in the spice client. This does *not* bring qxl and full spice support though. This is basically the qxl vga mode made more generic, so it plays together with any qemu-emulated gfx card. You can display stdvga or cirrus via spice client. You can have both vnc and spice enabled and clients connected at the same time.

---
 Makefile.objs      |    2 +-
 ui/qemu-spice.h    |    1 +
 ui/spice-display.c |  410 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 ui/spice-display.h |   69 +++++++++
 vl.c               |    5 +
 5 files changed, 486 insertions(+), 1 deletions(-)
 create mode 100644 ui/spice-display.c
 create mode 100644 ui/spice-display.h
Makefile.objs +1 -1
index 20e6ad7..d09a1e4 100644
@@ -88,7 +88,7 @@ common-obj-y += pflib.o
 common-obj-$(CONFIG_BRLAPI) += baum.o
 common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o
 
-common-obj-$(CONFIG_SPICE) += ui/spice-core.o ui/spice-input.o
+common-obj-$(CONFIG_SPICE) += ui/spice-core.o ui/spice-input.o ui/spice-display.o
 
 audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
 audio-obj-$(CONFIG_SDL) += sdlaudio.o
ui/qemu-spice.h +1 -0
index 175c961..063c7dc 100644
@@ -29,6 +29,7 @@ extern int using_spice;
 
 void qemu_spice_init(void);
 void qemu_spice_input_init(void);
+void qemu_spice_display_init(DisplayState *ds);
 int qemu_spice_add_interface(SpiceBaseInstance *sin);
 
 #else  /* CONFIG_SPICE */
ui/spice-display.c new file +410 -0

410 lines not on this page · raw message

ui/spice-display.h new file +69 -0

69 lines not on this page · raw message

vl.c +5 -0
index a8c2a33..a5229ad 100644
@@ -2951,6 +2951,11 @@ int main(int argc, char **argv, char **envp)
             printf("VNC server running on `%s'\n", vnc_display_local_addr(ds));
         }
     }
+#ifdef CONFIG_SPICE
+    if (using_spice) {
+        qemu_spice_display_init(ds);
+    }
+#endif
 
     /* display setup */
     dpy_resize(ds);
Signature · 1 line
1.7.1
#10 lore raw

Re: [Qemu-devel] [PATCH v4 09/10] spice: simple display

Quoted 9 lines · Gerd Hoffmann

With that patch applied you'll actually see the guests screen in the spice client. This does *not* bring qxl and full spice support though. This is basically the qxl vga mode made more generic, so it plays together with any qemu-emulated gfx card. You can display stdvga or cirrus via spice client. You can have both vnc and spice enabled and clients connected at the same time.

[snip]

Quoted 8 lines

+/*
+ * Called from spice server thread context (via interface_get_command).
+ * We do *not* hold the global qemu mutex here, so extra care is needed
+ * when calling qemu functions. Qemu interfaces used:
+ * - pflib (is re-entrant).
+ * - qemu_malloc (underlying glibc malloc is re-entrant).
+ */

Thanks, that's exactly what I was looking for.

Regards,

Anthony Liguori

#11 lore raw

PATCH v4 10/10 spice: add tablet support

In reply to Gerd Hoffmann

Add support for the spice tablet interface. The tablet interface will be registered (and then used by the spice client) as soon as a absolute pointing device is available and used by the guest, i.e. you'll have to configure your guest with '-usbdevice tablet'.

---
 ui/spice-display.c |    2 +-
 ui/spice-input.c   |   91 ++++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 85 insertions(+), 8 deletions(-)
ui/spice-display.c +1 -1
index 9e11fb3..30dfb9f 100644
@@ -177,7 +177,7 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd)
     surface.width      = ds_get_width(ssd->ds);
     surface.height     = ds_get_height(ssd->ds);
     surface.stride     = -surface.width * 4;
-    surface.mouse_mode = 0;
+    surface.mouse_mode = true;
     surface.flags      = 0;
     surface.type       = 0;
     surface.mem        = (intptr_t)ssd->buf;
ui/spice-input.c +84 -7

116 lines not on this page · raw message

Signature · 1 line
1.7.1
#12 lore raw
In reply to Gerd Hoffmann
Quoted 11 lines · Gerd Hoffmann

 Hi,

Here comes v4 of the iniial spice support patch series, hopefully the final version.  It brings just the very basic bits:

 * Detect spice in configure, Makefile windup.
 * Support for keyboard, mouse and tablet.
 * Support for simple display output (works as DisplayChangeListener, plays with any gfx card, sends simple draw commands to update dirty regions).

Quoted 6 lines

Note that this patch series does *not* yet contain the qxl paravirtual gfx card.  That will come as part of a additional patch series after sorting the vgabios support.

The patches are also available in the git repository at:
 git://anongit.freedesktop.org/spice/qemu submit.4

Please read CODING_STYLE, especially the braces rule.

#13 lore raw
Quoted 12 lines · Blue Swirl
Quoted 11 lines · Gerd Hoffmann

Hi,

Here comes v4 of the iniial spice support patch series, hopefully the final version. It brings just the very basic bits:

* Detect spice in configure, Makefile windup.
* Support for keyboard, mouse and tablet.
* Support for simple display output (works as DisplayChangeListener, plays with any gfx card, sends simple draw commands to update dirty regions).

Quoted 8 lines
Quoted 6 lines

Note that this patch series does *not* yet contain the qxl paravirtual gfx card. That will come as part of a additional patch series after sorting the vgabios support.

The patches are also available in the git repository at:
git://anongit.freedesktop.org/spice/qemu submit.4

Please read CODING_STYLE, especially the braces rule.

I'm aware of the coding style. I'm also aware of the recent flam^Wdiscussions on that topic, especially the braces rule. I didn't read the whole thread though. Is there some result? If so, can someone summarize please?

thanks,
Gerd

#14 lore raw
Quoted 19 lines · Gerd Hoffmann
Quoted 18 lines · Blue Swirl
Quoted 16 lines · Gerd Hoffmann

 Hi,

Here comes v4 of the iniial spice support patch series, hopefully the final version.  It brings just the very basic bits:

 * Detect spice in configure, Makefile windup.
 * Support for keyboard, mouse and tablet.
 * Support for simple display output (works as DisplayChangeListener, plays with any gfx card, sends simple draw commands to update dirty regions).

Note that this patch series does *not* yet contain the qxl paravirtual gfx card.  That will come as part of a additional patch series after sorting the vgabios support.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

The patches are also available in the git repository at:
 git://anongit.freedesktop.org/spice/qemu submit.4

Please read CODING_STYLE, especially the braces rule.

I'm aware of the coding style.

Wilful misconduct? May I ask if there are other things that you don't agree with and you are covertly working against?

Quoted 4 lines

 I'm also aware of the recent
flam^Wdiscussions on that topic, especially the braces rule.  I didn't read the whole thread though.  Is there some result?  If so, can someone summarize please?

There was no conclusion. One point that was raised is that reformatting of existing code was seen problematic. That would mean that if offending code is let in, it will never be fixed.

#15 lore raw
Quoted 4 lines · Blue Swirl

Wilful misconduct? May I ask if there are other things that you don't agree with and you are covertly working against?

:-)

Braces should be used. The discussion was about enforcing coding style at commit time and reformatting code.

But for the most part, people agree that we want braces to be used on single line ifs.

Regards,

Anthony Liguori

#16 lore raw
Quoted 4 lines · Anthony Liguori
Quoted 3 lines · Blue Swirl

Wilful misconduct? May I ask if there are other things that you don't agree with and you are covertly working against?

I'm just not used to it. Changing habits takes time.

I think I became better meanwhile on avoiding "if (NULL == ptr)" ;)

Quoted 2 lines

Braces should be used. The discussion was about enforcing coding style at commit time and reformatting code.

The discussion started with unhappiness about the current situation (code not matching code style being committed). I've seen messages discussing whenever we should change code style or commit policy. I qickly stopped following the huge thread though, thats why I ask.

Quoted 2 lines

But for the most part, people agree that we want braces to be used on single line ifs.

Ok, so code style stays as-is. Anyone has a code style git commit hook ready for me? So I can let git do the style review and I don't waste everybody's time with that boring stuff?

thanks,
Gerd

#17 lore raw
Quoted 10 lines · Gerd Hoffmann
Quoted 5 lines · Anthony Liguori
Quoted 3 lines · Blue Swirl

Wilful misconduct? May I ask if there are other things that you don't agree with and you are covertly working against?

I'm just not used to it.  Changing habits takes time.

I think I became better meanwhile on avoiding "if (NULL == ptr)" ;)

Thank you! I'm also just not used to that ;-)

Quoted 8 lines
Quoted 2 lines

Braces should be used. The discussion was about enforcing coding style at commit time and reformatting code.

The discussion started with unhappiness about the current situation (code not matching code style being committed).  I've seen messages discussing whenever we should change code style or commit policy.  I qickly stopped following the huge thread though, thats why I ask.

Quoted 6 lines
Quoted 2 lines

But for the most part, people agree that we want braces to be used on single line ifs.

Ok, so code style stays as-is.  Anyone has a code style git commit hook ready for me?  So I can let git do the style review and I don't waste everybody's time with that boring stuff?

That's the plan. I tried Coccinelle but there were other problems with that approach.

#18 lore raw
In reply to Anthony Liguori

Hi,

Quoted 2 lines

But for the most part, people agree that we want braces to be used on single line ifs.

Ok. Got a bunch of incremental fixes committed locally. How to go forward now? Want me to respin or can I send those codestyle fixups as part of the next spice patch series?

BTW: what is the plan for the vgabios patches?

cheers,
Gerd

#19 lore raw
Quoted 6 lines · Gerd Hoffmann

Hi,

Quoted 2 lines

But for the most part, people agree that we want braces to be used on single line ifs.

Ok. Got a bunch of incremental fixes committed locally. How to go forward now? Want me to respin or can I send those codestyle fixups as part of the next spice patch series?

Send another series. I'm ready to merge it though.

Quoted 1 line

BTW: what is the plan for the vgabios patches?

In my queue to merge. Will do along side Spice. Updating vgabios is painful so I've been delaying it but it needs to be done.

Regards,

Anthony Liguori

Quoted 2 lines

cheers,
Gerd