[Spice-devel] [PATCH 20/30] Encapsulate code to save glz state
Frediano Ziglio
fziglio at redhat.com
Tue Jun 7 10:17:58 UTC 2016
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
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 f583857..b403024 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -635,6 +635,16 @@ void dcc_freeze_glz(EncodersData *enc)
pthread_rwlock_unlock(&enc->glz_dict->encode_lock);
}
+void dcc_glz_get_restore_data(EncodersData *enc,
+ uint8_t *out_id, GlzEncDictRestoreData *out_data)
+{
+ spice_assert(enc->glz_dict);
+ dcc_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 26d8d27..adc6272 100644
--- a/server/dcc-encoders.h
+++ b/server/dcc-encoders.h
@@ -46,6 +46,8 @@ void dcc_freeze_glz(EncodersData *enc);
void dcc_release_glz(EncodersData *enc);
void dcc_glz_free_from_drawable(struct Drawable *drawable);
void dcc_glz_detach_from_drawable(struct Drawable *drawable);
+void dcc_glz_get_restore_data(EncodersData *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 54623e7..e5fa0f0 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);
- dcc_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);
+ dcc_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
More information about the Spice-devel
mailing list