218e99
From e2022d7c9e8623092daeca9c9a3f6118f3c7239e Mon Sep 17 00:00:00 2001
218e99
From: Gerd Hoffmann <kraxel@redhat.com>
218e99
Date: Fri, 30 Aug 2013 07:08:09 +0200
218e99
Subject: [PATCH 01/29] spice: fix display initialization
218e99
218e99
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
218e99
Message-id: <1377846489-22691-2-git-send-email-kraxel@redhat.com>
218e99
Patchwork-id: 53931
218e99
O-Subject: [RHEL-7 qemu-kvm PATCH 1/1] spice: fix display initialization
218e99
Bugzilla: 974887
218e99
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
218e99
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
218e99
218e99
Spice has two display interface implementations:  One integrated into
218e99
the qxl graphics card, and one generic which can operate with every
218e99
qemu-emulated graphics card.
218e99
218e99
The generic one is activated in case spice is used without qxl.  The
218e99
logic for that only caught the "-vga qxl" case, "-device qxl-vga" goes
218e99
unnoticed.  Fix that by adding a check in the spice interface
218e99
registration so we'll notice the qxl card no matter how it is created.
218e99
218e99
https://bugzilla.redhat.com/show_bug.cgi?id=981094
218e99
218e99
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
218e99
(cherry picked from commit 58ae52a8dc7752e3da9a905678580b4cb8181cdc)
218e99
---
218e99
 include/sysemu/sysemu.h | 1 -
218e99
 include/ui/qemu-spice.h | 2 ++
218e99
 ui/spice-core.c         | 5 +++++
218e99
 vl.c                    | 2 +-
218e99
 4 files changed, 8 insertions(+), 2 deletions(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 include/sysemu/sysemu.h |    1 -
218e99
 include/ui/qemu-spice.h |    2 ++
218e99
 ui/spice-core.c         |    5 +++++
218e99
 vl.c                    |    2 +-
218e99
 4 files changed, 8 insertions(+), 2 deletions(-)
218e99
218e99
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
218e99
index 3caeb66..d7a77b6 100644
218e99
--- a/include/sysemu/sysemu.h
218e99
+++ b/include/sysemu/sysemu.h
218e99
@@ -103,7 +103,6 @@ typedef enum {
218e99
 
218e99
 extern int vga_interface_type;
218e99
 #define xenfb_enabled (vga_interface_type == VGA_XENFB)
218e99
-#define qxl_enabled (vga_interface_type == VGA_QXL)
218e99
 
218e99
 extern int graphic_width;
218e99
 extern int graphic_height;
218e99
diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h
218e99
index eba6d77..c6c756b 100644
218e99
--- a/include/ui/qemu-spice.h
218e99
+++ b/include/ui/qemu-spice.h
218e99
@@ -27,6 +27,7 @@
218e99
 #include "monitor/monitor.h"
218e99
 
218e99
 extern int using_spice;
218e99
+extern int spice_displays;
218e99
 
218e99
 void qemu_spice_init(void);
218e99
 void qemu_spice_input_init(void);
218e99
@@ -57,6 +58,7 @@ static inline CharDriverState *qemu_chr_open_spice_port(const char *name)
218e99
 #include "monitor/monitor.h"
218e99
 
218e99
 #define using_spice 0
218e99
+#define spice_displays 0
218e99
 static inline int qemu_spice_set_passwd(const char *passwd,
218e99
                                         bool fail_if_connected,
218e99
                                         bool disconnect_if_connected)
218e99
diff --git a/ui/spice-core.c b/ui/spice-core.c
218e99
index bcc4199..c8337ab 100644
218e99
--- a/ui/spice-core.c
218e99
+++ b/ui/spice-core.c
218e99
@@ -48,6 +48,7 @@ static char *auth_passwd;
218e99
 static time_t auth_expires = TIME_MAX;
218e99
 static int spice_migration_completed;
218e99
 int using_spice = 0;
218e99
+int spice_displays;
218e99
 
218e99
 static QemuThread me;
218e99
 
218e99
@@ -823,6 +824,10 @@ int qemu_spice_add_interface(SpiceBaseInstance *sin)
218e99
         qemu_add_vm_change_state_handler(vm_change_state_handler, NULL);
218e99
     }
218e99
 
218e99
+    if (strcmp(sin->sif->type, SPICE_INTERFACE_QXL) == 0) {
218e99
+        spice_displays++;
218e99
+    }
218e99
+
218e99
     return spice_server_add_interface(spice_server, sin);
218e99
 }
218e99
 
218e99
diff --git a/vl.c b/vl.c
218e99
index 51c04e7..f7b326a 100644
218e99
--- a/vl.c
218e99
+++ b/vl.c
218e99
@@ -4405,7 +4405,7 @@ int main(int argc, char **argv, char **envp)
218e99
     }
218e99
 #endif
218e99
 #ifdef CONFIG_SPICE
218e99
-    if (using_spice && !qxl_enabled) {
218e99
+    if (using_spice && !spice_displays) {
218e99
         qemu_spice_display_init(ds);
218e99
     }
218e99
 #endif
218e99
-- 
218e99
1.7.1
218e99