summaryrefslogtreecommitdiff
path: root/server/red_worker.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/red_worker.c')
-rw-r--r--server/red_worker.c534
1 files changed, 17 insertions, 517 deletions
diff --git a/server/red_worker.c b/server/red_worker.c
index 0bb79e6c..7240307f 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -51,7 +51,6 @@
#include <spice/qxl_dev.h>
#include "common/lz.h"
#include "common/marshaller.h"
-#include "common/quic.h"
#include "common/rect.h"
#include "common/region.h"
#include "common/ring.h"
@@ -79,7 +78,6 @@
#define DISPLAY_FREE_LIST_DEFAULT_SIZE 128
-#define ZLIB_DEFAULT_COMPRESSION_LEVEL 3
#define MIN_GLZ_SIZE_FOR_ZLIB 100
#define VALIDATE_SURFACE_RET(worker, surface_id) \
@@ -136,66 +134,6 @@ typedef struct ImageItem {
uint8_t data[0];
} ImageItem;
-typedef struct {
- QuicUsrContext usr;
- EncoderData data;
-} QuicData;
-
-typedef struct {
- LzUsrContext usr;
- EncoderData data;
-} LzData;
-
-typedef struct {
- JpegEncoderUsrContext usr;
- EncoderData data;
-} JpegData;
-
-#ifdef USE_LZ4
-typedef struct {
- Lz4EncoderUsrContext usr;
- EncoderData data;
-} Lz4Data;
-#endif
-
-typedef struct {
- ZlibEncoderUsrContext usr;
- EncoderData data;
-} ZlibData;
-
-/**********************************/
-/* LZ dictionary related entities */
-/**********************************/
-#define MAX_GLZ_DRAWABLE_INSTANCES 2
-
-typedef struct RedGlzDrawable RedGlzDrawable;
-
-/* for each qxl drawable, there may be several instances of lz drawables */
-/* TODO - reuse this stuff for the top level. I just added a second level of multiplicity
- * at the Drawable by keeping a ring, so:
- * Drawable -> (ring of) RedGlzDrawable -> (up to 2) GlzDrawableInstanceItem
- * and it should probably (but need to be sure...) be
- * Drawable -> ring of GlzDrawableInstanceItem.
- */
-typedef struct GlzDrawableInstanceItem {
- RingItem glz_link;
- RingItem free_link;
- GlzEncDictImageContext *glz_instance;
- RedGlzDrawable *red_glz_drawable;
-} GlzDrawableInstanceItem;
-
-struct RedGlzDrawable {
- RingItem link; // ordered by the time it was encoded
- RingItem drawable_link;
- RedDrawable *red_drawable;
- Drawable *drawable;
- uint32_t group_id;
- GlzDrawableInstanceItem instances_pool[MAX_GLZ_DRAWABLE_INSTANCES];
- Ring instances;
- uint8_t instances_count;
- DisplayChannelClient *dcc;
-};
-
pthread_mutex_t glz_dictionary_list_lock = PTHREAD_MUTEX_INITIALIZER;
Ring glz_dictionary_list = {&glz_dictionary_list, &glz_dictionary_list};
@@ -232,23 +170,6 @@ typedef struct RedWorker {
spice_wan_compression_t jpeg_state;
spice_wan_compression_t zlib_glz_state;
- QuicData quic_data;
- QuicContext *quic;
-
- LzData lz_data;
- LzContext *lz;
-
- JpegData jpeg_data;
- JpegEncoderContext *jpeg;
-
-#ifdef USE_LZ4
- Lz4Data lz4_data;
- Lz4EncoderContext *lz4;
-#endif
-
- ZlibData zlib_data;
- ZlibEncoder *zlib;
-
uint32_t process_commands_generation;
#ifdef RED_STATISTICS
StatNodeRef stat;
@@ -2345,32 +2266,6 @@ static void red_push_surface_image(DisplayChannelClient *dcc, int surface_id)
red_channel_client_push(RED_CHANNEL_CLIENT(dcc));
}
-static RedCompressBuf *compress_buf_new(void)
-{
- return g_slice_new(RedCompressBuf);
-}
-
-static void compress_buf_free(RedCompressBuf *buf)
-{
- g_slice_free(RedCompressBuf, buf);
-}
-
-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, (uint8_t*)comp_buf->buf, now,
- (spice_marshaller_item_free_func)compress_buf_free, NULL);
- comp_buf = comp_buf->send_next;
- } while (max);
-}
-
-
static void fill_base(SpiceMarshaller *base_marshaller, Drawable *drawable)
{
SpiceMsgDisplayBase base;
@@ -2460,8 +2355,8 @@ static GlzDrawableInstanceItem *red_display_add_glz_drawable_instance(RedGlzDraw
it is not used by Drawable).
NOTE - 1) can be called only by the display channel that created the drawable
2) it is assumed that the instance was already removed from the dictionary*/
-static void dcc_free_glz_drawable_instance(DisplayChannelClient *dcc,
- GlzDrawableInstanceItem *glz_drawable_instance)
+void dcc_free_glz_drawable_instance(DisplayChannelClient *dcc,
+ GlzDrawableInstanceItem *glz_drawable_instance)
{
DisplayChannel *display_channel = DCC_TO_DC(dcc);
RedWorker *worker = display_channel->common.worker;
@@ -2611,354 +2506,6 @@ static int red_display_free_some_independent_glz_drawables(DisplayChannelClient
return n;
}
-/******************************************************
- * Encoders callbacks
-*******************************************************/
-static SPICE_GNUC_NORETURN SPICE_GNUC_PRINTF(2, 3) void
-quic_usr_error(QuicUsrContext *usr, const char *fmt, ...)
-{
- EncoderData *usr_data = &(((QuicData *)usr)->data);
- va_list ap;
-
- va_start(ap, fmt);
- vsnprintf(usr_data->message_buf, sizeof(usr_data->message_buf), fmt, ap);
- va_end(ap);
- spice_critical("%s", usr_data->message_buf);
-
- longjmp(usr_data->jmp_env, 1);
-}
-
-static SPICE_GNUC_NORETURN SPICE_GNUC_PRINTF(2, 3) void
-lz_usr_error(LzUsrContext *usr, const char *fmt, ...)
-{
- EncoderData *usr_data = &(((LzData *)usr)->data);
- va_list ap;
-
- va_start(ap, fmt);
- vsnprintf(usr_data->message_buf, sizeof(usr_data->message_buf), fmt, ap);
- va_end(ap);
- spice_critical("%s", usr_data->message_buf);
-
- longjmp(usr_data->jmp_env, 1);
-}
-
-static SPICE_GNUC_PRINTF(2, 3) void glz_usr_error(GlzEncoderUsrContext *usr, const char *fmt, ...)
-{
- EncoderData *usr_data = &(((GlzData *)usr)->data);
- va_list ap;
-
- va_start(ap, fmt);
- vsnprintf(usr_data->message_buf, sizeof(usr_data->message_buf), fmt, ap);
- va_end(ap);
-
- spice_critical("%s", usr_data->message_buf); // if global lz fails in the middle
- // the consequences are not predictable since the window
- // can turn to be unsynchronized between the server and
- // and the client
-}
-
-static SPICE_GNUC_PRINTF(2, 3) void quic_usr_warn(QuicUsrContext *usr, const char *fmt, ...)
-{
- EncoderData *usr_data = &(((QuicData *)usr)->data);
- va_list ap;
-
- va_start(ap, fmt);
- vsnprintf(usr_data->message_buf, sizeof(usr_data->message_buf), fmt, ap);
- va_end(ap);
- spice_warning("%s", usr_data->message_buf);
-}
-
-static SPICE_GNUC_PRINTF(2, 3) void lz_usr_warn(LzUsrContext *usr, const char *fmt, ...)
-{
- EncoderData *usr_data = &(((LzData *)usr)->data);
- va_list ap;
-
- va_start(ap, fmt);
- vsnprintf(usr_data->message_buf, sizeof(usr_data->message_buf), fmt, ap);
- va_end(ap);
- spice_warning("%s", usr_data->message_buf);
-}
-
-static SPICE_GNUC_PRINTF(2, 3) void glz_usr_warn(GlzEncoderUsrContext *usr, const char *fmt, ...)
-{
- EncoderData *usr_data = &(((GlzData *)usr)->data);
- va_list ap;
-
- va_start(ap, fmt);
- vsnprintf(usr_data->message_buf, sizeof(usr_data->message_buf), fmt, ap);
- va_end(ap);
- spice_warning("%s", usr_data->message_buf);
-}
-
-static void *quic_usr_malloc(QuicUsrContext *usr, int size)
-{
- return spice_malloc(size);
-}
-
-static void *lz_usr_malloc(LzUsrContext *usr, int size)
-{
- return spice_malloc(size);
-}
-
-static void *glz_usr_malloc(GlzEncoderUsrContext *usr, int size)
-{
- return spice_malloc(size);
-}
-
-static void quic_usr_free(QuicUsrContext *usr, void *ptr)
-{
- free(ptr);
-}
-
-static void lz_usr_free(LzUsrContext *usr, void *ptr)
-{
- free(ptr);
-}
-
-static void glz_usr_free(GlzEncoderUsrContext *usr, void *ptr)
-{
- free(ptr);
-}
-
-static int encoder_usr_more_space(EncoderData *enc_data, uint8_t **io_ptr)
-{
- RedCompressBuf *buf;
-
- buf = compress_buf_new();
- enc_data->bufs_tail->send_next = buf;
- enc_data->bufs_tail = buf;
- buf->send_next = NULL;
- *io_ptr = buf->buf;
- return sizeof(buf->buf);
-}
-
-static int quic_usr_more_space(QuicUsrContext *usr, uint32_t **io_ptr, int rows_completed)
-{
- EncoderData *usr_data = &(((QuicData *)usr)->data);
- return encoder_usr_more_space(usr_data, (uint8_t **)io_ptr) / sizeof(uint32_t);
-}
-
-static int lz_usr_more_space(LzUsrContext *usr, uint8_t **io_ptr)
-{
- EncoderData *usr_data = &(((LzData *)usr)->data);
- return encoder_usr_more_space(usr_data, io_ptr);
-}
-
-static int glz_usr_more_space(GlzEncoderUsrContext *usr, uint8_t **io_ptr)
-{
- EncoderData *usr_data = &(((GlzData *)usr)->data);
- return encoder_usr_more_space(usr_data, io_ptr);
-}
-
-static int jpeg_usr_more_space(JpegEncoderUsrContext *usr, uint8_t **io_ptr)
-{
- EncoderData *usr_data = &(((JpegData *)usr)->data);
- return encoder_usr_more_space(usr_data, io_ptr);
-}
-
-#ifdef USE_LZ4
-static int lz4_usr_more_space(Lz4EncoderUsrContext *usr, uint8_t **io_ptr)
-{
- EncoderData *usr_data = &(((Lz4Data *)usr)->data);
- return encoder_usr_more_space(usr_data, io_ptr);
-}
-#endif
-
-static int zlib_usr_more_space(ZlibEncoderUsrContext *usr, uint8_t **io_ptr)
-{
- EncoderData *usr_data = &(((ZlibData *)usr)->data);
- return encoder_usr_more_space(usr_data, io_ptr);
-}
-
-static inline int encoder_usr_more_lines(EncoderData *enc_data, uint8_t **lines)
-{
- struct SpiceChunk *chunk;
-
- if (enc_data->u.lines_data.reverse) {
- if (!(enc_data->u.lines_data.next >= 0)) {
- return 0;
- }
- } else {
- if (!(enc_data->u.lines_data.next < enc_data->u.lines_data.chunks->num_chunks)) {
- return 0;
- }
- }
-
- chunk = &enc_data->u.lines_data.chunks->chunk[enc_data->u.lines_data.next];
- if (chunk->len % enc_data->u.lines_data.stride) {
- return 0;
- }
-
- if (enc_data->u.lines_data.reverse) {
- enc_data->u.lines_data.next--;
- *lines = chunk->data + chunk->len - enc_data->u.lines_data.stride;
- } else {
- enc_data->u.lines_data.next++;
- *lines = chunk->data;
- }
-
- return chunk->len / enc_data->u.lines_data.stride;
-}
-
-static int quic_usr_more_lines(QuicUsrContext *usr, uint8_t **lines)
-{
- EncoderData *usr_data = &(((QuicData *)usr)->data);
- return encoder_usr_more_lines(usr_data, lines);
-}
-
-static int lz_usr_more_lines(LzUsrContext *usr, uint8_t **lines)
-{
- EncoderData *usr_data = &(((LzData *)usr)->data);
- return encoder_usr_more_lines(usr_data, lines);
-}
-
-static int glz_usr_more_lines(GlzEncoderUsrContext *usr, uint8_t **lines)
-{
- EncoderData *usr_data = &(((GlzData *)usr)->data);
- return encoder_usr_more_lines(usr_data, lines);
-}
-
-static int jpeg_usr_more_lines(JpegEncoderUsrContext *usr, uint8_t **lines)
-{
- EncoderData *usr_data = &(((JpegData *)usr)->data);
- return encoder_usr_more_lines(usr_data, lines);
-}
-
-#ifdef USE_LZ4
-static int lz4_usr_more_lines(Lz4EncoderUsrContext *usr, uint8_t **lines)
-{
- EncoderData *usr_data = &(((Lz4Data *)usr)->data);
- return encoder_usr_more_lines(usr_data, lines);
-}
-#endif
-
-static int zlib_usr_more_input(ZlibEncoderUsrContext *usr, uint8_t** input)
-{
- EncoderData *usr_data = &(((ZlibData *)usr)->data);
- int buf_size;
-
- if (!usr_data->u.compressed_data.next) {
- spice_assert(usr_data->u.compressed_data.size_left == 0);
- return 0;
- }
-
- *input = (uint8_t*)usr_data->u.compressed_data.next->buf;
- buf_size = MIN(sizeof(usr_data->u.compressed_data.next->buf),
- usr_data->u.compressed_data.size_left);
-
- usr_data->u.compressed_data.next = usr_data->u.compressed_data.next->send_next;
- usr_data->u.compressed_data.size_left -= buf_size;
- return buf_size;
-}
-
-static void glz_usr_free_image(GlzEncoderUsrContext *usr, GlzUsrImageContext *image)
-{
- GlzData *lz_data = (GlzData *)usr;
- GlzDrawableInstanceItem *glz_drawable_instance = (GlzDrawableInstanceItem *)image;
- DisplayChannelClient *drawable_cc = glz_drawable_instance->red_glz_drawable->dcc;
- DisplayChannelClient *this_cc = SPICE_CONTAINEROF(lz_data, DisplayChannelClient, glz_data);
- if (this_cc == drawable_cc) {
- red_display_free_glz_drawable_instance(drawable_cc, glz_drawable_instance);
- } else {
- /* The glz dictionary is shared between all DisplayChannelClient
- * instances that belong to the same client, and glz_usr_free_image
- * can be called by the dictionary code
- * (glz_dictionary_window_remove_head). Thus this function can be
- * called from any DisplayChannelClient thread, hence the need for
- * this check.
- */
- pthread_mutex_lock(&drawable_cc->glz_drawables_inst_to_free_lock);
- ring_add_before(&glz_drawable_instance->free_link,
- &drawable_cc->glz_drawables_inst_to_free);
- pthread_mutex_unlock(&drawable_cc->glz_drawables_inst_to_free_lock);
- }
-}
-
-static inline void red_init_quic(RedWorker *worker)
-{
- worker->quic_data.usr.error = quic_usr_error;
- worker->quic_data.usr.warn = quic_usr_warn;
- worker->quic_data.usr.info = quic_usr_warn;
- worker->quic_data.usr.malloc = quic_usr_malloc;
- worker->quic_data.usr.free = quic_usr_free;
- worker->quic_data.usr.more_space = quic_usr_more_space;
- worker->quic_data.usr.more_lines = quic_usr_more_lines;
-
- worker->quic = quic_create(&worker->quic_data.usr);
-
- if (!worker->quic) {
- spice_critical("create quic failed");
- }
-}
-
-static inline void red_init_lz(RedWorker *worker)
-{
- worker->lz_data.usr.error = lz_usr_error;
- worker->lz_data.usr.warn = lz_usr_warn;
- worker->lz_data.usr.info = lz_usr_warn;
- worker->lz_data.usr.malloc = lz_usr_malloc;
- worker->lz_data.usr.free = lz_usr_free;
- worker->lz_data.usr.more_space = lz_usr_more_space;
- worker->lz_data.usr.more_lines = lz_usr_more_lines;
-
- worker->lz = lz_create(&worker->lz_data.usr);
-
- if (!worker->lz) {
- spice_critical("create lz failed");
- }
-}
-
-/* TODO: split off to DisplayChannel? avoid just copying those cb pointers */
-static inline void red_display_init_glz_data(DisplayChannelClient *dcc)
-{
- dcc->glz_data.usr.error = glz_usr_error;
- dcc->glz_data.usr.warn = glz_usr_warn;
- dcc->glz_data.usr.info = glz_usr_warn;
- dcc->glz_data.usr.malloc = glz_usr_malloc;
- dcc->glz_data.usr.free = glz_usr_free;
- dcc->glz_data.usr.more_space = glz_usr_more_space;
- dcc->glz_data.usr.more_lines = glz_usr_more_lines;
- dcc->glz_data.usr.free_image = glz_usr_free_image;
-}
-
-static inline void red_init_jpeg(RedWorker *worker)
-{
- worker->jpeg_data.usr.more_space = jpeg_usr_more_space;
- worker->jpeg_data.usr.more_lines = jpeg_usr_more_lines;
-
- worker->jpeg = jpeg_encoder_create(&worker->jpeg_data.usr);
-
- if (!worker->jpeg) {
- spice_critical("create jpeg encoder failed");
- }
-}
-
-#ifdef USE_LZ4
-static inline void red_init_lz4(RedWorker *worker)
-{
- worker->lz4_data.usr.more_space = lz4_usr_more_space;
- worker->lz4_data.usr.more_lines = lz4_usr_more_lines;
-
- worker->lz4 = lz4_encoder_create(&worker->lz4_data.usr);
-
- if (!worker->lz4) {
- spice_critical("create lz4 encoder failed");
- }
-}
-#endif
-
-static inline void red_init_zlib(RedWorker *worker)
-{
- worker->zlib_data.usr.more_space = zlib_usr_more_space;
- worker->zlib_data.usr.more_input = zlib_usr_more_input;
-
- worker->zlib = zlib_encoder_create(&worker->zlib_data.usr, ZLIB_DEFAULT_COMPRESSION_LEVEL);
-
- if (!worker->zlib) {
- spice_critical("create zlib encoder failed");
- }
-}
-
typedef struct compress_send_data_t {
void* comp_buf;
uint32_t comp_buf_size;
@@ -2971,7 +2518,6 @@ static inline int red_glz_compress_image(DisplayChannelClient *dcc,
compress_send_data_t* o_comp_data)
{
DisplayChannel *display_channel = DCC_TO_DC(dcc);
- RedWorker *worker = display_channel->common.worker;
#ifdef COMPRESS_STAT
stat_time_t start_time = stat_now(display_channel->zlib_glz_stat.clock);
#endif
@@ -2986,12 +2532,6 @@ static inline int red_glz_compress_image(DisplayChannelClient *dcc,
glz_data->data.bufs_tail = compress_buf_new();
glz_data->data.bufs_head = glz_data->data.bufs_tail;
-
- if (!glz_data->data.bufs_head) {
- return FALSE;
- }
-
- glz_data->data.bufs_head->send_next = NULL;
glz_data->data.dcc = dcc;
glz_drawable = red_display_get_glz_drawable(dcc, drawable);
@@ -3018,24 +2558,17 @@ static inline int red_glz_compress_image(DisplayChannelClient *dcc,
#ifdef COMPRESS_STAT
start_time = stat_now(display_channel->zlib_glz_stat.clock);
#endif
- zlib_data = &worker->zlib_data;
+ zlib_data = &dcc->zlib_data;
zlib_data->data.bufs_tail = compress_buf_new();
zlib_data->data.bufs_head = zlib_data->data.bufs_tail;
-
- if (!zlib_data->data.bufs_head) {
- spice_warning("failed to allocate zlib compress buffer");
- goto glz;
- }
-
- zlib_data->data.bufs_head->send_next = NULL;
zlib_data->data.dcc = dcc;
zlib_data->data.u.compressed_data.next = glz_data->data.bufs_head;
zlib_data->data.u.compressed_data.size_left = glz_size;
- zlib_size = zlib_encode(worker->zlib, display_channel->zlib_level,
- glz_size, zlib_data->data.bufs_head->buf,
+ zlib_size = zlib_encode(dcc->zlib, dcc->zlib_level,
+ glz_size, (uint8_t*)zlib_data->data.bufs_head->buf,
sizeof(zlib_data->data.bufs_head->buf));
// the compressed buffer is bigger than the original data
@@ -3071,10 +2604,8 @@ static inline int red_lz_compress_image(DisplayChannelClient *dcc,
SpiceImage *dest, SpiceBitmap *src,
compress_send_data_t* o_comp_data, uint32_t group_id)
{
- DisplayChannel *display_channel = DCC_TO_DC(dcc);
- RedWorker *worker = display_channel->common.worker;
- LzData *lz_data = &worker->lz_data;
- LzContext *lz = worker->lz;
+ LzData *lz_data = &dcc->lz_data;
+ LzContext *lz = dcc->lz;
LzImageType type = MAP_BITMAP_FMT_TO_LZ_IMAGE_TYPE[src->format];
int size; // size of the compressed data
@@ -3084,12 +2615,6 @@ static inline int red_lz_compress_image(DisplayChannelClient *dcc,
lz_data->data.bufs_tail = compress_buf_new();
lz_data->data.bufs_head = lz_data->data.bufs_tail;
-
- if (!lz_data->data.bufs_head) {
- return FALSE;
- }
-
- lz_data->data.bufs_head->send_next = NULL;
lz_data->data.dcc = dcc;
if (setjmp(lz_data->data.jmp_env)) {
@@ -3149,12 +2674,10 @@ static int red_jpeg_compress_image(DisplayChannelClient *dcc, SpiceImage *dest,
SpiceBitmap *src, compress_send_data_t* o_comp_data,
uint32_t group_id)
{
- DisplayChannel *display_channel = DCC_TO_DC(dcc);
- RedWorker *worker = display_channel->common.worker;
- JpegData *jpeg_data = &worker->jpeg_data;
- LzData *lz_data = &worker->lz_data;
- JpegEncoderContext *jpeg = worker->jpeg;
- LzContext *lz = worker->lz;
+ JpegData *jpeg_data = &dcc->jpeg_data;
+ LzData *lz_data = &dcc->lz_data;
+ JpegEncoderContext *jpeg = dcc->jpeg;
+ LzContext *lz = dcc->lz;
volatile JpegEncoderImageType jpeg_in_type;
int jpeg_size = 0;
volatile int has_alpha = FALSE;
@@ -3187,13 +2710,6 @@ static int red_jpeg_compress_image(DisplayChannelClient *dcc, SpiceImage *dest,
jpeg_data->data.bufs_tail = compress_buf_new();
jpeg_data->data.bufs_head = jpeg_data->data.bufs_tail;
-
- if (!jpeg_data->data.bufs_head) {
- spice_warning("failed to allocate compress buffer");
- return FALSE;
- }
-
- jpeg_data->data.bufs_head->send_next = NULL;
jpeg_data->data.dcc = dcc;
if (setjmp(jpeg_data->data.jmp_env)) {
@@ -3292,14 +2808,12 @@ static int red_lz4_compress_image(DisplayChannelClient *dcc, SpiceImage *dest,
SpiceBitmap *src, compress_send_data_t* o_comp_data,
uint32_t group_id)
{
- DisplayChannel *display_channel = DCC_TO_DC(dcc);
- RedWorker *worker = display_channel->common.worker;
- Lz4Data *lz4_data = &worker->lz4_data;
- Lz4EncoderContext *lz4 = worker->lz4;
+ Lz4Data *lz4_data = &dcc->lz4_data;
+ Lz4EncoderContext *lz4 = dcc->lz4;
int lz4_size = 0;
#ifdef COMPRESS_STAT
- stat_time_t start_time = stat_now(worker->clockid);
+ stat_time_t start_time = stat_now(DCC_TO_DC(dcc)->lz4_stat.clock);
#endif
lz4_data->data.bufs_tail = compress_buf_new();
@@ -3347,7 +2861,7 @@ static int red_lz4_compress_image(DisplayChannelClient *dcc, SpiceImage *dest,
o_comp_data->comp_buf = lz4_data->data.bufs_head;
o_comp_data->comp_buf_size = lz4_size;
- stat_compress_add(&display_channel->lz4_stat, start_time, src->stride * src->y,
+ stat_compress_add(&DCC_TO_DC(dcc)->lz4_stat, start_time, src->stride * src->y,
o_comp_data->comp_buf_size);
return TRUE;
}
@@ -3357,10 +2871,8 @@ static inline int red_quic_compress_image(DisplayChannelClient *dcc, SpiceImage
SpiceBitmap *src, compress_send_data_t* o_comp_data,
uint32_t group_id)
{
- DisplayChannel *display_channel = DCC_TO_DC(dcc);
- RedWorker *worker = display_channel->common.worker;
- QuicData *quic_data = &worker->quic_data;
- QuicContext *quic = worker->quic;
+ QuicData *quic_data = &dcc->quic_data;
+ QuicContext *quic = dcc->quic;
volatile QuicImageType type;
int size, stride;
@@ -3387,7 +2899,6 @@ static inline int red_quic_compress_image(DisplayChannelClient *dcc, SpiceImage
quic_data->data.bufs_tail = compress_buf_new();
quic_data->data.bufs_head = quic_data->data.bufs_tail;
- quic_data->data.bufs_head->send_next = NULL;
quic_data->data.dcc = dcc;
if (setjmp(quic_data->data.jmp_env)) {
@@ -7386,8 +6897,6 @@ static void handle_new_display_channel(RedWorker *worker, RedClient *client, Red
stream_buf_size = 32*1024;
dcc->send_data.stream_outbuf = spice_malloc(stream_buf_size);
dcc->send_data.stream_outbuf_size = stream_buf_size;
- red_display_init_glz_data(dcc);
-
dcc->send_data.free_list.res =
spice_malloc(sizeof(SpiceResourceList) +
DISPLAY_FREE_LIST_DEFAULT_SIZE * sizeof(SpiceResourceID));
@@ -7411,8 +6920,6 @@ static void handle_new_display_channel(RedWorker *worker, RedClient *client, Red
guest_set_client_capabilities(worker);
- // todo: tune level according to bandwidth
- display_channel->zlib_level = ZLIB_DEFAULT_COMPRESSION_LEVEL;
dcc_init_stream_agents(dcc);
on_new_display_channel_client(dcc);
}
@@ -8435,13 +7942,6 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher)
spice_warn_if(init_info.n_surfaces > NUM_SURFACES);
- red_init_quic(worker);
- red_init_lz(worker);
- red_init_jpeg(worker);
-#ifdef USE_LZ4
- red_init_lz4(worker);
-#endif
- red_init_zlib(worker);
worker->event_timeout = INF_EVENT_WAIT;
worker->cursor_channel = cursor_channel_new(worker);