[Spice-devel] [PATCH 2/2] Move marshalling code from dcc-encoders to dcc-send

Christophe Fergeau cfergeau at redhat.com
Wed Jun 8 16:13:41 UTC 2016


Acked-by: Christophe Fergeau <cfergeau at redhat.com>

On Fri, Jun 03, 2016 at 04:40:23PM +0100, Frediano Ziglio wrote:
> No reasons why dcc-encoders should know about marshalling.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/dcc-encoders.c | 20 --------------------
>  server/dcc-encoders.h |  5 -----
>  server/dcc-send.c     | 20 ++++++++++++++++++++
>  3 files changed, 20 insertions(+), 25 deletions(-)
> 
> diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
> index 5570798..a657887 100644
> --- a/server/dcc-encoders.c
> +++ b/server/dcc-encoders.c
> @@ -429,26 +429,6 @@ void dcc_encoders_free(DisplayChannelClient *dcc)
>      dcc->zlib = NULL;
>  }
>  
> -static void marshaller_compress_buf_free(uint8_t *data, void *opaque)
> -{
> -    g_free(opaque);
> -}
> -
> -void marshaller_add_compressed(SpiceMarshaller *m,
> -                               RedCompressBuf *comp_buf, size_t size)
> -{
> -    size_t max = size;
> -    size_t now;
> -    do {
> -        spice_return_if_fail(comp_buf);
> -        now = MIN(sizeof(comp_buf->buf), max);
> -        max -= now;
> -        spice_marshaller_add_ref_full(m, comp_buf->buf.bytes, now,
> -                                      marshaller_compress_buf_free, comp_buf);
> -        comp_buf = comp_buf->send_next;
> -    } while (max);
> -}
> -
>  /* Remove from the to_free list and the instances_list.
>     When no instance is left - the RedGlzDrawable is released too. (and the qxl drawable too, if
>     it is not used by Drawable).
> diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h
> index 88351dc..8c3f22f 100644
> --- a/server/dcc-encoders.h
> +++ b/server/dcc-encoders.h
> @@ -19,7 +19,6 @@
>  #define DCC_ENCODERS_H_
>  
>  #include <setjmp.h>
> -#include <common/marshaller.h>
>  #include <common/quic.h>
>  
>  #include "red-channel.h"
> @@ -46,10 +45,6 @@ void             dcc_free_glz_drawables_to_free              (DisplayChannelClie
>  void             dcc_freeze_glz                              (DisplayChannelClient *dcc);
>  void             dcc_release_glz                             (DisplayChannelClient *dcc);
>  
> -void             marshaller_add_compressed                   (SpiceMarshaller *m,
> -                                                              RedCompressBuf *comp_buf,
> -                                                              size_t size);
> -
>  #define RED_COMPRESS_BUF_SIZE (1024 * 64)
>  struct RedCompressBuf {
>      /* This buffer provide space for compression algorithms.
> diff --git a/server/dcc-send.c b/server/dcc-send.c
> index 5171f9a..6c10565 100644
> --- a/server/dcc-send.c
> +++ b/server/dcc-send.c
> @@ -335,6 +335,26 @@ static void fill_base(SpiceMarshaller *base_marshaller, Drawable *drawable)
>      spice_marshall_DisplayBase(base_marshaller, &base);
>  }
>  
> +static void marshaller_compress_buf_free(uint8_t *data, void *opaque)
> +{
> +    compress_buf_free(opaque);
> +}
> +
> +static void marshaller_add_compressed(SpiceMarshaller *m,
> +                                      RedCompressBuf *comp_buf, size_t size)
> +{
> +    size_t max = size;
> +    size_t now;
> +    do {
> +        spice_return_if_fail(comp_buf);
> +        now = MIN(sizeof(comp_buf->buf), max);
> +        max -= now;
> +        spice_marshaller_add_ref_full(m, comp_buf->buf.bytes, now,
> +                                      marshaller_compress_buf_free, comp_buf);
> +        comp_buf = comp_buf->send_next;
> +    } while (max);
> +}
> +
>  /* if the number of times fill_bits can be called per one qxl_drawable increases -
>     MAX_LZ_DRAWABLE_INSTANCES must be increased as well */
>  static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
> -- 
> 2.7.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160608/2c4cfdec/attachment.sig>


More information about the Spice-devel mailing list