diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-09-17 01:15:38 +0200 |
---|---|---|
committer | Pavel Grunt <pgrunt@redhat.com> | 2015-11-13 17:21:35 +0100 |
commit | 8cd91cf921b6f75aae9fb8985f28e2facf9abb18 (patch) | |
tree | 15ffc1f9bd2aabf61f2a22e447b031ef2d9512e4 | |
parent | 276b299e17e0dd0985113926e8a48155a6c783ae (diff) |
worker: move encoders to dcc-encoders
-rw-r--r-- | server/Makefile.am | 2 | ||||
-rw-r--r-- | server/dcc-encoders.c | 406 | ||||
-rw-r--r-- | server/dcc-encoders.h | 145 | ||||
-rw-r--r-- | server/display-channel.c | 2 | ||||
-rw-r--r-- | server/display-channel.h | 64 | ||||
-rw-r--r-- | server/red_worker.c | 534 |
6 files changed, 587 insertions, 566 deletions
diff --git a/server/Makefile.am b/server/Makefile.am index 52703c98..5907dd2f 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -138,6 +138,8 @@ libspice_server_la_SOURCES = \ utils.h \ stream.c \ stream.h \ + dcc-encoders.c \ + dcc-encoders.h \ $(NULL) if HAVE_GL diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c new file mode 100644 index 00000000..b4fcc0a4 --- /dev/null +++ b/server/dcc-encoders.c @@ -0,0 +1,406 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009-2015 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <glib.h> +#include <setjmp.h> + +#include "dcc-encoders.h" +#include "display-channel.h" + +#define ZLIB_DEFAULT_COMPRESSION_LEVEL 3 + +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); +} + +RedCompressBuf* compress_buf_new(void) +{ + RedCompressBuf *buf = g_slice_new(RedCompressBuf); + + buf->send_next = NULL; + + return buf; +} + +void compress_buf_free(RedCompressBuf *buf) +{ + g_slice_free(RedCompressBuf, buf); +} + +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 dcc_init_quic(DisplayChannelClient *dcc) +{ + dcc->quic_data.usr.error = quic_usr_error; + dcc->quic_data.usr.warn = quic_usr_warn; + dcc->quic_data.usr.info = quic_usr_warn; + dcc->quic_data.usr.malloc = quic_usr_malloc; + dcc->quic_data.usr.free = quic_usr_free; + dcc->quic_data.usr.more_space = quic_usr_more_space; + dcc->quic_data.usr.more_lines = quic_usr_more_lines; + + dcc->quic = quic_create(&dcc->quic_data.usr); + spice_warn_if_fail(dcc->quic); +} + +static void dcc_init_lz(DisplayChannelClient *dcc) +{ + dcc->lz_data.usr.error = lz_usr_error; + dcc->lz_data.usr.warn = lz_usr_warn; + dcc->lz_data.usr.info = lz_usr_warn; + dcc->lz_data.usr.malloc = lz_usr_malloc; + dcc->lz_data.usr.free = lz_usr_free; + dcc->lz_data.usr.more_space = lz_usr_more_space; + dcc->lz_data.usr.more_lines = lz_usr_more_lines; + + dcc->lz = lz_create(&dcc->lz_data.usr); + spice_warn_if_fail(dcc->lz); +} + +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) { + dcc_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 void dcc_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 void dcc_init_jpeg(DisplayChannelClient *dcc) +{ + dcc->jpeg_data.usr.more_space = jpeg_usr_more_space; + dcc->jpeg_data.usr.more_lines = jpeg_usr_more_lines; + + dcc->jpeg = jpeg_encoder_create(&dcc->jpeg_data.usr); + spice_warn_if_fail(dcc->jpeg); +} + +#ifdef USE_LZ4 +static inline void dcc_init_lz4(DisplayChannelClient *dcc) +{ + dcc->lz4_data.usr.more_space = lz4_usr_more_space; + dcc->lz4_data.usr.more_lines = lz4_usr_more_lines; + + dcc->lz4 = lz4_encoder_create(&dcc->lz4_data.usr); + + spice_warn_if_fail(dcc->lz4); +} +#endif + +static void dcc_init_zlib(DisplayChannelClient *dcc) +{ + dcc->zlib_data.usr.more_space = zlib_usr_more_space; + dcc->zlib_data.usr.more_input = zlib_usr_more_input; + + dcc->zlib = zlib_encoder_create(&dcc->zlib_data.usr, ZLIB_DEFAULT_COMPRESSION_LEVEL); + spice_warn_if_fail(dcc->zlib); +} + +void dcc_encoders_init(DisplayChannelClient *dcc) +{ + dcc_init_glz_data(dcc); + dcc_init_quic(dcc); + dcc_init_lz(dcc); + dcc_init_jpeg(dcc); +#ifdef USE_LZ4 + dcc_init_lz4(dcc); +#endif + dcc_init_zlib(dcc); + + // todo: tune level according to bandwidth + dcc->zlib_level = ZLIB_DEFAULT_COMPRESSION_LEVEL; +} + +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); +} diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h new file mode 100644 index 00000000..dfdda2e3 --- /dev/null +++ b/server/dcc-encoders.h @@ -0,0 +1,145 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009-2015 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef DCC_ENCODERS_H_ +#define DCC_ENCODERS_H_ + +#include "common/marshaller.h" +#include "common/quic.h" +#include "red_channel.h" +#include "red_parse_qxl.h" +#include "spice_image_cache.h" +#include "glz_encoder_dictionary.h" +#include "glz_encoder.h" +#include "jpeg_encoder.h" +#ifdef USE_LZ4 +#include "lz4_encoder.h" +#endif +#include "zlib_encoder.h" + +typedef struct RedCompressBuf RedCompressBuf; +typedef struct GlzDrawableInstanceItem GlzDrawableInstanceItem; + +void dcc_encoders_init (DisplayChannelClient *dcc); +void dcc_free_glz_drawable_instance (DisplayChannelClient *dcc, + GlzDrawableInstanceItem *item); +void marshaller_add_compressed (SpiceMarshaller *m, + RedCompressBuf *comp_buf, + size_t size); + +RedCompressBuf* compress_buf_new (void); +void compress_buf_free (RedCompressBuf *buf); + +struct RedCompressBuf { + uint8_t buf[64 * 1024]; + RedCompressBuf *send_next; +}; + +typedef struct GlzSharedDictionary { + RingItem base; + GlzEncDictContext *dict; + uint32_t refs; + uint8_t id; + pthread_rwlock_t encode_lock; + int migrate_freeze; + RedClient *client; // channel clients of the same client share the dict +} GlzSharedDictionary; + +typedef struct { + DisplayChannelClient *dcc; + RedCompressBuf *bufs_head; + RedCompressBuf *bufs_tail; + jmp_buf jmp_env; + union { + struct { + SpiceChunks *chunks; + int next; + int stride; + int reverse; + } lines_data; + struct { + RedCompressBuf* next; + int size_left; + } compressed_data; // for encoding data that was already compressed by another method + } u; + char message_buf[512]; +} EncoderData; + +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; + +typedef struct { + GlzEncoderUsrContext usr; + EncoderData data; +} GlzData; + +#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. + */ +struct GlzDrawableInstanceItem { + RingItem glz_link; + RingItem free_link; + GlzEncDictImageContext *glz_instance; + RedGlzDrawable *red_glz_drawable; +}; + +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; +}; + + +#endif /* DCC_ENCODERS_H_ */ diff --git a/server/display-channel.c b/server/display-channel.c index 6ccb5531..86e170cd 100644 --- a/server/display-channel.c +++ b/server/display-channel.c @@ -162,6 +162,8 @@ DisplayChannelClient *dcc_new(DisplayChannel *display, // todo: tune quality according to bandwidth dcc->jpeg_quality = 85; + dcc_encoders_init(dcc); + return dcc; } diff --git a/server/display-channel.h b/server/display-channel.h index f7086063..874c2521 100644 --- a/server/display-channel.h +++ b/server/display-channel.h @@ -30,20 +30,13 @@ #include "reds_gl_canvas.h" #endif /* USE_OPENGL */ #include "reds_sw_canvas.h" -#include "glz_encoder_dictionary.h" -#include "glz_encoder.h" #include "stat.h" #include "reds.h" #include "mjpeg_encoder.h" #include "red_memslots.h" #include "red_parse_qxl.h" #include "red_record_qxl.h" -#include "jpeg_encoder.h" -#ifdef USE_LZ4 -#include "lz4_encoder.h" -#endif #include "demarshallers.h" -#include "zlib_encoder.h" #include "red_channel.h" #include "red_dispatcher.h" #include "dispatcher.h" @@ -56,6 +49,7 @@ #include "utils.h" #include "tree.h" #include "stream.h" +#include "dcc-encoders.h" #define PALETTE_CACHE_HASH_SHIFT 8 #define PALETTE_CACHE_HASH_SIZE (1 << PALETTE_CACHE_HASH_SHIFT) @@ -70,12 +64,6 @@ #define NUM_STREAMS 50 #define NUM_SURFACES 10000 -typedef struct RedCompressBuf RedCompressBuf; -struct RedCompressBuf { - uint8_t buf[64 * 1024]; - RedCompressBuf *send_next; -}; - typedef struct WaitForChannels { SpiceMsgWaitForChannels header; SpiceWaitForChannel buf[MAX_CACHE_CLIENTS]; @@ -88,41 +76,6 @@ typedef struct FreeList { WaitForChannels wait; } FreeList; -typedef struct GlzSharedDictionary { - RingItem base; - GlzEncDictContext *dict; - uint32_t refs; - uint8_t id; - pthread_rwlock_t encode_lock; - int migrate_freeze; - RedClient *client; // channel clients of the same client share the dict -} GlzSharedDictionary; - -typedef struct { - DisplayChannelClient *dcc; - RedCompressBuf *bufs_head; - RedCompressBuf *bufs_tail; - jmp_buf jmp_env; - union { - struct { - SpiceChunks *chunks; - int next; - int stride; - int reverse; - } lines_data; - struct { - RedCompressBuf* next; - int size_left; - } compressed_data; // for encoding data that was already compressed by another method - } u; - char message_buf[512]; -} EncoderData; - -typedef struct { - GlzEncoderUsrContext usr; - EncoderData data; -} GlzData; - typedef struct DependItem { Drawable *drawable; RingItem ring_item; @@ -168,6 +121,20 @@ struct DisplayChannelClient { spice_wan_compression_t jpeg_state; spice_wan_compression_t zlib_glz_state; int jpeg_quality; + int zlib_level; + + 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; int expect_init; @@ -327,7 +294,6 @@ struct DisplayChannel { uint32_t renderer; int enable_jpeg; int enable_zlib_glz_wrap; - int zlib_level; Ring current_list; // of TreeItem uint32_t current_size; 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); |