summaryrefslogtreecommitdiff
path: root/ui/spice-core.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-10-11 22:39:59 +0200
committerGerd Hoffmann <kraxel@redhat.com>2013-10-17 12:42:54 +0200
commit9fa032866daae68357d99abc725c18fe9ed4b61b (patch)
tree759b86785e2a11fcd65c743b8afaf25ec725635e /ui/spice-core.c
parent35b2122db446a03be9b88f540e865930efd01d6a (diff)
downloadqemu-9fa032866daae68357d99abc725c18fe9ed4b61b.tar.gz
spice: fix multihead support
This patch fixes spice display initialization to handle multihead properly. spice-core now keeps track of which QemuConsole has a spice display channel attached to it and which has not. It also manages display channel ids. spice-display looks at all QemuConsoles and will pick up any graphic console not yet bound to a spice channel (which in practice are all non-qxl graphic devices). Result is that (a) you'll get a spice client window for each graphical device now (first only without this patch), and (b) mixing qxl and non-qxl vga cards works properly. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/spice-core.c')
-rw-r--r--ui/spice-core.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 1976b712ba..e4d533d4c4 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -48,7 +48,6 @@ 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;
@@ -837,11 +836,28 @@ 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);
+}
+
+static GSList *spice_consoles;
+static int display_id;
+
+bool qemu_spice_have_display_interface(QemuConsole *con)
+{
+ if (g_slist_find(spice_consoles, con)) {
+ return true;
}
+ return false;
+}
- return spice_server_add_interface(spice_server, sin);
+int qemu_spice_add_display_interface(QXLInstance *qxlin, QemuConsole *con)
+{
+ if (g_slist_find(spice_consoles, con)) {
+ return -1;
+ }
+ qxlin->id = display_id++;
+ spice_consoles = g_slist_append(spice_consoles, con);
+ return qemu_spice_add_interface(&qxlin->base);
}
static int qemu_spice_set_ticket(bool fail_if_conn, bool disconnect_if_conn)