[Spice-commits] server/display-channel.c server/display-channel.h server/red_worker.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Wed Dec 2 04:36:48 PST 2015


 server/display-channel.c |   17 +++++++++++++++++
 server/display-channel.h |    2 ++
 server/red_worker.c      |   21 ++++-----------------
 3 files changed, 23 insertions(+), 17 deletions(-)

New commits:
commit 4980850dd2feea6a85b344addbe9baf005e1c229
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Thu Oct 3 21:31:20 2013 +0200

    display: add update_compression() method
    
    Acked-by: Pavel Grunt <pgrunt at redhat.com>

diff --git a/server/display-channel.c b/server/display-channel.c
index 29fa1bb..2bf65a8 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1875,3 +1875,20 @@ exit:
     red_put_surface_cmd(surface);
     free(surface);
 }
+
+void display_channel_update_compression(DisplayChannel *display, DisplayChannelClient *dcc)
+{
+    if (dcc->jpeg_state == SPICE_WAN_COMPRESSION_AUTO) {
+        display->enable_jpeg = dcc->common.is_low_bandwidth;
+    } else {
+        display->enable_jpeg = (dcc->jpeg_state == SPICE_WAN_COMPRESSION_ALWAYS);
+    }
+
+    if (dcc->zlib_glz_state == SPICE_WAN_COMPRESSION_AUTO) {
+        display->enable_zlib_glz_wrap = dcc->common.is_low_bandwidth;
+    } else {
+        display->enable_zlib_glz_wrap = (dcc->zlib_glz_state == SPICE_WAN_COMPRESSION_ALWAYS);
+    }
+    spice_info("jpeg %s", display->enable_jpeg ? "enabled" : "disabled");
+    spice_info("zlib-over-glz %s", display->enable_zlib_glz_wrap ? "enabled" : "disabled");
+}
diff --git a/server/display-channel.h b/server/display-channel.h
index 7bef638..7187600 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -304,6 +304,8 @@ void                       display_channel_process_surface_cmd       (DisplayCha
                                                                       RedSurfaceCmd *surface,
                                                                       uint32_t group_id,
                                                                       int loadvm);
+void                       display_channel_update_compression        (DisplayChannel *display,
+                                                                      DisplayChannelClient *dcc);
 
 static inline int validate_surface(DisplayChannel *display, uint32_t surface_id)
 {
diff --git a/server/red_worker.c b/server/red_worker.c
index 0f5152a..4702949 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -954,34 +954,21 @@ static void handle_new_display_channel(RedWorker *worker, RedClient *client, Red
                                        uint32_t *common_caps, int num_common_caps,
                                        uint32_t *caps, int num_caps)
 {
-    DisplayChannel *display_channel;
+    DisplayChannel *display;
     DisplayChannelClient *dcc;
 
     spice_return_if_fail(worker->display_channel);
 
-    display_channel = worker->display_channel;
+    display = worker->display_channel;
     spice_info("add display channel client");
-    dcc = dcc_new(display_channel, client, stream, migrate,
+    dcc = dcc_new(display, client, stream, migrate,
                   common_caps, num_common_caps, caps, num_caps,
                   worker->image_compression, worker->jpeg_state, worker->zlib_glz_state);
     if (!dcc) {
         return;
     }
 
-    if (dcc->jpeg_state == SPICE_WAN_COMPRESSION_AUTO) {
-        display_channel->enable_jpeg = dcc->common.is_low_bandwidth;
-    } else {
-        display_channel->enable_jpeg = (dcc->jpeg_state == SPICE_WAN_COMPRESSION_ALWAYS);
-    }
-
-    if (dcc->zlib_glz_state == SPICE_WAN_COMPRESSION_AUTO) {
-        display_channel->enable_zlib_glz_wrap = dcc->common.is_low_bandwidth;
-    } else {
-        display_channel->enable_zlib_glz_wrap = (dcc->zlib_glz_state ==
-                                                 SPICE_WAN_COMPRESSION_ALWAYS);
-    }
-    spice_info("jpeg %s", display_channel->enable_jpeg ? "enabled" : "disabled");
-    spice_info("zlib-over-glz %s", display_channel->enable_zlib_glz_wrap ? "enabled" : "disabled");
+    display_channel_update_compression(display, dcc);
 
     guest_set_client_capabilities(worker);
     dcc_start(dcc);


More information about the Spice-commits mailing list