mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-28 08:01:26 +00:00
Move marshalling code from dcc-encoders to dcc-send
No reasons why dcc-encoders should know about marshalling. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
This commit is contained in:
parent
fa4eb13f7b
commit
2d34002e59
@ -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).
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user