[Spice-devel] [PATCH spice-server] red-worker: Introduce RedWorkerMessageGlDraw structure

Frediano Ziglio fziglio at redhat.com
Fri Dec 9 14:25:18 UTC 2016


All RedWorker messages starts with RedWorker except
SpiceMsgDisplayGlDraw.
For coherence introduce a RedWorkerMessageGlDraw structure
holding just SpiceMsgDisplayGlDraw. This also allows possible
extensions.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/red-qxl.c    | 12 +++++++-----
 server/red-qxl.h    |  4 ++++
 server/red-worker.c |  6 +++---
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/server/red-qxl.c b/server/red-qxl.c
index de0546f..b6b3770 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -907,11 +907,13 @@ void spice_qxl_gl_draw_async(QXLInstance *qxl,
 {
     QXLState *qxl_state;
     RedWorkerMessage message = RED_WORKER_MESSAGE_GL_DRAW_ASYNC;
-    SpiceMsgDisplayGlDraw draw = {
-        .x = x,
-        .y = y,
-        .w = w,
-        .h = h
+    RedWorkerMessageGlDraw draw = {
+        {
+            .x = x,
+            .y = y,
+            .w = w,
+            .h = h
+        },
     };
 
     spice_return_if_fail(qxl != NULL);
diff --git a/server/red-qxl.h b/server/red-qxl.h
index 7743124..0c9498a 100644
--- a/server/red-qxl.h
+++ b/server/red-qxl.h
@@ -298,6 +298,10 @@ typedef struct RedWorkerMessageGlScanout {
 typedef struct RedWorkerMessageClose {
 } RedWorkerMessageClose;
 
+typedef struct RedWorkerMessageGlDraw {
+    SpiceMsgDisplayGlDraw draw;
+} RedWorkerMessageGlDraw;
+
 enum {
     RED_DISPATCHER_PENDING_WAKEUP,
     RED_DISPATCHER_PENDING_OOM,
diff --git a/server/red-worker.c b/server/red-worker.c
index 9be4b99..d6a5e77 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -967,9 +967,9 @@ static
 void handle_dev_gl_draw_async(void *opaque, void *payload)
 {
     RedWorker *worker = opaque;
-    SpiceMsgDisplayGlDraw *draw = payload;
+    RedWorkerMessageGlDraw *draw = payload;
 
-    display_channel_gl_draw(worker->display_channel, draw);
+    display_channel_gl_draw(worker->display_channel, &draw->draw);
 }
 
 static void handle_dev_close(void *opaque, void *payload)
@@ -1227,7 +1227,7 @@ static void register_callbacks(Dispatcher *dispatcher)
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_GL_DRAW_ASYNC,
                                 handle_dev_gl_draw_async,
-                                sizeof(SpiceMsgDisplayGlDraw),
+                                sizeof(RedWorkerMessageGlDraw),
                                 DISPATCHER_NONE);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_CLOSE_WORKER,
-- 
2.9.3



More information about the Spice-devel mailing list