|
Hans de Goede |
c8dfc6 |
From f7d481b35b63f2df58aaef5afcac5ca1e67ce233 Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
c8dfc6 |
From: Yonit Halperin <yhalperi@redhat.com>
|
|
Hans de Goede |
c8dfc6 |
Date: Tue, 21 Aug 2012 11:51:56 +0300
|
|
Hans de Goede |
c8dfc6 |
Subject: [PATCH 203/215] spice: notify on vm state change only via
|
|
Hans de Goede |
c8dfc6 |
spice_server_vm_start/stop
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
QXLWorker->start/stop are deprecated since spice-server 0.11.2
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
|
|
Hans de Goede |
c8dfc6 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
c8dfc6 |
---
|
|
Hans de Goede |
c8dfc6 |
hw/qxl.c | 7 ++++---
|
|
Hans de Goede |
c8dfc6 |
ui/spice-core.c | 4 ++++
|
|
Hans de Goede |
c8dfc6 |
ui/spice-display.c | 32 ++++++++++++++++++++++++++++++--
|
|
Hans de Goede |
c8dfc6 |
ui/spice-display.h | 9 +++++++--
|
|
Hans de Goede |
c8dfc6 |
4 files changed, 45 insertions(+), 7 deletions(-)
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
diff --git a/hw/qxl.c b/hw/qxl.c
|
|
Hans de Goede |
c8dfc6 |
index c2dd3b4..95bbc03 100644
|
|
Hans de Goede |
c8dfc6 |
--- a/hw/qxl.c
|
|
Hans de Goede |
c8dfc6 |
+++ b/hw/qxl.c
|
|
Hans de Goede |
c8dfc6 |
@@ -958,9 +958,10 @@ static void qxl_update_irq(PCIQXLDevice *d)
|
|
Hans de Goede |
c8dfc6 |
static void qxl_check_state(PCIQXLDevice *d)
|
|
Hans de Goede |
c8dfc6 |
{
|
|
Hans de Goede |
c8dfc6 |
QXLRam *ram = d->ram;
|
|
Hans de Goede |
c8dfc6 |
+ int spice_display_running = qemu_spice_display_is_running(&d->ssd);
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
- assert(!d->ssd.running || SPICE_RING_IS_EMPTY(&ram->cmd_ring));
|
|
Hans de Goede |
c8dfc6 |
- assert(!d->ssd.running || SPICE_RING_IS_EMPTY(&ram->cursor_ring));
|
|
Hans de Goede |
c8dfc6 |
+ assert(!spice_display_running || SPICE_RING_IS_EMPTY(&ram->cmd_ring));
|
|
Hans de Goede |
c8dfc6 |
+ assert(!spice_display_running || SPICE_RING_IS_EMPTY(&ram->cursor_ring));
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
static void qxl_reset_state(PCIQXLDevice *d)
|
|
Hans de Goede |
c8dfc6 |
@@ -1538,7 +1539,7 @@ static void qxl_send_events(PCIQXLDevice *d, uint32_t events)
|
|
Hans de Goede |
c8dfc6 |
uint32_t old_pending;
|
|
Hans de Goede |
c8dfc6 |
uint32_t le_events = cpu_to_le32(events);
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
- assert(d->ssd.running);
|
|
Hans de Goede |
c8dfc6 |
+ assert(qemu_spice_display_is_running(&d->ssd));
|
|
Hans de Goede |
c8dfc6 |
old_pending = __sync_fetch_and_or(&d->ram->int_pending, le_events);
|
|
Hans de Goede |
c8dfc6 |
if ((old_pending & le_events) == le_events) {
|
|
Hans de Goede |
c8dfc6 |
return;
|
|
Hans de Goede |
c8dfc6 |
diff --git a/ui/spice-core.c b/ui/spice-core.c
|
|
Hans de Goede |
c8dfc6 |
index a515c94..1a7a773 100644
|
|
Hans de Goede |
c8dfc6 |
--- a/ui/spice-core.c
|
|
Hans de Goede |
c8dfc6 |
+++ b/ui/spice-core.c
|
|
Hans de Goede |
c8dfc6 |
@@ -37,6 +37,7 @@
|
|
Hans de Goede |
c8dfc6 |
#include "migration.h"
|
|
Hans de Goede |
c8dfc6 |
#include "monitor.h"
|
|
Hans de Goede |
c8dfc6 |
#include "hw/hw.h"
|
|
Hans de Goede |
c8dfc6 |
+#include "spice-display.h"
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
/* core bits */
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
@@ -551,9 +552,11 @@ static void vm_change_state_handler(void *opaque, int running,
|
|
Hans de Goede |
c8dfc6 |
{
|
|
Hans de Goede |
c8dfc6 |
#if SPICE_SERVER_VERSION >= 0x000b02 /* 0.11.2 */
|
|
Hans de Goede |
c8dfc6 |
if (running) {
|
|
Hans de Goede |
c8dfc6 |
+ qemu_spice_display_start();
|
|
Hans de Goede |
c8dfc6 |
spice_server_vm_start(spice_server);
|
|
Hans de Goede |
c8dfc6 |
} else {
|
|
Hans de Goede |
c8dfc6 |
spice_server_vm_stop(spice_server);
|
|
Hans de Goede |
c8dfc6 |
+ qemu_spice_display_stop();
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
#endif
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
@@ -755,6 +758,7 @@ int qemu_spice_add_interface(SpiceBaseInstance *sin)
|
|
Hans de Goede |
c8dfc6 |
spice_server = spice_server_new();
|
|
Hans de Goede |
c8dfc6 |
spice_server_init(spice_server, &core_interface);
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
+
|
|
Hans de Goede |
c8dfc6 |
return spice_server_add_interface(spice_server, sin);
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
diff --git a/ui/spice-display.c b/ui/spice-display.c
|
|
Hans de Goede |
c8dfc6 |
index 3e8f0b3..1c31418 100644
|
|
Hans de Goede |
c8dfc6 |
--- a/ui/spice-display.c
|
|
Hans de Goede |
c8dfc6 |
+++ b/ui/spice-display.c
|
|
Hans de Goede |
c8dfc6 |
@@ -126,18 +126,44 @@ void qemu_spice_wakeup(SimpleSpiceDisplay *ssd)
|
|
Hans de Goede |
c8dfc6 |
ssd->worker->wakeup(ssd->worker);
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
-void qemu_spice_start(SimpleSpiceDisplay *ssd)
|
|
Hans de Goede |
c8dfc6 |
+#if SPICE_SERVER_VERSION < 0x000b02 /* before 0.11.2 */
|
|
Hans de Goede |
c8dfc6 |
+static void qemu_spice_start(SimpleSpiceDisplay *ssd)
|
|
Hans de Goede |
c8dfc6 |
{
|
|
Hans de Goede |
c8dfc6 |
trace_qemu_spice_start(ssd->qxl.id);
|
|
Hans de Goede |
c8dfc6 |
ssd->worker->start(ssd->worker);
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
-void qemu_spice_stop(SimpleSpiceDisplay *ssd)
|
|
Hans de Goede |
c8dfc6 |
+static void qemu_spice_stop(SimpleSpiceDisplay *ssd)
|
|
Hans de Goede |
c8dfc6 |
{
|
|
Hans de Goede |
c8dfc6 |
trace_qemu_spice_stop(ssd->qxl.id);
|
|
Hans de Goede |
c8dfc6 |
ssd->worker->stop(ssd->worker);
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
+#else
|
|
Hans de Goede |
c8dfc6 |
+
|
|
Hans de Goede |
c8dfc6 |
+static int spice_display_is_running;
|
|
Hans de Goede |
c8dfc6 |
+
|
|
Hans de Goede |
c8dfc6 |
+void qemu_spice_display_start(void)
|
|
Hans de Goede |
c8dfc6 |
+{
|
|
Hans de Goede |
c8dfc6 |
+ spice_display_is_running = true;
|
|
Hans de Goede |
c8dfc6 |
+}
|
|
Hans de Goede |
c8dfc6 |
+
|
|
Hans de Goede |
c8dfc6 |
+void qemu_spice_display_stop(void)
|
|
Hans de Goede |
c8dfc6 |
+{
|
|
Hans de Goede |
c8dfc6 |
+ spice_display_is_running = false;
|
|
Hans de Goede |
c8dfc6 |
+}
|
|
Hans de Goede |
c8dfc6 |
+
|
|
Hans de Goede |
c8dfc6 |
+#endif
|
|
Hans de Goede |
c8dfc6 |
+
|
|
Hans de Goede |
c8dfc6 |
+int qemu_spice_display_is_running(SimpleSpiceDisplay *ssd)
|
|
Hans de Goede |
c8dfc6 |
+{
|
|
Hans de Goede |
c8dfc6 |
+#if SPICE_SERVER_VERSION < 0x000b02 /* before 0.11.2 */
|
|
Hans de Goede |
c8dfc6 |
+ return ssd->running;
|
|
Hans de Goede |
c8dfc6 |
+#else
|
|
Hans de Goede |
c8dfc6 |
+ return spice_display_is_running;
|
|
Hans de Goede |
c8dfc6 |
+#endif
|
|
Hans de Goede |
c8dfc6 |
+}
|
|
Hans de Goede |
c8dfc6 |
+
|
|
Hans de Goede |
c8dfc6 |
static SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd)
|
|
Hans de Goede |
c8dfc6 |
{
|
|
Hans de Goede |
c8dfc6 |
SimpleSpiceUpdate *update;
|
|
Hans de Goede |
c8dfc6 |
@@ -272,6 +298,7 @@ void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd)
|
|
Hans de Goede |
c8dfc6 |
void qemu_spice_vm_change_state_handler(void *opaque, int running,
|
|
Hans de Goede |
c8dfc6 |
RunState state)
|
|
Hans de Goede |
c8dfc6 |
{
|
|
Hans de Goede |
c8dfc6 |
+#if SPICE_SERVER_VERSION < 0x000b02 /* before 0.11.2 */
|
|
Hans de Goede |
c8dfc6 |
SimpleSpiceDisplay *ssd = opaque;
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
if (running) {
|
|
Hans de Goede |
c8dfc6 |
@@ -281,6 +308,7 @@ void qemu_spice_vm_change_state_handler(void *opaque, int running,
|
|
Hans de Goede |
c8dfc6 |
qemu_spice_stop(ssd);
|
|
Hans de Goede |
c8dfc6 |
ssd->running = false;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
+#endif
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
void qemu_spice_display_init_common(SimpleSpiceDisplay *ssd, DisplayState *ds)
|
|
Hans de Goede |
c8dfc6 |
diff --git a/ui/spice-display.h b/ui/spice-display.h
|
|
Hans de Goede |
c8dfc6 |
index 12e50b6..672d65e 100644
|
|
Hans de Goede |
c8dfc6 |
--- a/ui/spice-display.h
|
|
Hans de Goede |
c8dfc6 |
+++ b/ui/spice-display.h
|
|
Hans de Goede |
c8dfc6 |
@@ -82,7 +82,9 @@ struct SimpleSpiceDisplay {
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
QXLRect dirty;
|
|
Hans de Goede |
c8dfc6 |
int notify;
|
|
Hans de Goede |
c8dfc6 |
+#if SPICE_SERVER_VERSION < 0x000b02 /* before 0.11.2 */
|
|
Hans de Goede |
c8dfc6 |
int running;
|
|
Hans de Goede |
c8dfc6 |
+#endif
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
/*
|
|
Hans de Goede |
c8dfc6 |
* All struct members below this comment can be accessed from
|
|
Hans de Goede |
c8dfc6 |
@@ -129,5 +131,8 @@ void qemu_spice_create_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id,
|
|
Hans de Goede |
c8dfc6 |
void qemu_spice_destroy_primary_surface(SimpleSpiceDisplay *ssd,
|
|
Hans de Goede |
c8dfc6 |
uint32_t id, qxl_async_io async);
|
|
Hans de Goede |
c8dfc6 |
void qemu_spice_wakeup(SimpleSpiceDisplay *ssd);
|
|
Hans de Goede |
c8dfc6 |
-void qemu_spice_start(SimpleSpiceDisplay *ssd);
|
|
Hans de Goede |
c8dfc6 |
-void qemu_spice_stop(SimpleSpiceDisplay *ssd);
|
|
Hans de Goede |
c8dfc6 |
+#if SPICE_SERVER_VERSION >= 0x000b02 /* before 0.11.2 */
|
|
Hans de Goede |
c8dfc6 |
+void qemu_spice_display_start(void);
|
|
Hans de Goede |
c8dfc6 |
+void qemu_spice_display_stop(void);
|
|
Hans de Goede |
c8dfc6 |
+#endif
|
|
Hans de Goede |
c8dfc6 |
+int qemu_spice_display_is_running(SimpleSpiceDisplay *ssd);
|
|
Hans de Goede |
c8dfc6 |
--
|
|
Hans de Goede |
c8dfc6 |
1.7.12
|
|
Hans de Goede |
c8dfc6 |
|