Skip to contentSkip to conversation

spice: fix display initialization

PATCH Superseded Gerd Hoffmann 3 participants 3 messages Jul 22, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spice: fix display initialization

Spice has two display interface implementations: One integrated into the qxl graphics card, and one generic which can operate with every qemu-emulated graphics card.

The generic one is activated in case spice is used without qxl. The logic for that only catched the "-vga qxl" case, "-device qxl-vga" goes unnoticed. Fix that by adding a check in the spice interface registration so we'll notice the qxl card no matter how it is created.

---
 include/ui/qemu-spice.h |    2 ++
 ui/spice-core.c         |    5 +++++
 vl.c                    |    2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)
include/ui/qemu-spice.h +2 -0
index eba6d77..c6c756b 100644
@@ -27,6 +27,7 @@
 #include "monitor/monitor.h"
 
 extern int using_spice;
+extern int spice_displays;
 
 void qemu_spice_init(void);
 void qemu_spice_input_init(void);
@@ -57,6 +58,7 @@ static inline CharDriverState *qemu_chr_open_spice_port(const char *name)
 #include "monitor/monitor.h"
 
 #define using_spice 0
+#define spice_displays 0
 static inline int qemu_spice_set_passwd(const char *passwd,
                                         bool fail_if_connected,
                                         bool disconnect_if_connected)
ui/spice-core.c +5 -0
index f308fd9..f0da673 100644
@@ -48,6 +48,7 @@ static char *auth_passwd;
 static time_t auth_expires = TIME_MAX;
 static int spice_migration_completed;
 int using_spice = 0;
+int spice_displays;
 
 static QemuThread me;
 
@@ -836,6 +837,10 @@ int qemu_spice_add_interface(SpiceBaseInstance *sin)
         qemu_add_vm_change_state_handler(vm_change_state_handler, NULL);
     }
 
+    if (strcmp(sin->sif->type, SPICE_INTERFACE_QXL) == 0) {
+        spice_displays++;
+    }
+
     return spice_server_add_interface(spice_server, sin);
 }
 
vl.c +1 -1
index 0a8f056..440341f 100644
@@ -4340,7 +4340,7 @@ int main(int argc, char **argv, char **envp)
     }
 #endif
 #ifdef CONFIG_SPICE
-    if (using_spice && !qxl_enabled) {
+    if (using_spice && !spice_displays) {
         qemu_spice_display_init(ds);
     }
 #endif
Signature · 1 line
1.7.9.7
#1 lore raw

vl.c int main(int argc, char **argv, char **envp) · line 4343

Quoted 10 lines · Gerd Hoffmann
vl.c +1 -1
index 0a8f056..440341f 100644
@@ -4340,7 +4340,7 @@ int main(int argc, char **argv, char **envp)
     }
 #endif
 #ifdef CONFIG_SPICE
-    if (using_spice && !qxl_enabled) {
+    if (using_spice && !spice_displays) {

This removes the only use of the qxl_enabled macro, so we can drop it from sysemu.h, right?

vl.c int main(int argc, char **argv, char **envp)

Quoted 4 lines
vl.c +0 -1
         qemu_spice_display_init(ds);
     }
 #endif
--

thanks
-- PMM

#2 lore raw
In reply to Gerd Hoffmann
Quoted 6 lines · Gerd Hoffmann

Spice has two display interface implementations: One integrated into the qxl graphics card, and one generic which can operate with every qemu-emulated graphics card.

The generic one is activated in case spice is used without qxl. The logic for that only catched the "-vga qxl" case, "-device qxl-vga" goes

s/catched/caught/

Quoted 10 lines

unnoticed. Fix that by adding a check in the spice interface registration so we'll notice the qxl card no matter how it is created.

---
 include/ui/qemu-spice.h |    2 ++
 ui/spice-core.c         |    5 +++++
 vl.c                    |    2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

Looks like this will fix https://bugzilla.redhat.com/show_bug.cgi?id=981094

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org