render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame 0007-spice-fix-display-initialization.patch

67ad33
From 49c090ab950547cb807e90866439072a191513d1 Mon Sep 17 00:00:00 2001
67ad33
From: Gerd Hoffmann <kraxel@redhat.com>
67ad33
Date: Tue, 23 Jul 2013 13:55:43 +0200
67ad33
Subject: [PATCH] spice: fix display initialization
67ad33
67ad33
Spice has two display interface implementations:  One integrated into
67ad33
the qxl graphics card, and one generic which can operate with every
67ad33
qemu-emulated graphics card.
67ad33
67ad33
The generic one is activated in case spice is used without qxl.  The
67ad33
logic for that only caught the "-vga qxl" case, "-device qxl-vga" goes
67ad33
unnoticed.  Fix that by adding a check in the spice interface
67ad33
registration so we'll notice the qxl card no matter how it is created.
67ad33
67ad33
https://bugzilla.redhat.com/show_bug.cgi?id=981094
67ad33
67ad33
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
67ad33
---
67ad33
 include/sysemu/sysemu.h | 1 -
67ad33
 include/ui/qemu-spice.h | 2 ++
67ad33
 ui/spice-core.c         | 5 +++++
67ad33
 vl.c                    | 2 +-
67ad33
 4 files changed, 8 insertions(+), 2 deletions(-)
67ad33
67ad33
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
67ad33
index 2fb71af..8c8a36f 100644
67ad33
--- a/include/sysemu/sysemu.h
67ad33
+++ b/include/sysemu/sysemu.h
67ad33
@@ -103,7 +103,6 @@ typedef enum {
67ad33
 
67ad33
 extern int vga_interface_type;
67ad33
 #define xenfb_enabled (vga_interface_type == VGA_XENFB)
67ad33
-#define qxl_enabled (vga_interface_type == VGA_QXL)
67ad33
 
67ad33
 extern int graphic_width;
67ad33
 extern int graphic_height;
67ad33
diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h
67ad33
index eba6d77..c6c756b 100644
67ad33
--- a/include/ui/qemu-spice.h
67ad33
+++ b/include/ui/qemu-spice.h
67ad33
@@ -27,6 +27,7 @@
67ad33
 #include "monitor/monitor.h"
67ad33
 
67ad33
 extern int using_spice;
67ad33
+extern int spice_displays;
67ad33
 
67ad33
 void qemu_spice_init(void);
67ad33
 void qemu_spice_input_init(void);
67ad33
@@ -57,6 +58,7 @@ static inline CharDriverState *qemu_chr_open_spice_port(const char *name)
67ad33
 #include "monitor/monitor.h"
67ad33
 
67ad33
 #define using_spice 0
67ad33
+#define spice_displays 0
67ad33
 static inline int qemu_spice_set_passwd(const char *passwd,
67ad33
                                         bool fail_if_connected,
67ad33
                                         bool disconnect_if_connected)
67ad33
diff --git a/ui/spice-core.c b/ui/spice-core.c
67ad33
index bcc4199..c8337ab 100644
67ad33
--- a/ui/spice-core.c
67ad33
+++ b/ui/spice-core.c
67ad33
@@ -48,6 +48,7 @@ static char *auth_passwd;
67ad33
 static time_t auth_expires = TIME_MAX;
67ad33
 static int spice_migration_completed;
67ad33
 int using_spice = 0;
67ad33
+int spice_displays;
67ad33
 
67ad33
 static QemuThread me;
67ad33
 
67ad33
@@ -823,6 +824,10 @@ int qemu_spice_add_interface(SpiceBaseInstance *sin)
67ad33
         qemu_add_vm_change_state_handler(vm_change_state_handler, NULL);
67ad33
     }
67ad33
 
67ad33
+    if (strcmp(sin->sif->type, SPICE_INTERFACE_QXL) == 0) {
67ad33
+        spice_displays++;
67ad33
+    }
67ad33
+
67ad33
     return spice_server_add_interface(spice_server, sin);
67ad33
 }
67ad33
 
67ad33
diff --git a/vl.c b/vl.c
67ad33
index efb073f..3559f76 100644
67ad33
--- a/vl.c
67ad33
+++ b/vl.c
67ad33
@@ -4374,7 +4374,7 @@ int main(int argc, char **argv, char **envp)
67ad33
     }
67ad33
 #endif
67ad33
 #ifdef CONFIG_SPICE
67ad33
-    if (using_spice && !qxl_enabled) {
67ad33
+    if (using_spice && !spice_displays) {
67ad33
         qemu_spice_display_init(ds);
67ad33
     }
67ad33
 #endif