On Tue, 2016-06-07 at 11:17 +0100, Frediano Ziglio wrote: > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > --- > server/dcc-encoders.c | 16 ++++++++-------- > server/dcc-encoders.h | 5 +++++ > server/dcc.c | 16 +++++++++------- > server/dcc.h | 4 ---- > 4 files changed, 22 insertions(+), 19 deletions(-) > > diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c > index 01eb9b8..dadcb07 100644 > --- a/server/dcc-encoders.c > +++ b/server/dcc-encoders.c > @@ -373,14 +373,14 @@ static void dcc_init_jpeg(EncodersData *enc) > } > > #ifdef USE_LZ4 > -static inline void dcc_init_lz4(DisplayChannelClient *dcc) > +static inline void dcc_init_lz4(EncodersData *enc) encoders_data_ > { > - dcc->lz4_data.usr.more_space = lz4_usr_more_space; > - dcc->lz4_data.usr.more_lines = lz4_usr_more_lines; > + enc->lz4_data.usr.more_space = lz4_usr_more_space; > + enc->lz4_data.usr.more_lines = lz4_usr_more_lines; > > - dcc->lz4 = lz4_encoder_create(&dcc->lz4_data.usr); > + enc->lz4 = lz4_encoder_create(&enc->lz4_data.usr); > > - if (!dcc->lz4) { > + if (!enc->lz4) { > spice_critical("create lz4 encoder failed"); > } > } > @@ -407,7 +407,7 @@ void dcc_encoders_init(DisplayChannelClient *dcc) > dcc_init_lz(enc); > dcc_init_jpeg(enc); > #ifdef USE_LZ4 > - dcc_init_lz4(dcc); > + dcc_init_lz4(enc); > #endif > dcc_init_zlib(dcc); > > @@ -425,8 +425,8 @@ void dcc_encoders_free(DisplayChannelClient *dcc) > jpeg_encoder_destroy(enc->jpeg); > enc->jpeg = NULL; > #ifdef USE_LZ4 > - lz4_encoder_destroy(dcc->lz4); > - dcc->lz4 = NULL; > + lz4_encoder_destroy(enc->lz4); > + enc->lz4 = NULL; > #endif > zlib_encoder_destroy(dcc->zlib); > dcc->zlib = NULL; > diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h > index e906d9b..eb34785 100644 > --- a/server/dcc-encoders.h > +++ b/server/dcc-encoders.h > @@ -173,6 +173,11 @@ struct EncodersData { > > JpegData jpeg_data; > JpegEncoderContext *jpeg; > + > +#ifdef USE_LZ4 > + Lz4Data lz4_data; > + Lz4EncoderContext *lz4; > +#endif > }; > > typedef struct compress_send_data_t { > diff --git a/server/dcc.c b/server/dcc.c > index dca9715..aeaa2eb 100644 > --- a/server/dcc.c > +++ b/server/dcc.c > @@ -785,14 +785,15 @@ glz: > } > > #ifdef USE_LZ4 > -static int dcc_compress_image_lz4(DisplayChannelClient *dcc, SpiceImage > *dest, > - SpiceBitmap *src, compress_send_data_t* > o_comp_data) > +static int dcc_compress_image_lz4(EncodersData *enc, SpiceImage *dest, > + SpiceBitmap *src, compress_send_data_t* > o_comp_data, > + stat_info_t *stats) same comment as previous patches. > { > - Lz4Data *lz4_data = &dcc->lz4_data; > - Lz4EncoderContext *lz4 = dcc->lz4; > + Lz4Data *lz4_data = &enc->lz4_data; > + Lz4EncoderContext *lz4 = enc->lz4; > int lz4_size = 0; > stat_start_time_t start_time; > - stat_start_time_init(&start_time, &DCC_TO_DC(dcc)->lz4_stat); > + stat_start_time_init(&start_time, stats); > > #ifdef COMPRESS_DEBUG > spice_info("LZ4 compress"); > @@ -829,7 +830,7 @@ static int dcc_compress_image_lz4(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(&DCC_TO_DC(dcc)->lz4_stat, start_time, src->stride * > src->y, > + stat_compress_add(stats, start_time, src->stride * src->y, > o_comp_data->comp_buf_size); > return TRUE; > } > @@ -964,7 +965,8 @@ int dcc_compress_image(DisplayChannelClient *dcc, > case SPICE_IMAGE_COMPRESSION_LZ4: > if (red_channel_client_test_remote_cap(&dcc->common.base, > SPICE_DISPLAY_CAP_LZ4_COMPRESS > ION)) { > - success = dcc_compress_image_lz4(dcc, dest, src, o_comp_data); > + success = dcc_compress_image_lz4(&dcc->encoders, dest, src, > o_comp_data, > + &display_channel->lz4_stat); > break; > } > #endif > diff --git a/server/dcc.h b/server/dcc.h > index b200d50..ef4fae22 100644 > --- a/server/dcc.h > +++ b/server/dcc.h > @@ -65,10 +65,6 @@ struct DisplayChannelClient { > > int zlib_level; > > -#ifdef USE_LZ4 > - Lz4Data lz4_data; > - Lz4EncoderContext *lz4; > -#endif > ZlibData zlib_data; > ZlibEncoder *zlib; > Reviewed-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel