Nice. Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> On Thu, 2016-03-03 at 16:28 +0000, Frediano Ziglio wrote: > qxl_state can be extracted now easily from qxl. > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > --- > 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 11dc132..0bda8d7 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 52dea77..0c4757f 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) > @@ -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->qxl_state)); > + 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, 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); _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel