[Spice-devel] [PATCH 5/5] worker: remove useless red_qxl

Frediano Ziglio fziglio at redhat.com
Mon Feb 29 11:26:22 UTC 2016


red_qxl can be extracted now easily from qxl.

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

diff --git a/server/red-qxl.c b/server/red-qxl.c
index f79922a..36cc0de 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -974,9 +974,10 @@ void red_qxl_init(QXLInstance *qxl)
     red_qxl->base.loadvm_commands = qxl_worker_loadvm_commands;
 
     red_qxl->max_monitors = UINT_MAX;
+    qxl->st = red_qxl;
 
     // TODO: reference and free
-    RedWorker *worker = red_worker_new(qxl, red_qxl);
+    RedWorker *worker = red_worker_new(qxl);
 
     // TODO: move to their respective channel files
     channel = red_worker_get_cursor_channel(worker);
@@ -999,8 +1000,6 @@ void red_qxl_init(QXLInstance *qxl)
     reds_register_channel(reds, channel);
 
     red_worker_run(worker);
-
-    qxl->st = red_qxl;
 }
 
 struct Dispatcher *red_qxl_get_dispatcher(RedQXL *red_qxl)
diff --git a/server/red-worker.c b/server/red-worker.c
index cc7cad1..0c4757f 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -60,7 +60,6 @@
 struct RedWorker {
     pthread_t thread;
     QXLInstance *qxl;
-    RedQXL *red_qxl;
     SpiceWatch *dispatch_watch;
     int running;
     SpiceCoreInterfaceInternal core;
@@ -824,7 +823,7 @@ static void handle_dev_wakeup(void *opaque, void *payload)
     RedWorker *worker = opaque;
 
     stat_inc_counter(reds, worker->wakeup_counter, 1);
-    red_qxl_clear_pending(worker->red_qxl, RED_DISPATCHER_PENDING_WAKEUP);
+    red_qxl_clear_pending(worker->qxl->st, RED_DISPATCHER_PENDING_WAKEUP);
 }
 
 static void handle_dev_oom(void *opaque, void *payload)
@@ -854,7 +853,7 @@ static void handle_dev_oom(void *opaque, void *payload)
                 display->glz_drawable_count,
                 display->current_size,
                 red_channel_sum_pipes_size(display_red_channel));
-    red_qxl_clear_pending(worker->red_qxl, RED_DISPATCHER_PENDING_OOM);
+    red_qxl_clear_pending(worker->qxl->st, RED_DISPATCHER_PENDING_OOM);
 }
 
 static void handle_dev_reset_cursor(void *opaque, void *payload)
@@ -1195,7 +1194,7 @@ static void worker_handle_dispatcher_async_done(void *opaque,
     RedWorkerMessageAsync *msg_async = payload;
 
     spice_debug(NULL);
-    red_qxl_async_complete(worker->red_qxl, msg_async->cmd);
+    red_qxl_async_complete(worker->qxl->st, msg_async->cmd);
 }
 
 static void worker_dispatcher_record(void *opaque, uint32_t message_type, void *payload)
@@ -1395,7 +1394,7 @@ static void handle_dev_input(int fd, int event, void *opaque)
 {
     RedWorker *worker = opaque;
 
-    dispatcher_handle_recv_read(red_qxl_get_dispatcher(worker->red_qxl));
+    dispatcher_handle_recv_read(red_qxl_get_dispatcher(worker->qxl->st));
 }
 
 typedef struct RedWorkerSource {
@@ -1463,7 +1462,7 @@ static GSourceFuncs worker_source_funcs = {
     .dispatch = worker_source_dispatch,
 };
 
-RedWorker* red_worker_new(QXLInstance *qxl, RedQXL *red_qxl)
+RedWorker* red_worker_new(QXLInstance *qxl)
 {
     QXLDevInitInfo init_info;
     RedWorker *worker;
@@ -1488,10 +1487,9 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedQXL *red_qxl)
             spice_error("failed to write replay header");
         }
     }
-    dispatcher = red_qxl_get_dispatcher(red_qxl);
+    dispatcher = red_qxl_get_dispatcher(qxl->st);
     dispatcher_set_opaque(dispatcher, worker);
 
-    worker->red_qxl = red_qxl;
     worker->qxl = qxl;
     register_callbacks(dispatcher);
     if (worker->record_fd) {
diff --git a/server/red-worker.h b/server/red-worker.h
index 798e8c0..c93f66c 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -90,7 +90,7 @@ static inline void red_pipes_add_verb(RedChannel *channel, uint16_t verb)
     }
 }
 
-RedWorker* red_worker_new(QXLInstance *qxl, RedQXL *red_qxl);
+RedWorker* red_worker_new(QXLInstance *qxl);
 bool       red_worker_run(RedWorker *worker);
 RedChannel* red_worker_get_cursor_channel(RedWorker *worker);
 RedChannel* red_worker_get_display_channel(RedWorker *worker);
-- 
2.5.0



More information about the Spice-devel mailing list