summaryrefslogtreecommitdiff
path: root/ui/spice-display.h
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2011-04-27 15:21:51 +0200
committerGerd Hoffmann <kraxel@redhat.com>2011-05-03 15:35:48 +0200
commite0c64d08d11736dcea7c5a6373e3e7f62db51d9e (patch)
tree28edc41f690715dc40d56177764b8a848eb368ba /ui/spice-display.h
parent14da8345b2f7c21bab20fd12b755a61d6277f171 (diff)
downloadqemu-e0c64d08d11736dcea7c5a6373e3e7f62db51d9e.tar.gz
spice: don't create updates in spice server context.
This patch moves the creation of spice screen updates from the spice server context to qemu iothread context (display refresh timer to be exact). This way we avoid accessing qemu internals (display surface) from spice thread context which in turn allows us to simplify locking. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/spice-display.h')
-rw-r--r--ui/spice-display.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/ui/spice-display.h b/ui/spice-display.h
index aef0464f86..e0cc46ef4c 100644
--- a/ui/spice-display.h
+++ b/ui/spice-display.h
@@ -19,6 +19,7 @@
#include <spice/enums.h>
#include <spice/qxl_dev.h>
+#include "qemu-thread.h"
#include "pflib.h"
#define NUM_MEMSLOTS 8
@@ -31,7 +32,10 @@
#define NUM_SURFACES 1024
-typedef struct SimpleSpiceDisplay {
+typedef struct SimpleSpiceDisplay SimpleSpiceDisplay;
+typedef struct SimpleSpiceUpdate SimpleSpiceUpdate;
+
+struct SimpleSpiceDisplay {
DisplayState *ds;
void *buf;
int bufsize;
@@ -43,19 +47,26 @@ typedef struct SimpleSpiceDisplay {
QXLRect dirty;
int notify;
int running;
-} SimpleSpiceDisplay;
-typedef struct SimpleSpiceUpdate {
+ /*
+ * All struct members below this comment can be accessed from
+ * both spice server and qemu (iothread) context and any access
+ * to them must be protected by the lock.
+ */
+ QemuMutex lock;
+ SimpleSpiceUpdate *update;
+};
+
+struct SimpleSpiceUpdate {
QXLDrawable drawable;
QXLImage image;
QXLCommandExt ext;
uint8_t *bitmap;
-} SimpleSpiceUpdate;
+};
int qemu_spice_rect_is_empty(const QXLRect* r);
void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r);
-SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *sdpy);
void qemu_spice_destroy_update(SimpleSpiceDisplay *sdpy, SimpleSpiceUpdate *update);
void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd);
void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd);