[Spice-devel] [PATCH v4 08/19] Encapsulate code to save glz state

Jonathon Jongsma jjongsma at redhat.com
Tue Jun 14 20:34:57 UTC 2016


Acked-by: Jonathon Jongsma <jjongsma at redhat.com>


On Tue, 2016-06-14 at 10:33 +0100, Frediano Ziglio wrote:
> 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 13dbff5..2e5984a 100644
> --- a/server/dcc-encoders.c
> +++ b/server/dcc-encoders.c
> @@ -640,6 +640,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 68fd5a5..ce8010c 100644
> --- a/server/dcc-encoders.h
> +++ b/server/dcc-encoders.h
> @@ -51,6 +51,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,


More information about the Spice-devel mailing list