[PATCH 05/15] server: move renderer members to DisplayChannel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Marc-André Lureau <marcandre.lureau@xxxxxxxxx>

---
 server/red_worker.c | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index bad8e47..491e55e 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -376,6 +376,10 @@ Ring glz_dictionary_list = {&glz_dictionary_list, &glz_dictionary_list};
 struct DisplayChannel {
     CommonChannel common; // Must be the first thing
 
+    uint32_t num_renderers;
+    uint32_t renderers[RED_RENDERER_LAST];
+    uint32_t renderer;
+
     int enable_jpeg;
     int jpeg_quality;
     int enable_zlib_glz_wrap;
@@ -481,10 +485,6 @@ typedef struct RedWorker {
     CursorChannel *cursor_channel;
     uint32_t cursor_poll_tries;
 
-    uint32_t num_renderers;
-    uint32_t renderers[RED_RENDERER_LAST];
-    uint32_t renderer;
-
     RedSurface surfaces[NUM_SURFACES];
     uint32_t n_surfaces;
     SpiceImageSurfaces image_surfaces;
@@ -8302,6 +8302,7 @@ static inline void red_create_surface(RedWorker *worker, uint32_t surface_id, ui
                                       void *line_0, int data_is_valid, int send_client)
 {
     RedSurface *surface = &worker->surfaces[surface_id];
+    DisplayChannel*display = worker->display_channel;
     uint32_t i;
 
     spice_warn_if(surface->context.canvas);
@@ -8326,8 +8327,8 @@ static inline void red_create_surface(RedWorker *worker, uint32_t surface_id, ui
     ring_init(&surface->depend_on_me);
     region_init(&surface->draw_dirty_region);
     surface->refs = 1;
-    if (worker->renderer != RED_RENDERER_INVALID) {
-        surface->context.canvas = create_canvas_for_surface(worker, surface, worker->renderer,
+    if (display->renderer != RED_RENDERER_INVALID) {
+        surface->context.canvas = create_canvas_for_surface(worker, surface, display->renderer,
                                                             width, height, stride,
                                                             surface->context.format, line_0);
         if (!surface->context.canvas) {
@@ -8343,12 +8344,12 @@ static inline void red_create_surface(RedWorker *worker, uint32_t surface_id, ui
         return;
     }
 
-    for (i = 0; i < worker->num_renderers; i++) {
-        surface->context.canvas = create_canvas_for_surface(worker, surface, worker->renderers[i],
+    for (i = 0; i < display->num_renderers; i++) {
+        surface->context.canvas = create_canvas_for_surface(worker, surface, display->renderers[i],
                                                             width, height, stride,
                                                             surface->context.format, line_0);
         if (surface->context.canvas) { //no need canvas check
-            worker->renderer = worker->renderers[i];
+            display->renderer = display->renderers[i];
             if (send_client) {
                 red_worker_create_surface_item(worker, surface_id);
                 if (data_is_valid) {
@@ -9260,9 +9261,7 @@ static void display_channel_create(RedWorker *worker, int migrate)
         .handle_migrate_data_get_serial = display_channel_handle_migrate_data_get_serial
     };
 
-    if (worker->display_channel) {
-        return;
-    }
+    spice_return_if_fail(num_renderers > 0);
 
     spice_info("create display channel");
     if (!(worker->display_channel = (DisplayChannel *)red_worker_new_channel(
@@ -9290,6 +9289,10 @@ static void display_channel_create(RedWorker *worker, int migrate)
     stat_compress_init(&display_channel->zlib_glz_stat, zlib_stat_name);
     stat_compress_init(&display_channel->jpeg_alpha_stat, jpeg_alpha_stat_name);
     stat_compress_init(&display_channel->lz4_stat, lz4_stat_name);
+
+    display_channel->num_renderers = num_renderers;
+    memcpy(display_channel->renderers, renderers, sizeof(display_channel->renderers));
+    display_channel->renderer = RED_RENDERER_INVALID;
 }
 
 static void guest_set_client_capabilities(RedWorker *worker)
@@ -10545,10 +10548,6 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher)
     if (worker->record_fd) {
         dispatcher_register_universal_handler(dispatcher, worker_dispatcher_record);
     }
-    spice_assert(num_renderers > 0);
-    worker->num_renderers = num_renderers;
-    memcpy(worker->renderers, renderers, sizeof(worker->renderers));
-    worker->renderer = RED_RENDERER_INVALID;
     worker->image_compression = image_compression;
     worker->jpeg_state = jpeg_state;
     worker->zlib_glz_state = zlib_glz_state;
-- 
2.4.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]