[Spice-devel] [PATCH v3 4/4] worker: remove useless qxl_state

Frediano Ziglio fziglio at redhat.com
Fri Mar 4 15:13:28 UTC 2016


qxl_state can be extracted now easily from qxl.

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

diff --git a/server/red-qxl.c b/server/red-qxl.c
index 4932617..846c749 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -974,9 +974,10 @@ void red_qxl_init(QXLInstance *qxl)
     qxl_state->base.loadvm_commands = qxl_worker_loadvm_commands;
 
     qxl_state->max_monitors = UINT_MAX;
+    qxl->st = qxl_state;
 
     // TODO: reference and free
-    RedWorker *worker = red_worker_new(qxl, qxl_state);
+    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 = qxl_state;
 }
 
 struct Dispatcher *red_qxl_get_dispatcher(QXLState *qxl_state)
diff --git a/server/red-worker.c b/server/red-worker.c
index 6fb7865..0eb385a 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -60,7 +60,6 @@
 struct RedWorker {
     pthread_t thread;
     QXLInstance *qxl;
-    QXLState *qxl_state;
     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->qxl_state, 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->qxl_state, 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->qxl_state, 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)
@@ -1463,7 +1462,7 @@ static GSourceFuncs worker_source_funcs = {
     .dispatch = worker_source_dispatch,
 };
 
-RedWorker* red_worker_new(QXLInstance *qxl, QXLState *qxl_state)
+RedWorker* red_worker_new(QXLInstance *qxl)
 {
     QXLDevInitInfo init_info;
     RedWorker *worker;
@@ -1488,10 +1487,9 @@ RedWorker* red_worker_new(QXLInstance *qxl, QXLState *qxl_state)
             spice_error("failed to write replay header");
         }
     }
-    dispatcher = red_qxl_get_dispatcher(qxl_state);
+    dispatcher = red_qxl_get_dispatcher(qxl->st);
     dispatcher_set_opaque(dispatcher, worker);
 
-    worker->qxl_state = qxl_state;
     worker->qxl = qxl;
     register_callbacks(dispatcher);
     if (worker->record_fd) {
diff --git a/server/red-worker.h b/server/red-worker.h
index 0f9cf61..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, QXLState *qxl_state);
+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