|
Justin M. Forbes |
da9298 |
>From d413b3c36cbd9820c5b9492b52caa421abccf745 Mon Sep 17 00:00:00 2001
|
|
Justin M. Forbes |
da9298 |
From: Alon Levy <alevy@redhat.com>
|
|
Justin M. Forbes |
da9298 |
Date: Wed, 16 Mar 2011 15:46:22 +0100
|
|
Justin M. Forbes |
da9298 |
Subject: [PATCH 3/4] qxl/spice: remove qemu_mutex_{un,}lock_iothread around dispatcher
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
with the previous patch making sure get_command no longer needs to lock,
|
|
Justin M. Forbes |
da9298 |
there is no reason to drop the qemu iothread mutex in qxl.c and in
|
|
Justin M. Forbes |
da9298 |
ui/spice-display.c
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
The only location where the lock remains are the cursor related callbacks,
|
|
Justin M. Forbes |
da9298 |
that path is currently broken. It is only triggered if running spice and sdl,
|
|
Justin M. Forbes |
da9298 |
which is broken already before that.
|
|
Justin M. Forbes |
da9298 |
---
|
|
Justin M. Forbes |
da9298 |
hw/qxl.c | 8 --------
|
|
Justin M. Forbes |
da9298 |
ui/spice-display.c | 19 +++----------------
|
|
Justin M. Forbes |
da9298 |
2 files changed, 3 insertions(+), 24 deletions(-)
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
diff --git a/hw/qxl.c b/hw/qxl.c
|
|
Justin M. Forbes |
da9298 |
index 64580f1..cf3c938 100644
|
|
Justin M. Forbes |
da9298 |
--- a/hw/qxl.c
|
|
Justin M. Forbes |
da9298 |
+++ b/hw/qxl.c
|
|
Justin M. Forbes |
da9298 |
@@ -670,10 +670,8 @@ static void qxl_hard_reset(PCIQXLDevice *d, int loadvm)
|
|
Justin M. Forbes |
da9298 |
dprint(d, 1, "%s: start%s\n", __FUNCTION__,
|
|
Justin M. Forbes |
da9298 |
loadvm ? " (loadvm)" : "");
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_unlock_iothread();
|
|
Justin M. Forbes |
da9298 |
d->ssd.worker->reset_cursor(d->ssd.worker);
|
|
Justin M. Forbes |
da9298 |
d->ssd.worker->reset_image_cache(d->ssd.worker);
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_lock_iothread();
|
|
Justin M. Forbes |
da9298 |
qxl_reset_surfaces(d);
|
|
Justin M. Forbes |
da9298 |
qxl_reset_memslots(d);
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
@@ -803,9 +801,7 @@ static void qxl_reset_surfaces(PCIQXLDevice *d)
|
|
Justin M. Forbes |
da9298 |
{
|
|
Justin M. Forbes |
da9298 |
dprint(d, 1, "%s:\n", __FUNCTION__);
|
|
Justin M. Forbes |
da9298 |
d->mode = QXL_MODE_UNDEFINED;
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_unlock_iothread();
|
|
Justin M. Forbes |
da9298 |
d->ssd.worker->destroy_surfaces(d->ssd.worker);
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_lock_iothread();
|
|
Justin M. Forbes |
da9298 |
memset(&d->guest_surfaces.cmds, 0, sizeof(d->guest_surfaces.cmds));
|
|
Justin M. Forbes |
da9298 |
}
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
@@ -874,9 +870,7 @@ static void qxl_destroy_primary(PCIQXLDevice *d)
|
|
Justin M. Forbes |
da9298 |
dprint(d, 1, "%s\n", __FUNCTION__);
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
d->mode = QXL_MODE_UNDEFINED;
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_unlock_iothread();
|
|
Justin M. Forbes |
da9298 |
d->ssd.worker->destroy_primary_surface(d->ssd.worker, 0);
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_lock_iothread();
|
|
Justin M. Forbes |
da9298 |
}
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm)
|
|
Justin M. Forbes |
da9298 |
@@ -946,10 +940,8 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val)
|
|
Justin M. Forbes |
da9298 |
case QXL_IO_UPDATE_AREA:
|
|
Justin M. Forbes |
da9298 |
{
|
|
Justin M. Forbes |
da9298 |
QXLRect update = d->ram->update_area;
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_unlock_iothread();
|
|
Justin M. Forbes |
da9298 |
d->ssd.worker->update_area(d->ssd.worker, d->ram->update_surface,
|
|
Justin M. Forbes |
da9298 |
&update, NULL, 0, 0);
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_lock_iothread();
|
|
Justin M. Forbes |
da9298 |
break;
|
|
Justin M. Forbes |
da9298 |
}
|
|
Justin M. Forbes |
da9298 |
case QXL_IO_NOTIFY_CMD:
|
|
Justin M. Forbes |
da9298 |
diff --git a/ui/spice-display.c b/ui/spice-display.c
|
|
Justin M. Forbes |
da9298 |
index bdd14b8..ecb22cc 100644
|
|
Justin M. Forbes |
da9298 |
--- a/ui/spice-display.c
|
|
Justin M. Forbes |
da9298 |
+++ b/ui/spice-display.c
|
|
Justin M. Forbes |
da9298 |
@@ -62,13 +62,7 @@ void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r)
|
|
Justin M. Forbes |
da9298 |
dest->right = MAX(dest->right, r->right);
|
|
Justin M. Forbes |
da9298 |
}
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
-/*
|
|
Justin M. Forbes |
da9298 |
- * Called from spice server thread context (via interface_get_command).
|
|
Justin M. Forbes |
da9298 |
- *
|
|
Justin M. Forbes |
da9298 |
- * We must aquire the global qemu mutex here to make sure the
|
|
Justin M. Forbes |
da9298 |
- * DisplayState (+DisplaySurface) we are accessing doesn't change
|
|
Justin M. Forbes |
da9298 |
- * underneath us.
|
|
Justin M. Forbes |
da9298 |
- */
|
|
Justin M. Forbes |
da9298 |
+/* Called from io-thread context (via pipe_read) */
|
|
Justin M. Forbes |
da9298 |
SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd)
|
|
Justin M. Forbes |
da9298 |
{
|
|
Justin M. Forbes |
da9298 |
SimpleSpiceUpdate *update;
|
|
Justin M. Forbes |
da9298 |
@@ -78,9 +72,7 @@ SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd)
|
|
Justin M. Forbes |
da9298 |
uint8_t *src, *dst;
|
|
Justin M. Forbes |
da9298 |
int by, bw, bh;
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_lock_iothread();
|
|
Justin M. Forbes |
da9298 |
if (qemu_spice_rect_is_empty(&ssd->dirty)) {
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_unlock_iothread();
|
|
Justin M. Forbes |
da9298 |
return NULL;
|
|
Justin M. Forbes |
da9298 |
};
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
@@ -141,7 +133,6 @@ SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd)
|
|
Justin M. Forbes |
da9298 |
cmd->data = (intptr_t)drawable;
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
memset(&ssd->dirty, 0, sizeof(ssd->dirty));
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_unlock_iothread();
|
|
Justin M. Forbes |
da9298 |
return update;
|
|
Justin M. Forbes |
da9298 |
}
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
@@ -169,6 +160,7 @@ void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd)
|
|
Justin M. Forbes |
da9298 |
ssd->worker->add_memslot(ssd->worker, &memslot);
|
|
Justin M. Forbes |
da9298 |
}
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
+/* called from iothread (main) or a vcpu-thread */
|
|
Justin M. Forbes |
da9298 |
void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd)
|
|
Justin M. Forbes |
da9298 |
{
|
|
Justin M. Forbes |
da9298 |
QXLDevSurfaceCreate surface;
|
|
Justin M. Forbes |
da9298 |
@@ -186,18 +178,14 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd)
|
|
Justin M. Forbes |
da9298 |
surface.mem = (intptr_t)ssd->buf;
|
|
Justin M. Forbes |
da9298 |
surface.group_id = MEMSLOT_GROUP_HOST;
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_unlock_iothread();
|
|
Justin M. Forbes |
da9298 |
ssd->worker->create_primary_surface(ssd->worker, 0, &surface);
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_lock_iothread();
|
|
Justin M. Forbes |
da9298 |
}
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd)
|
|
Justin M. Forbes |
da9298 |
{
|
|
Justin M. Forbes |
da9298 |
dprint(1, "%s:\n", __FUNCTION__);
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_unlock_iothread();
|
|
Justin M. Forbes |
da9298 |
ssd->worker->destroy_primary_surface(ssd->worker, 0);
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_lock_iothread();
|
|
Justin M. Forbes |
da9298 |
}
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
void qemu_spice_vm_change_state_handler(void *opaque, int running, int reason)
|
|
Justin M. Forbes |
da9298 |
@@ -207,9 +195,7 @@ void qemu_spice_vm_change_state_handler(void *opaque, int running, int reason)
|
|
Justin M. Forbes |
da9298 |
if (running) {
|
|
Justin M. Forbes |
da9298 |
ssd->worker->start(ssd->worker);
|
|
Justin M. Forbes |
da9298 |
} else {
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_unlock_iothread();
|
|
Justin M. Forbes |
da9298 |
ssd->worker->stop(ssd->worker);
|
|
Justin M. Forbes |
da9298 |
- qemu_mutex_lock_iothread();
|
|
Justin M. Forbes |
da9298 |
}
|
|
Justin M. Forbes |
da9298 |
ssd->running = running;
|
|
Justin M. Forbes |
da9298 |
}
|
|
Justin M. Forbes |
da9298 |
@@ -233,6 +219,7 @@ void qemu_spice_display_update(SimpleSpiceDisplay *ssd,
|
|
Justin M. Forbes |
da9298 |
qemu_spice_rect_union(&ssd->dirty, &update_area);
|
|
Justin M. Forbes |
da9298 |
}
|
|
Justin M. Forbes |
da9298 |
|
|
Justin M. Forbes |
da9298 |
+/* called only from iothread (main) */
|
|
Justin M. Forbes |
da9298 |
void qemu_spice_display_resize(SimpleSpiceDisplay *ssd)
|
|
Justin M. Forbes |
da9298 |
{
|
|
Justin M. Forbes |
da9298 |
dprint(1, "%s:\n", __FUNCTION__);
|
|
Justin M. Forbes |
da9298 |
--
|
|
Justin M. Forbes |
da9298 |
1.7.3.2
|
|
Justin M. Forbes |
da9298 |
|