[Spice-commits] server/red-dispatcher.c server/reds.c server/reds.h server/reds-private.h server/red-worker.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Feb 2 15:46:01 UTC 2016


 server/red-dispatcher.c |    4 ++--
 server/red-worker.c     |    3 ++-
 server/reds-private.h   |    1 +
 server/reds.c           |   14 +++++++-------
 server/reds.h           |    1 -
 5 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit f23c03e37b9de5489ce1eda792622415eff33395
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Tue Jan 27 14:12:17 2015 -0600

    Move image_compression to RedsState struct
    
    Removing more global variables
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/red-dispatcher.c b/server/red-dispatcher.c
index b4bbe85..fa2a42c 100644
--- a/server/red-dispatcher.c
+++ b/server/red-dispatcher.c
@@ -706,7 +706,7 @@ static inline int calc_compression_level(void)
 {
     spice_assert(streaming_video != SPICE_STREAM_VIDEO_INVALID);
     if ((streaming_video != SPICE_STREAM_VIDEO_OFF) ||
-        (image_compression != SPICE_IMAGE_COMPRESSION_QUIC)) {
+        (spice_server_get_image_compression(reds) != SPICE_IMAGE_COMPRESSION_QUIC)) {
         return 0;
     } else {
         return 1;
@@ -721,7 +721,7 @@ void red_dispatcher_on_ic_change(void)
 
     while (now) {
         now->qxl->st->qif->set_compression_level(now->qxl, compression_level);
-        payload.image_compression = image_compression;
+        payload.image_compression = spice_server_get_image_compression(reds);
         dispatcher_send_message(&now->dispatcher,
                                 RED_WORKER_MESSAGE_SET_COMPRESSION,
                                 &payload);
diff --git a/server/red-worker.c b/server/red-worker.c
index 560d172..f98b2f4 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -1505,7 +1505,8 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher)
     if (worker->record_fd) {
         dispatcher_register_universal_handler(dispatcher, worker_dispatcher_record);
     }
-    worker->image_compression = image_compression;
+
+    worker->image_compression = spice_server_get_image_compression(reds);
     worker->jpeg_state = jpeg_state;
     worker->zlib_glz_state = zlib_glz_state;
     worker->driver_cap_monitors_config = 0;
diff --git a/server/reds-private.h b/server/reds-private.h
index 89f5b97..fd2aa10 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -214,6 +214,7 @@ struct RedsState {
     bool spice_uuid_is_set;
     uint8_t spice_uuid[16];
 
+    SpiceImageCompression image_compression;
 };
 
 #endif
diff --git a/server/reds.c b/server/reds.c
index 1f5d658..74dd033 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -148,7 +148,6 @@ static int ticketing_enabled = 1; //Ticketing is enabled by default
 static pthread_mutex_t *lock_cs;
 static long *lock_count;
 uint32_t streaming_video = SPICE_STREAM_VIDEO_FILTER;
-SpiceImageCompression image_compression = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
 spice_wan_compression_t jpeg_state = SPICE_WAN_COMPRESSION_AUTO;
 spice_wan_compression_t zlib_glz_state = SPICE_WAN_COMPRESSION_AUTO;
 int agent_mouse = TRUE;
@@ -2772,12 +2771,12 @@ static inline void on_activating_ticketing(RedsState *reds)
     }
 }
 
-static void set_image_compression(SpiceImageCompression val)
+static void reds_set_image_compression(RedsState *reds, SpiceImageCompression val)
 {
-    if (val == image_compression) {
+    if (val == reds->image_compression) {
         return;
     }
-    image_compression = val;
+    reds->image_compression = val;
     red_dispatcher_on_ic_change();
 }
 
@@ -3422,6 +3421,7 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
 #endif
     reds->spice_uuid_is_set = FALSE;
     memset(reds->spice_uuid, 0, sizeof(reds->spice_uuid));
+    reds->image_compression = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
     return reds;
 }
 
@@ -3664,18 +3664,18 @@ SPICE_GNUC_VISIBLE int spice_server_set_image_compression(SpiceServer *s,
     if (comp == SPICE_IMAGE_COMPRESSION_LZ4) {
         spice_warning("LZ4 compression not supported, falling back to auto GLZ");
         comp = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
-        set_image_compression(comp);
+        reds_set_image_compression(s, comp);
         return -1;
     }
 #endif
-    set_image_compression(comp);
+    reds_set_image_compression(s, comp);
     return 0;
 }
 
 SPICE_GNUC_VISIBLE SpiceImageCompression spice_server_get_image_compression(SpiceServer *s)
 {
     spice_assert(reds == s);
-    return image_compression;
+    return s->image_compression;
 }
 
 SPICE_GNUC_VISIBLE int spice_server_set_jpeg_compression(SpiceServer *s, spice_wan_compression_t comp)
diff --git a/server/reds.h b/server/reds.h
index 3e39cac..27bf90b 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -75,7 +75,6 @@ extern uint32_t num_renderers;
 
 extern struct SpiceCoreInterfaceInternal *core;
 extern uint32_t streaming_video;
-extern SpiceImageCompression image_compression;
 extern spice_wan_compression_t jpeg_state;
 extern spice_wan_compression_t zlib_glz_state;
 


More information about the Spice-commits mailing list