[PATCH v2 20/30] Encapsulate code to save glz state

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

 



Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/dcc-encoders.c | 10 ++++++++++
 server/dcc-encoders.h |  2 ++
 server/dcc-send.c     |  8 ++------
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
index 5fdda6f..2f539d5 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -636,6 +636,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 a1ee510..dd747fe 100644
--- a/server/dcc-encoders.h
+++ b/server/dcc-encoders.h
@@ -46,6 +46,8 @@ void image_encoders_freeze_glz(ImageEncoders *enc);
 void image_encoders_release_glz(ImageEncoders *enc);
 void image_encoders_glz_free_from_drawable(struct Drawable *drawable);
 void image_encoders_glz_detach_from_drawable(struct Drawable *drawable);
+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 c0c7573..ba695ef 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -1859,12 +1859,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,
-- 
2.7.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://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]