diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-10-03 21:23:54 +0200 |
---|---|---|
committer | Fabiano Fidêncio <fidencio@redhat.com> | 2015-02-23 23:00:41 +0100 |
commit | 9c6aa5f8487113c6ae0f69beb67cd76d7c160856 (patch) | |
tree | 2d58544999b50f9c844a075be1cef50f292b667e | |
parent | 9b0c617b1d864efc8e948bec426ae4b9c3aeccb1 (diff) | |
download | spice-9c6aa5f8487113c6ae0f69beb67cd76d7c160856.tar.gz spice-9c6aa5f8487113c6ae0f69beb67cd76d7c160856.tar.xz spice-9c6aa5f8487113c6ae0f69beb67cd76d7c160856.zip |
worker: move red_process_surface
-rw-r--r-- | server/display-channel.c | 42 | ||||
-rw-r--r-- | server/display-channel.h | 4 | ||||
-rw-r--r-- | server/red_worker.c | 49 |
3 files changed, 50 insertions, 45 deletions
diff --git a/server/display-channel.c b/server/display-channel.c index 21df90f9..45f6067e 100644 --- a/server/display-channel.c +++ b/server/display-channel.c @@ -2000,3 +2000,45 @@ DisplayChannel* display_channel_new(RedWorker *worker, int migrate, uint32_t n_s return display; } + +void display_channel_process_surface_cmd(DisplayChannel *display, RedSurfaceCmd *surface, + uint32_t group_id, int loadvm) +{ + int surface_id; + RedSurface *red_surface; + uint8_t *data; + + surface_id = surface->surface_id; + spice_return_if_fail(surface_id < display->n_surfaces); + + red_surface = &display->surfaces[surface_id]; + + switch (surface->type) { + case QXL_SURFACE_CMD_CREATE: { + uint32_t height = surface->u.surface_create.height; + int32_t stride = surface->u.surface_create.stride; + int reloaded_surface = loadvm || (surface->flags & QXL_SURF_FLAG_KEEP_DATA); + + data = surface->u.surface_create.data; + if (stride < 0) { + data -= (int32_t)(stride * (height - 1)); + } + display_channel_create_surface(display, surface_id, surface->u.surface_create.width, + height, stride, surface->u.surface_create.format, data, + reloaded_surface, + // reloaded surfaces will be sent on demand + !reloaded_surface); + display_channel_set_surface_release_info(display, surface_id, 1, surface->release_info, group_id); + break; + } + case QXL_SURFACE_CMD_DESTROY: + spice_warn_if(!red_surface->context.canvas); + display_channel_set_surface_release_info(display, surface_id, 0, surface->release_info, group_id); + display_channel_destroy_surface(display, surface_id); + break; + default: + spice_warn_if_reached(); + }; + red_put_surface_cmd(surface); + free(surface); +} diff --git a/server/display-channel.h b/server/display-channel.h index 2adc20c6..8f377808 100644 --- a/server/display-channel.h +++ b/server/display-channel.h @@ -289,6 +289,10 @@ void display_channel_destroy_surfaces (DisplayCha void display_channel_destroy_surface (DisplayChannel *display, uint32_t surface_id); uint32_t display_channel_generate_uid (DisplayChannel *display); +void display_channel_process_surface_cmd (DisplayChannel *display, + RedSurfaceCmd *surface, + uint32_t group_id, + int loadvm); static inline int validate_surface(DisplayChannel *display, uint32_t surface_id) { diff --git a/server/red_worker.c b/server/red_worker.c index 3a51d8d4..27a817ee 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -211,49 +211,6 @@ end: } -static void red_process_surface(RedWorker *worker, RedSurfaceCmd *surface, - uint32_t group_id, int loadvm) -{ - DisplayChannel *display = worker->display_channel; - int surface_id; - RedSurface *red_surface; - uint8_t *data; - - surface_id = surface->surface_id; - spice_return_if_fail(surface_id < display->n_surfaces); - - red_surface = &display->surfaces[surface_id]; - - switch (surface->type) { - case QXL_SURFACE_CMD_CREATE: { - uint32_t height = surface->u.surface_create.height; - int32_t stride = surface->u.surface_create.stride; - int reloaded_surface = loadvm || (surface->flags & QXL_SURF_FLAG_KEEP_DATA); - - data = surface->u.surface_create.data; - if (stride < 0) { - data -= (int32_t)(stride * (height - 1)); - } - display_channel_create_surface(worker->display_channel, surface_id, surface->u.surface_create.width, - height, stride, surface->u.surface_create.format, data, - reloaded_surface, - // reloaded surfaces will be sent on demand - !reloaded_surface); - display_channel_set_surface_release_info(display, surface_id, 1, surface->release_info, group_id); - break; - } - case QXL_SURFACE_CMD_DESTROY: - spice_warn_if(!red_surface->context.canvas); - display_channel_set_surface_release_info(display, surface_id, 0, surface->release_info, group_id); - display_channel_destroy_surface(display, surface_id); - break; - default: - spice_warn_if_reached(); - }; - red_put_surface_cmd(surface); - free(surface); -} - static int red_process_cursor(RedWorker *worker, uint32_t max_pipe_size, int *ring_is_empty) { QXLCommandExt ext_cmd; @@ -404,7 +361,8 @@ static int red_process_commands(RedWorker *worker, uint32_t max_pipe_size, int * free(surface); break; } - red_process_surface(worker, surface, ext_cmd.group_id, FALSE); + display_channel_process_surface_cmd(worker->display_channel, surface, + ext_cmd.group_id, FALSE); break; } default: @@ -1474,7 +1432,8 @@ static int loadvm_command(RedWorker *worker, QXLCommandExt *ext) free(surface_cmd); return FALSE; } - red_process_surface(worker, surface_cmd, ext->group_id, TRUE); + display_channel_process_surface_cmd(worker->display_channel, surface_cmd, + ext->group_id, TRUE); break; default: spice_warning("unhandled loadvm command type (%d)", ext->cmd.type); |