[Spice-devel] [PATCH 3/5] rename RedDispatcher to RedQXL

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


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/display-channel.c |   2 +-
 server/red-qxl.c         | 446 +++++++++++++++++++++++------------------------
 server/red-qxl.h         |  34 ++--
 server/red-worker.c      |  16 +-
 server/red-worker.h      |   2 +-
 server/reds-private.h    |   2 +-
 server/reds.c            |  70 ++++----
 server/reds.h            |   2 +-
 8 files changed, 287 insertions(+), 287 deletions(-)

diff --git a/server/display-channel.c b/server/display-channel.c
index 175ac7e..346e120 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -2164,7 +2164,7 @@ static void set_gl_draw_async_count(DisplayChannel *display, int num)
     if (num == 0) {
         struct AsyncCommand *async = qxl->st->gl_draw_async;
         qxl->st->gl_draw_async = NULL;
-        red_qxl_async_complete(qxl->st->dispatcher, async);
+        red_qxl_async_complete(qxl->st->red_qxl, async);
     }
 }
 
diff --git a/server/red-qxl.c b/server/red-qxl.c
index 3dfeae6..de7dc91 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -45,7 +45,7 @@ struct AsyncCommand {
     uint64_t cookie;
 };
 
-struct RedDispatcher {
+struct RedQXL {
     QXLWorker base;
     QXLInstance *qxl;
     Dispatcher dispatcher;
@@ -58,10 +58,10 @@ struct RedDispatcher {
     unsigned int max_monitors;
 };
 
-static int red_qxl_check_qxl_version(RedDispatcher *rd, int major, int minor)
+static int red_qxl_check_qxl_version(RedQXL *rq, int major, int minor)
 {
-    int qxl_major = rd->qxl->st->qif->base.major_version;
-    int qxl_minor = rd->qxl->st->qif->base.minor_version;
+    int qxl_major = rq->qxl->st->qif->base.major_version;
+    int qxl_minor = rq->qxl->st->qif->base.minor_version;
 
     return ((qxl_major > major) ||
             ((qxl_major == major) && (qxl_minor >= minor)));
@@ -73,10 +73,10 @@ static void red_qxl_set_display_peer(RedChannel *channel, RedClient *client,
                                      uint32_t *caps)
 {
     RedWorkerMessageDisplayConnect payload = {0,};
-    RedDispatcher *dispatcher;
+    RedQXL *red_qxl;
 
     spice_debug("%s", "");
-    dispatcher = (RedDispatcher *)channel->data;
+    red_qxl = (RedQXL *)channel->data;
     payload.client = client;
     payload.stream = stream;
     payload.migration = migration;
@@ -88,7 +88,7 @@ static void red_qxl_set_display_peer(RedChannel *channel, RedClient *client,
     memcpy(payload.common_caps, common_caps, sizeof(uint32_t)*num_common_caps);
     memcpy(payload.caps, caps, sizeof(uint32_t)*num_caps);
 
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_DISPLAY_CONNECT,
                             &payload);
 }
@@ -96,20 +96,20 @@ static void red_qxl_set_display_peer(RedChannel *channel, RedClient *client,
 static void red_qxl_disconnect_display_peer(RedChannelClient *rcc)
 {
     RedWorkerMessageDisplayDisconnect payload;
-    RedDispatcher *dispatcher;
+    RedQXL *red_qxl;
 
     if (!rcc->channel) {
         return;
     }
 
-    dispatcher = (RedDispatcher *)rcc->channel->data;
+    red_qxl = (RedQXL *)rcc->channel->data;
 
     spice_printerr("");
     payload.rcc = rcc;
 
     // TODO: we turned it to be sync, due to client_destroy . Should we support async? - for this we will need ref count
     // for channels
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_DISPLAY_DISCONNECT,
                             &payload);
 }
@@ -117,14 +117,14 @@ static void red_qxl_disconnect_display_peer(RedChannelClient *rcc)
 static void red_qxl_display_migrate(RedChannelClient *rcc)
 {
     RedWorkerMessageDisplayMigrate payload;
-    RedDispatcher *dispatcher;
+    RedQXL *red_qxl;
     if (!rcc->channel) {
         return;
     }
-    dispatcher = (RedDispatcher *)rcc->channel->data;
+    red_qxl = (RedQXL *)rcc->channel->data;
     spice_printerr("channel type %u id %u", rcc->channel->type, rcc->channel->id);
     payload.rcc = rcc;
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_DISPLAY_MIGRATE,
                             &payload);
 }
@@ -135,7 +135,7 @@ static void red_qxl_set_cursor_peer(RedChannel *channel, RedClient *client, Reds
                                     uint32_t *caps)
 {
     RedWorkerMessageCursorConnect payload = {0,};
-    RedDispatcher *dispatcher = (RedDispatcher *)channel->data;
+    RedQXL *red_qxl = (RedQXL *)channel->data;
     spice_printerr("");
     payload.client = client;
     payload.stream = stream;
@@ -148,7 +148,7 @@ static void red_qxl_set_cursor_peer(RedChannel *channel, RedClient *client, Reds
     memcpy(payload.common_caps, common_caps, sizeof(uint32_t)*num_common_caps);
     memcpy(payload.caps, caps, sizeof(uint32_t)*num_caps);
 
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_CURSOR_CONNECT,
                             &payload);
 }
@@ -156,17 +156,17 @@ static void red_qxl_set_cursor_peer(RedChannel *channel, RedClient *client, Reds
 static void red_qxl_disconnect_cursor_peer(RedChannelClient *rcc)
 {
     RedWorkerMessageCursorDisconnect payload;
-    RedDispatcher *dispatcher;
+    RedQXL *red_qxl;
 
     if (!rcc->channel) {
         return;
     }
 
-    dispatcher = (RedDispatcher *)rcc->channel->data;
+    red_qxl = (RedQXL *)rcc->channel->data;
     spice_printerr("");
     payload.rcc = rcc;
 
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_CURSOR_DISCONNECT,
                             &payload);
 }
@@ -174,20 +174,20 @@ static void red_qxl_disconnect_cursor_peer(RedChannelClient *rcc)
 static void red_qxl_cursor_migrate(RedChannelClient *rcc)
 {
     RedWorkerMessageCursorMigrate payload;
-    RedDispatcher *dispatcher;
+    RedQXL *red_qxl;
 
     if (!rcc->channel) {
         return;
     }
-    dispatcher = (RedDispatcher *)rcc->channel->data;
+    red_qxl = (RedQXL *)rcc->channel->data;
     spice_printerr("channel type %u id %u", rcc->channel->type, rcc->channel->id);
     payload.rcc = rcc;
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_CURSOR_MIGRATE,
                             &payload);
 }
 
-static void red_qxl_update_area(RedDispatcher *dispatcher, uint32_t surface_id,
+static void red_qxl_update_area(RedQXL *red_qxl, uint32_t surface_id,
                                 QXLRect *qxl_area, QXLRect *qxl_dirty_rects,
                                 uint32_t num_dirty_rects, uint32_t clear_dirty_region)
 {
@@ -198,27 +198,27 @@ static void red_qxl_update_area(RedDispatcher *dispatcher, uint32_t surface_id,
     payload.qxl_dirty_rects = qxl_dirty_rects;
     payload.num_dirty_rects = num_dirty_rects;
     payload.clear_dirty_region = clear_dirty_region;
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_UPDATE,
                             &payload);
 }
 
-gboolean red_qxl_use_client_monitors_config(RedDispatcher *dispatcher)
+gboolean red_qxl_use_client_monitors_config(RedQXL *red_qxl)
 {
-    return (red_qxl_check_qxl_version(dispatcher, 3, 3) &&
-        dispatcher->qxl->st->qif->client_monitors_config &&
-        dispatcher->qxl->st->qif->client_monitors_config(dispatcher->qxl, NULL));
+    return (red_qxl_check_qxl_version(red_qxl, 3, 3) &&
+        red_qxl->qxl->st->qif->client_monitors_config &&
+        red_qxl->qxl->st->qif->client_monitors_config(red_qxl->qxl, NULL));
 }
 
-gboolean red_qxl_client_monitors_config(RedDispatcher *dispatcher,
+gboolean red_qxl_client_monitors_config(RedQXL *red_qxl,
                                         VDAgentMonitorsConfig *monitors_config)
 {
-    return (dispatcher->qxl->st->qif->client_monitors_config &&
-        dispatcher->qxl->st->qif->client_monitors_config(dispatcher->qxl,
+    return (red_qxl->qxl->st->qif->client_monitors_config &&
+        red_qxl->qxl->st->qif->client_monitors_config(red_qxl->qxl,
                                                           monitors_config));
 }
 
-static AsyncCommand *async_command_alloc(RedDispatcher *dispatcher,
+static AsyncCommand *async_command_alloc(RedQXL *red_qxl,
                                          RedWorkerMessage message,
                                          uint64_t cookie)
 {
@@ -231,7 +231,7 @@ static AsyncCommand *async_command_alloc(RedDispatcher *dispatcher,
     return async_command;
 }
 
-static void red_qxl_update_area_async(RedDispatcher *dispatcher,
+static void red_qxl_update_area_async(RedQXL *red_qxl,
                                       uint32_t surface_id,
                                       QXLRect *qxl_area,
                                       uint32_t clear_dirty_region,
@@ -240,11 +240,11 @@ static void red_qxl_update_area_async(RedDispatcher *dispatcher,
     RedWorkerMessage message = RED_WORKER_MESSAGE_UPDATE_ASYNC;
     RedWorkerMessageUpdateAsync payload;
 
-    payload.base.cmd = async_command_alloc(dispatcher, message, cookie);
+    payload.base.cmd = async_command_alloc(red_qxl, message, cookie);
     payload.surface_id = surface_id;
     payload.qxl_area = *qxl_area;
     payload.clear_dirty_region = clear_dirty_region;
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             message,
                             &payload);
 }
@@ -253,332 +253,332 @@ static void qxl_worker_update_area(QXLWorker *qxl_worker, uint32_t surface_id,
                                    QXLRect *qxl_area, QXLRect *qxl_dirty_rects,
                                    uint32_t num_dirty_rects, uint32_t clear_dirty_region)
 {
-    red_qxl_update_area((RedDispatcher*)qxl_worker, surface_id, qxl_area,
+    red_qxl_update_area((RedQXL*)qxl_worker, surface_id, qxl_area,
                         qxl_dirty_rects, num_dirty_rects, clear_dirty_region);
 }
 
-static void red_qxl_add_memslot(RedDispatcher *dispatcher, QXLDevMemSlot *mem_slot)
+static void red_qxl_add_memslot(RedQXL *red_qxl, QXLDevMemSlot *mem_slot)
 {
     RedWorkerMessageAddMemslot payload;
 
     payload.mem_slot = *mem_slot;
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_ADD_MEMSLOT,
                             &payload);
 }
 
 static void qxl_worker_add_memslot(QXLWorker *qxl_worker, QXLDevMemSlot *mem_slot)
 {
-    red_qxl_add_memslot((RedDispatcher*)qxl_worker, mem_slot);
+    red_qxl_add_memslot((RedQXL*)qxl_worker, mem_slot);
 }
 
-static void red_qxl_add_memslot_async(RedDispatcher *dispatcher, QXLDevMemSlot *mem_slot, uint64_t cookie)
+static void red_qxl_add_memslot_async(RedQXL *red_qxl, QXLDevMemSlot *mem_slot, uint64_t cookie)
 {
     RedWorkerMessageAddMemslotAsync payload;
     RedWorkerMessage message = RED_WORKER_MESSAGE_ADD_MEMSLOT_ASYNC;
 
-    payload.base.cmd = async_command_alloc(dispatcher, message, cookie);
+    payload.base.cmd = async_command_alloc(red_qxl, message, cookie);
     payload.mem_slot = *mem_slot;
-    dispatcher_send_message(&dispatcher->dispatcher, message, &payload);
+    dispatcher_send_message(&red_qxl->dispatcher, message, &payload);
 }
 
-static void red_qxl_del_memslot(RedDispatcher *dispatcher, uint32_t slot_group_id, uint32_t slot_id)
+static void red_qxl_del_memslot(RedQXL *red_qxl, uint32_t slot_group_id, uint32_t slot_id)
 {
     RedWorkerMessageDelMemslot payload;
     RedWorkerMessage message = RED_WORKER_MESSAGE_DEL_MEMSLOT;
 
     payload.slot_group_id = slot_group_id;
     payload.slot_id = slot_id;
-    dispatcher_send_message(&dispatcher->dispatcher, message, &payload);
+    dispatcher_send_message(&red_qxl->dispatcher, message, &payload);
 }
 
 static void qxl_worker_del_memslot(QXLWorker *qxl_worker, uint32_t slot_group_id, uint32_t slot_id)
 {
-    red_qxl_del_memslot((RedDispatcher*)qxl_worker, slot_group_id, slot_id);
+    red_qxl_del_memslot((RedQXL*)qxl_worker, slot_group_id, slot_id);
 }
 
-static void red_qxl_destroy_surfaces(RedDispatcher *dispatcher)
+static void red_qxl_destroy_surfaces(RedQXL *red_qxl)
 {
     RedWorkerMessageDestroySurfaces payload;
 
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_DESTROY_SURFACES,
                             &payload);
 }
 
 static void qxl_worker_destroy_surfaces(QXLWorker *qxl_worker)
 {
-    red_qxl_destroy_surfaces((RedDispatcher*)qxl_worker);
+    red_qxl_destroy_surfaces((RedQXL*)qxl_worker);
 }
 
-static void red_qxl_destroy_surfaces_async(RedDispatcher *dispatcher, uint64_t cookie)
+static void red_qxl_destroy_surfaces_async(RedQXL *red_qxl, uint64_t cookie)
 {
     RedWorkerMessageDestroySurfacesAsync payload;
     RedWorkerMessage message = RED_WORKER_MESSAGE_DESTROY_SURFACES_ASYNC;
 
-    payload.base.cmd = async_command_alloc(dispatcher, message, cookie);
-    dispatcher_send_message(&dispatcher->dispatcher, message, &payload);
+    payload.base.cmd = async_command_alloc(red_qxl, message, cookie);
+    dispatcher_send_message(&red_qxl->dispatcher, message, &payload);
 }
 
-static void red_qxl_destroy_primary_surface_complete(RedDispatcher *dispatcher)
+static void red_qxl_destroy_primary_surface_complete(RedQXL *red_qxl)
 {
-    dispatcher->x_res = 0;
-    dispatcher->y_res = 0;
-    dispatcher->use_hardware_cursor = FALSE;
-    dispatcher->primary_active = FALSE;
+    red_qxl->x_res = 0;
+    red_qxl->y_res = 0;
+    red_qxl->use_hardware_cursor = FALSE;
+    red_qxl->primary_active = FALSE;
 
     reds_update_client_mouse_allowed(reds);
 }
 
 static void
-red_qxl_destroy_primary_surface_sync(RedDispatcher *dispatcher,
+red_qxl_destroy_primary_surface_sync(RedQXL *red_qxl,
                                      uint32_t surface_id)
 {
     RedWorkerMessageDestroyPrimarySurface payload;
     payload.surface_id = surface_id;
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_DESTROY_PRIMARY_SURFACE,
                             &payload);
-    red_qxl_destroy_primary_surface_complete(dispatcher);
+    red_qxl_destroy_primary_surface_complete(red_qxl);
 }
 
 static void
-red_qxl_destroy_primary_surface_async(RedDispatcher *dispatcher,
+red_qxl_destroy_primary_surface_async(RedQXL *red_qxl,
                                       uint32_t surface_id, uint64_t cookie)
 {
     RedWorkerMessageDestroyPrimarySurfaceAsync payload;
     RedWorkerMessage message = RED_WORKER_MESSAGE_DESTROY_PRIMARY_SURFACE_ASYNC;
 
-    payload.base.cmd = async_command_alloc(dispatcher, message, cookie);
+    payload.base.cmd = async_command_alloc(red_qxl, message, cookie);
     payload.surface_id = surface_id;
-    dispatcher_send_message(&dispatcher->dispatcher, message, &payload);
+    dispatcher_send_message(&red_qxl->dispatcher, message, &payload);
 }
 
 static void
-red_qxl_destroy_primary_surface(RedDispatcher *dispatcher,
+red_qxl_destroy_primary_surface(RedQXL *red_qxl,
                                 uint32_t surface_id, int async, uint64_t cookie)
 {
     if (async) {
-        red_qxl_destroy_primary_surface_async(dispatcher, surface_id, cookie);
+        red_qxl_destroy_primary_surface_async(red_qxl, surface_id, cookie);
     } else {
-        red_qxl_destroy_primary_surface_sync(dispatcher, surface_id);
+        red_qxl_destroy_primary_surface_sync(red_qxl, surface_id);
     }
 }
 
 static void qxl_worker_destroy_primary_surface(QXLWorker *qxl_worker, uint32_t surface_id)
 {
-    red_qxl_destroy_primary_surface((RedDispatcher*)qxl_worker, surface_id, 0, 0);
+    red_qxl_destroy_primary_surface((RedQXL*)qxl_worker, surface_id, 0, 0);
 }
 
-static void red_qxl_create_primary_surface_complete(RedDispatcher *dispatcher)
+static void red_qxl_create_primary_surface_complete(RedQXL *red_qxl)
 {
-    QXLDevSurfaceCreate *surface = &dispatcher->surface_create;
+    QXLDevSurfaceCreate *surface = &red_qxl->surface_create;
 
-    dispatcher->x_res = surface->width;
-    dispatcher->y_res = surface->height;
-    dispatcher->use_hardware_cursor = surface->mouse_mode;
-    dispatcher->primary_active = TRUE;
+    red_qxl->x_res = surface->width;
+    red_qxl->y_res = surface->height;
+    red_qxl->use_hardware_cursor = surface->mouse_mode;
+    red_qxl->primary_active = TRUE;
 
     reds_update_client_mouse_allowed(reds);
-    memset(&dispatcher->surface_create, 0, sizeof(QXLDevSurfaceCreate));
+    memset(&red_qxl->surface_create, 0, sizeof(QXLDevSurfaceCreate));
 }
 
 static void
-red_qxl_create_primary_surface_async(RedDispatcher *dispatcher, uint32_t surface_id,
+red_qxl_create_primary_surface_async(RedQXL *red_qxl, uint32_t surface_id,
                                      QXLDevSurfaceCreate *surface, uint64_t cookie)
 {
     RedWorkerMessageCreatePrimarySurfaceAsync payload;
     RedWorkerMessage message = RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE_ASYNC;
 
-    dispatcher->surface_create = *surface;
-    payload.base.cmd = async_command_alloc(dispatcher, message, cookie);
+    red_qxl->surface_create = *surface;
+    payload.base.cmd = async_command_alloc(red_qxl, message, cookie);
     payload.surface_id = surface_id;
     payload.surface = *surface;
-    dispatcher_send_message(&dispatcher->dispatcher, message, &payload);
+    dispatcher_send_message(&red_qxl->dispatcher, message, &payload);
 }
 
 static void
-red_qxl_create_primary_surface_sync(RedDispatcher *dispatcher, uint32_t surface_id,
+red_qxl_create_primary_surface_sync(RedQXL *red_qxl, uint32_t surface_id,
                                     QXLDevSurfaceCreate *surface)
 {
     RedWorkerMessageCreatePrimarySurface payload = {0,};
 
-    dispatcher->surface_create = *surface;
+    red_qxl->surface_create = *surface;
     payload.surface_id = surface_id;
     payload.surface = *surface;
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE,
                             &payload);
-    red_qxl_create_primary_surface_complete(dispatcher);
+    red_qxl_create_primary_surface_complete(red_qxl);
 }
 
 static void
-red_qxl_create_primary_surface(RedDispatcher *dispatcher, uint32_t surface_id,
+red_qxl_create_primary_surface(RedQXL *red_qxl, uint32_t surface_id,
                                QXLDevSurfaceCreate *surface, int async, uint64_t cookie)
 {
     if (async) {
-        red_qxl_create_primary_surface_async(dispatcher, surface_id, surface, cookie);
+        red_qxl_create_primary_surface_async(red_qxl, surface_id, surface, cookie);
     } else {
-        red_qxl_create_primary_surface_sync(dispatcher, surface_id, surface);
+        red_qxl_create_primary_surface_sync(red_qxl, surface_id, surface);
     }
 }
 
 static void qxl_worker_create_primary_surface(QXLWorker *qxl_worker, uint32_t surface_id,
                                       QXLDevSurfaceCreate *surface)
 {
-    red_qxl_create_primary_surface((RedDispatcher*)qxl_worker, surface_id, surface, 0, 0);
+    red_qxl_create_primary_surface((RedQXL*)qxl_worker, surface_id, surface, 0, 0);
 }
 
-static void red_qxl_reset_image_cache(RedDispatcher *dispatcher)
+static void red_qxl_reset_image_cache(RedQXL *red_qxl)
 {
     RedWorkerMessageResetImageCache payload;
 
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_RESET_IMAGE_CACHE,
                             &payload);
 }
 
 static void qxl_worker_reset_image_cache(QXLWorker *qxl_worker)
 {
-    red_qxl_reset_image_cache((RedDispatcher*)qxl_worker);
+    red_qxl_reset_image_cache((RedQXL*)qxl_worker);
 }
 
-static void red_qxl_reset_cursor(RedDispatcher *dispatcher)
+static void red_qxl_reset_cursor(RedQXL *red_qxl)
 {
     RedWorkerMessageResetCursor payload;
 
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_RESET_CURSOR,
                             &payload);
 }
 
 static void qxl_worker_reset_cursor(QXLWorker *qxl_worker)
 {
-    red_qxl_reset_cursor((RedDispatcher*)qxl_worker);
+    red_qxl_reset_cursor((RedQXL*)qxl_worker);
 }
 
-static void red_qxl_destroy_surface_wait_sync(RedDispatcher *dispatcher,
+static void red_qxl_destroy_surface_wait_sync(RedQXL *red_qxl,
                                               uint32_t surface_id)
 {
     RedWorkerMessageDestroySurfaceWait payload;
 
     payload.surface_id = surface_id;
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_DESTROY_SURFACE_WAIT,
                             &payload);
 }
 
-static void red_qxl_destroy_surface_wait_async(RedDispatcher *dispatcher,
+static void red_qxl_destroy_surface_wait_async(RedQXL *red_qxl,
                                                uint32_t surface_id,
                                                uint64_t cookie)
 {
     RedWorkerMessageDestroySurfaceWaitAsync payload;
     RedWorkerMessage message = RED_WORKER_MESSAGE_DESTROY_SURFACE_WAIT_ASYNC;
 
-    payload.base.cmd = async_command_alloc(dispatcher, message, cookie);
+    payload.base.cmd = async_command_alloc(red_qxl, message, cookie);
     payload.surface_id = surface_id;
-    dispatcher_send_message(&dispatcher->dispatcher, message, &payload);
+    dispatcher_send_message(&red_qxl->dispatcher, message, &payload);
 }
 
-static void red_qxl_destroy_surface_wait(RedDispatcher *dispatcher,
+static void red_qxl_destroy_surface_wait(RedQXL *red_qxl,
                                          uint32_t surface_id,
                                          int async, uint64_t cookie)
 {
     if (async) {
-        red_qxl_destroy_surface_wait_async(dispatcher, surface_id, cookie);
+        red_qxl_destroy_surface_wait_async(red_qxl, surface_id, cookie);
     } else {
-        red_qxl_destroy_surface_wait_sync(dispatcher, surface_id);
+        red_qxl_destroy_surface_wait_sync(red_qxl, surface_id);
     }
 }
 
 static void qxl_worker_destroy_surface_wait(QXLWorker *qxl_worker, uint32_t surface_id)
 {
-    red_qxl_destroy_surface_wait((RedDispatcher*)qxl_worker, surface_id, 0, 0);
+    red_qxl_destroy_surface_wait((RedQXL*)qxl_worker, surface_id, 0, 0);
 }
 
-static void red_qxl_reset_memslots(RedDispatcher *dispatcher)
+static void red_qxl_reset_memslots(RedQXL *red_qxl)
 {
     RedWorkerMessageResetMemslots payload;
 
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_RESET_MEMSLOTS,
                             &payload);
 }
 
 static void qxl_worker_reset_memslots(QXLWorker *qxl_worker)
 {
-    red_qxl_reset_memslots((RedDispatcher*)qxl_worker);
+    red_qxl_reset_memslots((RedQXL*)qxl_worker);
 }
 
-static bool red_qxl_set_pending(RedDispatcher *dispatcher, int pending)
+static bool red_qxl_set_pending(RedQXL *red_qxl, int pending)
 {
     // this is not atomic but is not an issue
-    if (test_bit(pending, dispatcher->pending)) {
+    if (test_bit(pending, red_qxl->pending)) {
         return TRUE;
     }
 
-    set_bit(pending, &dispatcher->pending);
+    set_bit(pending, &red_qxl->pending);
     return FALSE;
 }
 
-static void red_qxl_wakeup(RedDispatcher *dispatcher)
+static void red_qxl_wakeup(RedQXL *red_qxl)
 {
     RedWorkerMessageWakeup payload;
 
-    if (red_qxl_set_pending(dispatcher, RED_DISPATCHER_PENDING_WAKEUP))
+    if (red_qxl_set_pending(red_qxl, RED_DISPATCHER_PENDING_WAKEUP))
         return;
 
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_WAKEUP,
                             &payload);
 }
 
 static void qxl_worker_wakeup(QXLWorker *qxl_worker)
 {
-    red_qxl_wakeup((RedDispatcher*)qxl_worker);
+    red_qxl_wakeup((RedQXL*)qxl_worker);
 }
 
-static void red_qxl_oom(RedDispatcher *dispatcher)
+static void red_qxl_oom(RedQXL *red_qxl)
 {
     RedWorkerMessageOom payload;
 
-    if (red_qxl_set_pending(dispatcher, RED_DISPATCHER_PENDING_OOM))
+    if (red_qxl_set_pending(red_qxl, RED_DISPATCHER_PENDING_OOM))
         return;
 
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_OOM,
                             &payload);
 }
 
 static void qxl_worker_oom(QXLWorker *qxl_worker)
 {
-    red_qxl_oom((RedDispatcher*)qxl_worker);
+    red_qxl_oom((RedQXL*)qxl_worker);
 }
 
-void red_qxl_start(RedDispatcher *dispatcher)
+void red_qxl_start(RedQXL *red_qxl)
 {
     RedWorkerMessageStart payload;
 
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_START,
                             &payload);
 }
 
 static void qxl_worker_start(QXLWorker *qxl_worker)
 {
-    red_qxl_start((RedDispatcher*)qxl_worker);
+    red_qxl_start((RedQXL*)qxl_worker);
 }
 
-static void red_qxl_flush_surfaces_async(RedDispatcher *dispatcher, uint64_t cookie)
+static void red_qxl_flush_surfaces_async(RedQXL *red_qxl, uint64_t cookie)
 {
     RedWorkerMessageFlushSurfacesAsync payload;
     RedWorkerMessage message = RED_WORKER_MESSAGE_FLUSH_SURFACES_ASYNC;
 
-    payload.base.cmd = async_command_alloc(dispatcher, message, cookie);
-    dispatcher_send_message(&dispatcher->dispatcher, message, &payload);
+    payload.base.cmd = async_command_alloc(red_qxl, message, cookie);
+    dispatcher_send_message(&red_qxl->dispatcher, message, &payload);
 }
 
-static void red_qxl_monitors_config_async(RedDispatcher *dispatcher,
+static void red_qxl_monitors_config_async(RedQXL *red_qxl,
                                           QXLPHYSICAL monitors_config,
                                           int group_id,
                                           uint64_t cookie)
@@ -586,38 +586,38 @@ static void red_qxl_monitors_config_async(RedDispatcher *dispatcher,
     RedWorkerMessageMonitorsConfigAsync payload;
     RedWorkerMessage message = RED_WORKER_MESSAGE_MONITORS_CONFIG_ASYNC;
 
-    payload.base.cmd = async_command_alloc(dispatcher, message, cookie);
+    payload.base.cmd = async_command_alloc(red_qxl, message, cookie);
     payload.monitors_config = monitors_config;
     payload.group_id = group_id;
-    payload.max_monitors = dispatcher->max_monitors;
+    payload.max_monitors = red_qxl->max_monitors;
 
-    dispatcher_send_message(&dispatcher->dispatcher, message, &payload);
+    dispatcher_send_message(&red_qxl->dispatcher, message, &payload);
 }
 
-static void red_qxl_driver_unload(RedDispatcher *dispatcher)
+static void red_qxl_driver_unload(RedQXL *red_qxl)
 {
     RedWorkerMessageDriverUnload payload;
 
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_DRIVER_UNLOAD,
                             &payload);
 }
 
-void red_qxl_stop(RedDispatcher *dispatcher)
+void red_qxl_stop(RedQXL *red_qxl)
 {
     RedWorkerMessageStop payload;
 
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_STOP,
                             &payload);
 }
 
 static void qxl_worker_stop(QXLWorker *qxl_worker)
 {
-    red_qxl_stop((RedDispatcher*)qxl_worker);
+    red_qxl_stop((RedQXL*)qxl_worker);
 }
 
-static void red_qxl_loadvm_commands(RedDispatcher *dispatcher,
+static void red_qxl_loadvm_commands(RedQXL *red_qxl,
                                     struct QXLCommandExt *ext,
                                     uint32_t count)
 {
@@ -626,7 +626,7 @@ static void red_qxl_loadvm_commands(RedDispatcher *dispatcher,
     spice_printerr("");
     payload.count = count;
     payload.ext = ext;
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_LOADVM_COMMANDS,
                             &payload);
 }
@@ -635,54 +635,54 @@ static void qxl_worker_loadvm_commands(QXLWorker *qxl_worker,
                                        struct QXLCommandExt *ext,
                                        uint32_t count)
 {
-    red_qxl_loadvm_commands((RedDispatcher*)qxl_worker, ext, count);
+    red_qxl_loadvm_commands((RedQXL*)qxl_worker, ext, count);
 }
 
-void red_qxl_set_mm_time(RedDispatcher *dispatcher, uint32_t mm_time)
+void red_qxl_set_mm_time(RedQXL *red_qxl, uint32_t mm_time)
 {
-    dispatcher->qxl->st->qif->set_mm_time(dispatcher->qxl, mm_time);
+    red_qxl->qxl->st->qif->set_mm_time(red_qxl->qxl, mm_time);
 }
 
-void red_qxl_attach_worker(RedDispatcher *dispatcher)
+void red_qxl_attach_worker(RedQXL *red_qxl)
 {
-    QXLInstance *qxl = dispatcher->qxl;
-    qxl->st->qif->attache_worker(qxl, &dispatcher->base);
+    QXLInstance *qxl = red_qxl->qxl;
+    qxl->st->qif->attache_worker(qxl, &red_qxl->base);
 }
 
-void red_qxl_set_compression_level(RedDispatcher *dispatcher, int level)
+void red_qxl_set_compression_level(RedQXL *red_qxl, int level)
 {
-    dispatcher->qxl->st->qif->set_compression_level(dispatcher->qxl, level);
+    red_qxl->qxl->st->qif->set_compression_level(red_qxl->qxl, level);
 }
 
-uint32_t red_qxl_get_ram_size(RedDispatcher *dispatcher)
+uint32_t red_qxl_get_ram_size(RedQXL *red_qxl)
 {
     QXLDevInitInfo qxl_info;
-    dispatcher->qxl->st->qif->get_init_info(dispatcher->qxl, &qxl_info);
+    red_qxl->qxl->st->qif->get_init_info(red_qxl->qxl, &qxl_info);
     return qxl_info.qxl_ram_size;
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_wakeup(QXLInstance *instance)
 {
-    red_qxl_wakeup(instance->st->dispatcher);
+    red_qxl_wakeup(instance->st->red_qxl);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_oom(QXLInstance *instance)
 {
-    red_qxl_oom(instance->st->dispatcher);
+    red_qxl_oom(instance->st->red_qxl);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_start(QXLInstance *instance)
 {
-    red_qxl_start(instance->st->dispatcher);
+    red_qxl_start(instance->st->red_qxl);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_stop(QXLInstance *instance)
 {
-    red_qxl_stop(instance->st->dispatcher);
+    red_qxl_stop(instance->st->red_qxl);
 }
 
 SPICE_GNUC_VISIBLE
@@ -690,133 +690,133 @@ void spice_qxl_update_area(QXLInstance *instance, uint32_t surface_id,
                     struct QXLRect *area, struct QXLRect *dirty_rects,
                     uint32_t num_dirty_rects, uint32_t clear_dirty_region)
 {
-    red_qxl_update_area(instance->st->dispatcher, surface_id, area, dirty_rects,
+    red_qxl_update_area(instance->st->red_qxl, surface_id, area, dirty_rects,
                         num_dirty_rects, clear_dirty_region);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_add_memslot(QXLInstance *instance, QXLDevMemSlot *slot)
 {
-    red_qxl_add_memslot(instance->st->dispatcher, slot);
+    red_qxl_add_memslot(instance->st->red_qxl, slot);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_del_memslot(QXLInstance *instance, uint32_t slot_group_id, uint32_t slot_id)
 {
-    red_qxl_del_memslot(instance->st->dispatcher, slot_group_id, slot_id);
+    red_qxl_del_memslot(instance->st->red_qxl, slot_group_id, slot_id);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_reset_memslots(QXLInstance *instance)
 {
-    red_qxl_reset_memslots(instance->st->dispatcher);
+    red_qxl_reset_memslots(instance->st->red_qxl);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_destroy_surfaces(QXLInstance *instance)
 {
-    red_qxl_destroy_surfaces(instance->st->dispatcher);
+    red_qxl_destroy_surfaces(instance->st->red_qxl);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_destroy_primary_surface(QXLInstance *instance, uint32_t surface_id)
 {
-    red_qxl_destroy_primary_surface(instance->st->dispatcher, surface_id, 0, 0);
+    red_qxl_destroy_primary_surface(instance->st->red_qxl, surface_id, 0, 0);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_create_primary_surface(QXLInstance *instance, uint32_t surface_id,
                                 QXLDevSurfaceCreate *surface)
 {
-    red_qxl_create_primary_surface(instance->st->dispatcher, surface_id, surface, 0, 0);
+    red_qxl_create_primary_surface(instance->st->red_qxl, surface_id, surface, 0, 0);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_reset_image_cache(QXLInstance *instance)
 {
-    red_qxl_reset_image_cache(instance->st->dispatcher);
+    red_qxl_reset_image_cache(instance->st->red_qxl);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_reset_cursor(QXLInstance *instance)
 {
-    red_qxl_reset_cursor(instance->st->dispatcher);
+    red_qxl_reset_cursor(instance->st->red_qxl);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_destroy_surface_wait(QXLInstance *instance, uint32_t surface_id)
 {
-    red_qxl_destroy_surface_wait(instance->st->dispatcher, surface_id, 0, 0);
+    red_qxl_destroy_surface_wait(instance->st->red_qxl, surface_id, 0, 0);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_loadvm_commands(QXLInstance *instance, struct QXLCommandExt *ext, uint32_t count)
 {
-    red_qxl_loadvm_commands(instance->st->dispatcher, ext, count);
+    red_qxl_loadvm_commands(instance->st->red_qxl, ext, count);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_update_area_async(QXLInstance *instance, uint32_t surface_id, QXLRect *qxl_area,
                                  uint32_t clear_dirty_region, uint64_t cookie)
 {
-    red_qxl_update_area_async(instance->st->dispatcher, surface_id, qxl_area,
+    red_qxl_update_area_async(instance->st->red_qxl, surface_id, qxl_area,
                                      clear_dirty_region, cookie);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_add_memslot_async(QXLInstance *instance, QXLDevMemSlot *slot, uint64_t cookie)
 {
-    red_qxl_add_memslot_async(instance->st->dispatcher, slot, cookie);
+    red_qxl_add_memslot_async(instance->st->red_qxl, slot, cookie);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_destroy_surfaces_async(QXLInstance *instance, uint64_t cookie)
 {
-    red_qxl_destroy_surfaces_async(instance->st->dispatcher, cookie);
+    red_qxl_destroy_surfaces_async(instance->st->red_qxl, cookie);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_destroy_primary_surface_async(QXLInstance *instance, uint32_t surface_id, uint64_t cookie)
 {
-    red_qxl_destroy_primary_surface(instance->st->dispatcher, surface_id, 1, cookie);
+    red_qxl_destroy_primary_surface(instance->st->red_qxl, surface_id, 1, cookie);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_create_primary_surface_async(QXLInstance *instance, uint32_t surface_id,
                                 QXLDevSurfaceCreate *surface, uint64_t cookie)
 {
-    red_qxl_create_primary_surface(instance->st->dispatcher, surface_id, surface, 1, cookie);
+    red_qxl_create_primary_surface(instance->st->red_qxl, surface_id, surface, 1, cookie);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_destroy_surface_async(QXLInstance *instance, uint32_t surface_id, uint64_t cookie)
 {
-    red_qxl_destroy_surface_wait(instance->st->dispatcher, surface_id, 1, cookie);
+    red_qxl_destroy_surface_wait(instance->st->red_qxl, surface_id, 1, cookie);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_flush_surfaces_async(QXLInstance *instance, uint64_t cookie)
 {
-    red_qxl_flush_surfaces_async(instance->st->dispatcher, cookie);
+    red_qxl_flush_surfaces_async(instance->st->red_qxl, cookie);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_monitors_config_async(QXLInstance *instance, QXLPHYSICAL monitors_config,
                                      int group_id, uint64_t cookie)
 {
-    red_qxl_monitors_config_async(instance->st->dispatcher, monitors_config, group_id, cookie);
+    red_qxl_monitors_config_async(instance->st->red_qxl, monitors_config, group_id, cookie);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_set_max_monitors(QXLInstance *instance, unsigned int max_monitors)
 {
-    instance->st->dispatcher->max_monitors = MAX(1u, max_monitors);
+    instance->st->red_qxl->max_monitors = MAX(1u, max_monitors);
 }
 
 SPICE_GNUC_VISIBLE
 void spice_qxl_driver_unload(QXLInstance *instance)
 {
-    red_qxl_driver_unload(instance->st->dispatcher);
+    red_qxl_driver_unload(instance->st->red_qxl);
 }
 
 SPICE_GNUC_VISIBLE
@@ -847,7 +847,7 @@ void spice_qxl_gl_scanout(QXLInstance *qxl,
     pthread_mutex_unlock(&qxl->st->scanout_mutex);
 
     /* FIXME: find a way to coallesce all pending SCANOUTs */
-    dispatcher_send_message(&qxl->st->dispatcher->dispatcher,
+    dispatcher_send_message(&qxl->st->red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_GL_SCANOUT, NULL);
 }
 
@@ -857,7 +857,7 @@ void spice_qxl_gl_draw_async(QXLInstance *qxl,
                              uint32_t w, uint32_t h,
                              uint64_t cookie)
 {
-    RedDispatcher *dispatcher;
+    RedQXL *red_qxl;
     RedWorkerMessage message = RED_WORKER_MESSAGE_GL_DRAW_ASYNC;
     SpiceMsgDisplayGlDraw draw = {
         .x = x,
@@ -870,12 +870,12 @@ void spice_qxl_gl_draw_async(QXLInstance *qxl,
     spice_return_if_fail(qxl->st->scanout.drm_dma_buf_fd != -1);
     spice_return_if_fail(qxl->st->gl_draw_async == NULL);
 
-    dispatcher = qxl->st->dispatcher;
-    qxl->st->gl_draw_async = async_command_alloc(dispatcher, message, cookie);
-    dispatcher_send_message(&dispatcher->dispatcher, message, &draw);
+    red_qxl = qxl->st->red_qxl;
+    qxl->st->gl_draw_async = async_command_alloc(red_qxl, message, cookie);
+    dispatcher_send_message(&red_qxl->dispatcher, message, &draw);
 }
 
-void red_qxl_async_complete(struct RedDispatcher *dispatcher,
+void red_qxl_async_complete(RedQXL *red_qxl,
                             AsyncCommand *async_command)
 {
     spice_debug("%p: cookie %" PRId64, async_command, async_command->cookie);
@@ -889,27 +889,27 @@ void red_qxl_async_complete(struct RedDispatcher *dispatcher,
     case RED_WORKER_MESSAGE_GL_DRAW_ASYNC:
         break;
     case RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE_ASYNC:
-        red_qxl_create_primary_surface_complete(dispatcher);
+        red_qxl_create_primary_surface_complete(red_qxl);
         break;
     case RED_WORKER_MESSAGE_DESTROY_PRIMARY_SURFACE_ASYNC:
-        red_qxl_destroy_primary_surface_complete(dispatcher);
+        red_qxl_destroy_primary_surface_complete(red_qxl);
         break;
     default:
         spice_warning("unexpected message %d", async_command->message);
     }
-    dispatcher->qxl->st->qif->async_complete(dispatcher->qxl,
+    red_qxl->qxl->st->qif->async_complete(red_qxl->qxl,
                                              async_command->cookie);
     free(async_command);
 }
 
 void red_qxl_init(QXLInstance *qxl)
 {
-    RedDispatcher *red_dispatcher;
+    RedQXL *red_qxl;
     RedChannel *channel;
     ClientCbs client_cbs = { NULL, };
 
     spice_return_if_fail(qxl != NULL);
-    spice_return_if_fail(qxl->st->dispatcher == NULL);
+    spice_return_if_fail(qxl->st->red_qxl == NULL);
 
     static gsize initialized = FALSE;
     if (g_once_init_enter(&initialized)) {
@@ -918,32 +918,32 @@ void red_qxl_init(QXLInstance *qxl)
         g_once_init_leave(&initialized, TRUE);
     }
 
-    red_dispatcher = spice_new0(RedDispatcher, 1);
-    red_dispatcher->qxl = qxl;
-    dispatcher_init(&red_dispatcher->dispatcher, RED_WORKER_MESSAGE_COUNT, NULL);
-    red_dispatcher->base.major_version = SPICE_INTERFACE_QXL_MAJOR;
-    red_dispatcher->base.minor_version = SPICE_INTERFACE_QXL_MINOR;
-    red_dispatcher->base.wakeup = qxl_worker_wakeup;
-    red_dispatcher->base.oom = qxl_worker_oom;
-    red_dispatcher->base.start = qxl_worker_start;
-    red_dispatcher->base.stop = qxl_worker_stop;
-    red_dispatcher->base.update_area = qxl_worker_update_area;
-    red_dispatcher->base.add_memslot = qxl_worker_add_memslot;
-    red_dispatcher->base.del_memslot = qxl_worker_del_memslot;
-    red_dispatcher->base.reset_memslots = qxl_worker_reset_memslots;
-    red_dispatcher->base.destroy_surfaces = qxl_worker_destroy_surfaces;
-    red_dispatcher->base.create_primary_surface = qxl_worker_create_primary_surface;
-    red_dispatcher->base.destroy_primary_surface = qxl_worker_destroy_primary_surface;
-
-    red_dispatcher->base.reset_image_cache = qxl_worker_reset_image_cache;
-    red_dispatcher->base.reset_cursor = qxl_worker_reset_cursor;
-    red_dispatcher->base.destroy_surface_wait = qxl_worker_destroy_surface_wait;
-    red_dispatcher->base.loadvm_commands = qxl_worker_loadvm_commands;
-
-    red_dispatcher->max_monitors = UINT_MAX;
+    red_qxl = spice_new0(RedQXL, 1);
+    red_qxl->qxl = qxl;
+    dispatcher_init(&red_qxl->dispatcher, RED_WORKER_MESSAGE_COUNT, NULL);
+    red_qxl->base.major_version = SPICE_INTERFACE_QXL_MAJOR;
+    red_qxl->base.minor_version = SPICE_INTERFACE_QXL_MINOR;
+    red_qxl->base.wakeup = qxl_worker_wakeup;
+    red_qxl->base.oom = qxl_worker_oom;
+    red_qxl->base.start = qxl_worker_start;
+    red_qxl->base.stop = qxl_worker_stop;
+    red_qxl->base.update_area = qxl_worker_update_area;
+    red_qxl->base.add_memslot = qxl_worker_add_memslot;
+    red_qxl->base.del_memslot = qxl_worker_del_memslot;
+    red_qxl->base.reset_memslots = qxl_worker_reset_memslots;
+    red_qxl->base.destroy_surfaces = qxl_worker_destroy_surfaces;
+    red_qxl->base.create_primary_surface = qxl_worker_create_primary_surface;
+    red_qxl->base.destroy_primary_surface = qxl_worker_destroy_primary_surface;
+
+    red_qxl->base.reset_image_cache = qxl_worker_reset_image_cache;
+    red_qxl->base.reset_cursor = qxl_worker_reset_cursor;
+    red_qxl->base.destroy_surface_wait = qxl_worker_destroy_surface_wait;
+    red_qxl->base.loadvm_commands = qxl_worker_loadvm_commands;
+
+    red_qxl->max_monitors = UINT_MAX;
 
     // TODO: reference and free
-    RedWorker *worker = red_worker_new(qxl, red_dispatcher);
+    RedWorker *worker = red_worker_new(qxl, red_qxl);
 
     // TODO: move to their respective channel files
     channel = red_worker_get_cursor_channel(worker);
@@ -951,7 +951,7 @@ void red_qxl_init(QXLInstance *qxl)
     client_cbs.disconnect = red_qxl_disconnect_cursor_peer;
     client_cbs.migrate = red_qxl_cursor_migrate;
     red_channel_register_client_cbs(channel, &client_cbs);
-    red_channel_set_data(channel, red_dispatcher);
+    red_channel_set_data(channel, red_qxl);
     reds_register_channel(reds, channel);
 
     channel = red_worker_get_display_channel(worker);
@@ -959,7 +959,7 @@ void red_qxl_init(QXLInstance *qxl)
     client_cbs.disconnect = red_qxl_disconnect_display_peer;
     client_cbs.migrate = red_qxl_display_migrate;
     red_channel_register_client_cbs(channel, &client_cbs);
-    red_channel_set_data(channel, red_dispatcher);
+    red_channel_set_data(channel, red_qxl);
     red_channel_set_cap(channel, SPICE_DISPLAY_CAP_MONITORS_CONFIG);
     red_channel_set_cap(channel, SPICE_DISPLAY_CAP_PREF_COMPRESSION);
     red_channel_set_cap(channel, SPICE_DISPLAY_CAP_STREAM_REPORT);
@@ -967,66 +967,66 @@ void red_qxl_init(QXLInstance *qxl)
 
     red_worker_run(worker);
 
-    qxl->st->dispatcher = red_dispatcher;
+    qxl->st->red_qxl = red_qxl;
 }
 
-struct Dispatcher *red_qxl_get_dispatcher(RedDispatcher *red_dispatcher)
+struct Dispatcher *red_qxl_get_dispatcher(RedQXL *red_qxl)
 {
-    return &red_dispatcher->dispatcher;
+    return &red_qxl->dispatcher;
 }
 
-void red_qxl_set_dispatcher_opaque(RedDispatcher *red_dispatcher,
+void red_qxl_set_dispatcher_opaque(RedQXL *red_qxl,
                                           void *opaque)
 {
-    dispatcher_set_opaque(&red_dispatcher->dispatcher, opaque);
+    dispatcher_set_opaque(&red_qxl->dispatcher, opaque);
 }
 
-void red_qxl_clear_pending(RedDispatcher *red_dispatcher, int pending)
+void red_qxl_clear_pending(RedQXL *red_qxl, int pending)
 {
-    spice_return_if_fail(red_dispatcher != NULL);
+    spice_return_if_fail(red_qxl != NULL);
 
-    clear_bit(pending, &red_dispatcher->pending);
+    clear_bit(pending, &red_qxl->pending);
 }
 
-gboolean red_qxl_get_primary_active(RedDispatcher *dispatcher)
+gboolean red_qxl_get_primary_active(RedQXL *red_qxl)
 {
-    return dispatcher->primary_active;
+    return red_qxl->primary_active;
 }
 
-gboolean red_qxl_get_allow_client_mouse(RedDispatcher *dispatcher, gint *x_res, gint *y_res)
+gboolean red_qxl_get_allow_client_mouse(RedQXL *red_qxl, gint *x_res, gint *y_res)
 {
-    if (dispatcher->use_hardware_cursor) {
+    if (red_qxl->use_hardware_cursor) {
         if (x_res)
-            *x_res = dispatcher->x_res;
+            *x_res = red_qxl->x_res;
         if (y_res)
-            *y_res = dispatcher->y_res;
+            *y_res = red_qxl->y_res;
     }
-    return dispatcher->use_hardware_cursor;
+    return red_qxl->use_hardware_cursor;
 }
 
-void red_qxl_on_ic_change(RedDispatcher *dispatcher, SpiceImageCompression ic)
+void red_qxl_on_ic_change(RedQXL *red_qxl, SpiceImageCompression ic)
 {
     RedWorkerMessageSetCompression payload;
     payload.image_compression = ic;
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_SET_COMPRESSION,
                             &payload);
 }
 
-void red_qxl_on_sv_change(RedDispatcher *dispatcher, int sv)
+void red_qxl_on_sv_change(RedQXL *red_qxl, int sv)
 {
     RedWorkerMessageSetStreamingVideo payload;
     payload.streaming_video = sv;
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_SET_STREAMING_VIDEO,
                             &payload);
 }
 
-void red_qxl_set_mouse_mode(RedDispatcher *dispatcher, uint32_t mode)
+void red_qxl_set_mouse_mode(RedQXL *red_qxl, uint32_t mode)
 {
     RedWorkerMessageSetMouseMode payload;
     payload.mode = mode;
-    dispatcher_send_message(&dispatcher->dispatcher,
+    dispatcher_send_message(&red_qxl->dispatcher,
                             RED_WORKER_MESSAGE_SET_MOUSE_MODE,
                             &payload);
 }
diff --git a/server/red-qxl.h b/server/red-qxl.h
index 1348e6c..ada032e 100644
--- a/server/red-qxl.h
+++ b/server/red-qxl.h
@@ -20,27 +20,27 @@
 
 #include "red-channel.h"
 
-typedef struct RedDispatcher RedDispatcher;
+typedef struct RedQXL RedQXL;
 
 typedef struct AsyncCommand AsyncCommand;
 
 void red_qxl_init(QXLInstance *qxl);
 
-void red_qxl_set_mm_time(RedDispatcher *dispatcher, uint32_t);
-void red_qxl_on_ic_change(RedDispatcher *dispatcher, SpiceImageCompression ic);
-void red_qxl_on_sv_change(RedDispatcher *dispatcher, int sv);
-void red_qxl_set_mouse_mode(RedDispatcher *dispatcher, uint32_t mode);
-void red_qxl_attach_worker(RedDispatcher *dispatcher);
-void red_qxl_set_compression_level(RedDispatcher *dispatcher, int level);
-void red_qxl_stop(RedDispatcher *dispatcher);
-void red_qxl_start(RedDispatcher *dispatcher);
-uint32_t red_qxl_get_ram_size(RedDispatcher *dispatcher);
-void red_qxl_async_complete(struct RedDispatcher *, AsyncCommand *);
-struct Dispatcher *red_qxl_get_dispatcher(struct RedDispatcher *);
-gboolean red_qxl_use_client_monitors_config(RedDispatcher *dispatcher);
-gboolean red_qxl_client_monitors_config(RedDispatcher *dispatcher, VDAgentMonitorsConfig *monitors_config);
-gboolean red_qxl_get_primary_active(RedDispatcher *dispatcher);
-gboolean red_qxl_get_allow_client_mouse(RedDispatcher *dispatcher, gint *x_res, gint *y_res);
+void red_qxl_set_mm_time(RedQXL *red_qxl, uint32_t);
+void red_qxl_on_ic_change(RedQXL *red_qxl, SpiceImageCompression ic);
+void red_qxl_on_sv_change(RedQXL *red_qxl, int sv);
+void red_qxl_set_mouse_mode(RedQXL *red_qxl, uint32_t mode);
+void red_qxl_attach_worker(RedQXL *red_qxl);
+void red_qxl_set_compression_level(RedQXL *red_qxl, int level);
+void red_qxl_stop(RedQXL *red_qxl);
+void red_qxl_start(RedQXL *red_qxl);
+uint32_t red_qxl_get_ram_size(RedQXL *red_qxl);
+void red_qxl_async_complete(RedQXL *red_qxl, AsyncCommand *cmd);
+struct Dispatcher *red_qxl_get_dispatcher(RedQXL *red_qxl);
+gboolean red_qxl_use_client_monitors_config(RedQXL *red_qxl);
+gboolean red_qxl_client_monitors_config(RedQXL *red_qxl, VDAgentMonitorsConfig *monitors_config);
+gboolean red_qxl_get_primary_active(RedQXL *red_qxl);
+gboolean red_qxl_get_allow_client_mouse(RedQXL *red_qxl, gint *x_res, gint *y_res);
 
 typedef uint32_t RedWorkerMessage;
 
@@ -267,6 +267,6 @@ enum {
     RED_DISPATCHER_PENDING_OOM,
 };
 
-void red_qxl_clear_pending(RedDispatcher *red_dispatcher, int pending);
+void red_qxl_clear_pending(RedQXL *red_qxl, int pending);
 
 #endif
diff --git a/server/red-worker.c b/server/red-worker.c
index b8ab555..283a044 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -60,7 +60,7 @@
 struct RedWorker {
     pthread_t thread;
     QXLInstance *qxl;
-    RedDispatcher *red_dispatcher;
+    RedQXL *red_qxl;
     SpiceWatch *dispatch_watch;
     int running;
     SpiceCoreInterfaceInternal core;
@@ -823,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_dispatcher, RED_DISPATCHER_PENDING_WAKEUP);
+    red_qxl_clear_pending(worker->red_qxl, RED_DISPATCHER_PENDING_WAKEUP);
 }
 
 static void handle_dev_oom(void *opaque, void *payload)
@@ -853,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_dispatcher, RED_DISPATCHER_PENDING_OOM);
+    red_qxl_clear_pending(worker->red_qxl, RED_DISPATCHER_PENDING_OOM);
 }
 
 static void handle_dev_reset_cursor(void *opaque, void *payload)
@@ -1194,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_dispatcher, msg_async->cmd);
+    red_qxl_async_complete(worker->red_qxl, msg_async->cmd);
 }
 
 static void worker_dispatcher_record(void *opaque, uint32_t message_type, void *payload)
@@ -1394,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_dispatcher));
+    dispatcher_handle_recv_read(red_qxl_get_dispatcher(worker->red_qxl));
 }
 
 typedef struct RedWorkerSource {
@@ -1462,7 +1462,7 @@ static GSourceFuncs worker_source_funcs = {
     .dispatch = worker_source_dispatch,
 };
 
-RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher)
+RedWorker* red_worker_new(QXLInstance *qxl, RedQXL *red_qxl)
 {
     QXLDevInitInfo init_info;
     RedWorker *worker;
@@ -1487,10 +1487,10 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher)
             spice_error("failed to write replay header");
         }
     }
-    dispatcher = red_qxl_get_dispatcher(red_dispatcher);
+    dispatcher = red_qxl_get_dispatcher(red_qxl);
     dispatcher_set_opaque(dispatcher, worker);
 
-    worker->red_dispatcher = red_dispatcher;
+    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 e51e261..798e8c0 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, RedDispatcher *red_dispatcher);
+RedWorker* red_worker_new(QXLInstance *qxl, RedQXL *red_qxl);
 bool       red_worker_run(RedWorker *worker);
 RedChannel* red_worker_get_cursor_channel(RedWorker *worker);
 RedChannel* red_worker_get_display_channel(RedWorker *worker);
diff --git a/server/reds-private.h b/server/reds-private.h
index f567929..7877c73 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -241,7 +241,7 @@ struct RedsState {
 
     RedSSLParameters ssl_parameters;
     SpiceCoreInterfaceInternal *core;
-    GList *dispatchers;
+    GList *red_qxls;
     MainDispatcher *main_dispatcher;
 };
 
diff --git a/server/reds.c b/server/reds.c
index 8ab4bbd..bd79dd4 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -570,7 +570,7 @@ static void reds_set_mouse_mode(RedsState *reds, uint32_t mode)
     }
     reds->mouse_mode = mode;
 
-    for (l = reds->dispatchers; l != NULL; l = l->next)
+    for (l = reds->red_qxls; l != NULL; l = l->next)
         red_qxl_set_mouse_mode(l->data, mode);
 
     main_channel_push_mouse_mode(reds->main_channel, reds->mouse_mode, reds->is_client_mouse_allowed);
@@ -584,7 +584,7 @@ gboolean reds_get_agent_mouse(const RedsState *reds)
 static void reds_update_mouse_mode(RedsState *reds)
 {
     int allowed = 0;
-    int qxl_count = g_list_length(reds->dispatchers);
+    int qxl_count = g_list_length(reds->red_qxls);
 
     if ((reds->agent_mouse && reds->vdagent) ||
         (inputs_channel_has_tablet(reds->inputs_channel) && qxl_count == 1)) {
@@ -1681,7 +1681,7 @@ static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link)
     }
 
     if (!mig_target) {
-        main_channel_push_init(mcc, g_list_length(reds->dispatchers),
+        main_channel_push_init(mcc, g_list_length(reds->red_qxls),
             reds->mouse_mode, reds->is_client_mouse_allowed,
             reds_get_mm_time() - MM_TIME_DELTA,
             reds_qxl_ram_size(reds));
@@ -1827,7 +1827,7 @@ void reds_on_client_semi_seamless_migrate_complete(RedsState *reds, RedClient *c
     mcc = red_client_get_main(client);
 
     // TODO: not doing net test. consider doing it on client_migrate_info
-    main_channel_push_init(mcc, g_list_length(reds->dispatchers),
+    main_channel_push_init(mcc, g_list_length(reds->red_qxls),
                            reds->mouse_mode, reds->is_client_mouse_allowed,
                            reds_get_mm_time() - MM_TIME_DELTA,
                            reds_qxl_ram_size(reds));
@@ -3195,7 +3195,7 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s,
         }
     } else if (strcmp(interface->type, SPICE_INTERFACE_QXL) == 0) {
         QXLInstance *qxl;
-        RedDispatcher *dispatcher;
+        RedQXL *red_qxl;
 
         spice_info("SPICE_INTERFACE_QXL");
         if (interface->major_version != SPICE_INTERFACE_QXL_MAJOR ||
@@ -3210,16 +3210,16 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s,
         qxl->st->scanout.drm_dma_buf_fd = -1;
         qxl->st->qif = SPICE_CONTAINEROF(interface, QXLInterface, base);
         red_qxl_init(qxl);
-        dispatcher = qxl->st->dispatcher;
-        reds->dispatchers = g_list_prepend(reds->dispatchers, dispatcher);
+        red_qxl = qxl->st->red_qxl;
+        reds->red_qxls = g_list_prepend(reds->red_qxls, red_qxl);
 
-        /* this function has to be called after the dispatcher is on the list
-         * as QXLInstance clients expect the dispatcher to be on the list when
+        /* this function has to be called after the qxl is on the list
+         * as QXLInstance clients expect the qxl to be on the list when
          * this callback is called. This as clients assume they can start the
-         * dispatchers. Also note that this should be the first callback to
+         * red_qxls. Also note that this should be the first callback to
          * be called. */
-        red_qxl_attach_worker(dispatcher);
-        red_qxl_set_compression_level(dispatcher, calc_compression_level(reds));
+        red_qxl_attach_worker(red_qxl);
+        red_qxl_set_compression_level(red_qxl, calc_compression_level(reds));
     } else if (strcmp(interface->type, SPICE_INTERFACE_TABLET) == 0) {
         SpiceTabletInstance *tablet = SPICE_CONTAINEROF(sin, SpiceTabletInstance, base);
         spice_info("SPICE_INTERFACE_TABLET");
@@ -4071,13 +4071,13 @@ void reds_update_client_mouse_allowed(RedsState *reds)
     int x_res = 0;
     int y_res = 0;
     GList *l;
-    int num_active_workers = g_list_length(reds->dispatchers);
+    int num_active_workers = g_list_length(reds->red_qxls);
 
     if (num_active_workers > 0) {
         allow_now = TRUE;
-        for (l = reds->dispatchers; l != NULL && allow_now; l = l->next) {
+        for (l = reds->red_qxls; l != NULL && allow_now; l = l->next) {
 
-            RedDispatcher *now = l->data;
+            RedQXL *now = l->data;
             if (red_qxl_get_primary_active(now)) {
                 allow_now = red_qxl_get_allow_client_mouse(now, &x_res, &y_res);
                 break;
@@ -4095,12 +4095,12 @@ gboolean reds_use_client_monitors_config(RedsState *reds)
 {
     GList *l;
 
-    if (reds->dispatchers == NULL) {
+    if (reds->red_qxls == NULL) {
         return FALSE;
     }
 
-    for (l = reds->dispatchers; l != NULL ; l = l->next) {
-        RedDispatcher *now = l->data;
+    for (l = reds->red_qxls; l != NULL ; l = l->next) {
+        RedQXL *now = l->data;
 
         if (!red_qxl_use_client_monitors_config(now))
             return FALSE;
@@ -4112,8 +4112,8 @@ void reds_client_monitors_config(RedsState *reds, VDAgentMonitorsConfig *monitor
 {
     GList *l;
 
-    for (l = reds->dispatchers; l != NULL; l = l->next) {
-        RedDispatcher *now = l->data;
+    for (l = reds->red_qxls; l != NULL; l = l->next) {
+        RedQXL *now = l->data;
         if (!red_qxl_client_monitors_config(now, monitors_config)) {
             /* this is a normal condition, some qemu devices might not implement it */
             spice_debug("QXLInterface::client_monitors_config failed\n");
@@ -4125,8 +4125,8 @@ void reds_set_mm_time(RedsState *reds, uint32_t mm_time)
 {
     GList *l;
 
-    for (l = reds->dispatchers; l != NULL; l = l->next) {
-        RedDispatcher *now = l->data;
+    for (l = reds->red_qxls; l != NULL; l = l->next) {
+        RedQXL *now = l->data;
         red_qxl_set_mm_time(now, mm_time);
     }
 }
@@ -4148,10 +4148,10 @@ void reds_on_ic_change(RedsState *reds)
     int compression_level = calc_compression_level(reds);
     GList *l;
 
-    for (l = reds->dispatchers; l != NULL; l = l->next) {
-        RedDispatcher *d = l->data;
-        red_qxl_set_compression_level(d, compression_level);
-        red_qxl_on_ic_change(d, spice_server_get_image_compression(reds));
+    for (l = reds->red_qxls; l != NULL; l = l->next) {
+        RedQXL *q = l->data;
+        red_qxl_set_compression_level(q, compression_level);
+        red_qxl_on_ic_change(q, spice_server_get_image_compression(reds));
     }
 }
 
@@ -4160,10 +4160,10 @@ void reds_on_sv_change(RedsState *reds)
     int compression_level = calc_compression_level(reds);
     GList *l;
 
-    for (l = reds->dispatchers; l != NULL; l = l->next) {
-        RedDispatcher *d = l->data;
-        red_qxl_set_compression_level(d, compression_level);
-        red_qxl_on_sv_change(d, reds_get_streaming_video(reds));
+    for (l = reds->red_qxls; l != NULL; l = l->next) {
+        RedQXL *q = l->data;
+        red_qxl_set_compression_level(q, compression_level);
+        red_qxl_on_sv_change(q, reds_get_streaming_video(reds));
     }
 }
 
@@ -4171,7 +4171,7 @@ void reds_on_vm_stop(RedsState *reds)
 {
     GList *l;
 
-    for (l = reds->dispatchers; l != NULL; l = l->next)
+    for (l = reds->red_qxls; l != NULL; l = l->next)
         red_qxl_stop(l->data);
 }
 
@@ -4179,18 +4179,18 @@ void reds_on_vm_start(RedsState *reds)
 {
     GList *l;
 
-    for (l = reds->dispatchers; l != NULL; l = l->next)
+    for (l = reds->red_qxls; l != NULL; l = l->next)
         red_qxl_start(l->data);
 }
 
 uint32_t reds_qxl_ram_size(RedsState *reds)
 {
-    RedDispatcher *first;
-    if (!reds->dispatchers) {
+    RedQXL *first;
+    if (!reds->red_qxls) {
         return 0;
     }
 
-    first = reds->dispatchers->data;
+    first = reds->red_qxls->data;
     return red_qxl_get_ram_size(first);
 }
 
diff --git a/server/reds.h b/server/reds.h
index 891a1ea..46cea85 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -36,7 +36,7 @@ extern RedsState *reds;
 
 struct QXLState {
     QXLInterface          *qif;
-    struct RedDispatcher  *dispatcher;
+    struct RedQXL  *red_qxl;
     pthread_mutex_t scanout_mutex;
     SpiceMsgDisplayGlScanoutUnix scanout;
     struct AsyncCommand *gl_draw_async;
-- 
2.5.0



More information about the Spice-devel mailing list