diff options
author | Alon Levy <alevy@redhat.com> | 2011-06-26 18:39:41 +0200 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2011-07-23 00:55:03 +0300 |
commit | bd39af72b31c9855362161d9e08c0b2e788dc143 (patch) | |
tree | c49f6d5a903a8e60eeee0e4692753ee6cfdbb3d3 | |
parent | c4aff2b753e80e49f88e95ea02d1ff1de21a2391 (diff) |
xspice: qxl_unmap_memory: stop worker and track worker status
stop the worker thread and track the status, ignoring io requests (i.e.
prevent red_dispatcher writes to red_worker) if red_worker is stopped.
This fixes spice red_worker asserts from actions attepted after X
has destroyed a screen. X runs in a loop destroying and recreating screens
multiple times during the process lifetime, whenever the last X client
has exited.
Note that the spice server is kept up during a X screen restart. This is
on purpose, to avoid a spice-client closing when doing a window manager
restart. Cleanup of the spice-server on atexit - still to do.
-rw-r--r-- | src/qxl.h | 1 | ||||
-rw-r--r-- | src/qxl_driver.c | 7 | ||||
-rw-r--r-- | src/spiceqxl_io_port.c | 4 |
3 files changed, 12 insertions, 0 deletions
@@ -191,6 +191,7 @@ struct _qxl_screen_t struct QXLRom shadow_rom; /* Parameter RAM */ SpiceServer * spice_server; QXLWorker * worker; + int worker_running; QXLInstance display_sin; /* XSpice specific, dragged from the Device */ QXLReleaseInfo *last_release; diff --git a/src/qxl_driver.c b/src/qxl_driver.c index bfbf444..336cd25 100644 --- a/src/qxl_driver.c +++ b/src/qxl_driver.c @@ -302,6 +302,12 @@ map_memory_helper(qxl_screen_t *qxl, int scrnIndex) static void qxl_unmap_memory(qxl_screen_t *qxl, int scrnIndex) { +#ifdef XSPICE + if (qxl->worker) { + qxl->worker->stop(qxl->worker); + qxl->worker_running = FALSE; + } +#endif unmap_memory_helper(qxl, scrnIndex); qxl->ram = qxl->ram_physical = qxl->vram = qxl->rom = NULL; @@ -913,6 +919,7 @@ spiceqxl_screen_init(int scrnIndex, ScrnInfoPtr pScrn, qxl_screen_t *qxl) spice_server_init(qxl->spice_server, core); qxl_add_spice_display_interface(qxl); qxl->worker->start(qxl->worker); + qxl->worker_running = TRUE; } qxl->spice_server = qxl->spice_server; } diff --git a/src/spiceqxl_io_port.c b/src/spiceqxl_io_port.c index 89a9657..2139c86 100644 --- a/src/spiceqxl_io_port.c +++ b/src/spiceqxl_io_port.c @@ -171,6 +171,10 @@ void ioport_write(qxl_screen_t *qxl, uint32_t io_port, uint32_t val) { QXLRam *header = get_ram_header(qxl); + if (!qxl->worker_running) { + return; + } + switch (io_port) { case QXL_IO_UPDATE_AREA: { |