[Spice-commits] server/dcc-encoders.c server/dcc-encoders.h server/dcc-send.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Wed Jun 15 07:44:44 UTC 2016


 server/dcc-encoders.c |   10 ++++++++++
 server/dcc-encoders.h |    2 ++
 server/dcc-send.c     |    8 ++------
 3 files changed, 14 insertions(+), 6 deletions(-)

New commits:
commit b61c1ce030a868e858f1c65c6318f6d14e60d117
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Mon Jun 6 09:11:32 2016 +0100

    Encapsulate code to save glz state
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
index e4e426d..1deb7e7 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -585,6 +585,16 @@ void image_encoders_freeze_glz(ImageEncoders *enc)
     pthread_rwlock_unlock(&enc->glz_dict->encode_lock);
 }
 
+void image_encoders_glz_get_restore_data(ImageEncoders *enc,
+                                         uint8_t *out_id, GlzEncDictRestoreData *out_data)
+{
+    spice_assert(enc->glz_dict);
+    image_encoders_freeze_glz(enc);
+    *out_id = enc->glz_dict->id;
+    glz_enc_dictionary_get_restore_data(enc->glz_dict->dict, out_data,
+                                        &enc->glz_data.usr);
+}
+
 static GlzSharedDictionary *glz_shared_dictionary_new(RedClient *client, uint8_t id,
                                                       GlzEncDictContext *dict)
 {
diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h
index b761f33..26f1afd 100644
--- a/server/dcc-encoders.h
+++ b/server/dcc-encoders.h
@@ -49,6 +49,8 @@ void image_encoders_free_glz_drawables(ImageEncoders *enc);
 void image_encoders_free_glz_drawables_to_free(ImageEncoders* enc);
 gboolean image_encoders_glz_create(ImageEncoders *enc, uint8_t id);
 void image_encoders_freeze_glz(ImageEncoders *enc);
+void image_encoders_glz_get_restore_data(ImageEncoders *enc,
+                                         uint8_t *out_id, GlzEncDictRestoreData *out_data);
 
 #define RED_COMPRESS_BUF_SIZE (1024 * 64)
 struct RedCompressBuf {
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 9ed3a20..f5a409d 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -1853,12 +1853,8 @@ static void display_channel_marshall_migrate_data(RedChannelClient *rcc,
     memcpy(display_data.pixmap_cache_clients, dcc->pixmap_cache->sync,
            sizeof(display_data.pixmap_cache_clients));
 
-    spice_assert(dcc->encoders.glz_dict);
-    image_encoders_freeze_glz(&dcc->encoders);
-    display_data.glz_dict_id = dcc->encoders.glz_dict->id;
-    glz_enc_dictionary_get_restore_data(dcc->encoders.glz_dict->dict,
-                                        &display_data.glz_dict_data,
-                                        &dcc->encoders.glz_data.usr);
+    image_encoders_glz_get_restore_data(&dcc->encoders, &display_data.glz_dict_id,
+                                        &display_data.glz_dict_data);
 
     /* all data besided the surfaces ref */
     spice_marshaller_add(base_marshaller,


More information about the Spice-commits mailing list