[Spice-devel] [PATCH v4 01/19] Add a structure to hold ImageEncoders shared data

Jonathon Jongsma jjongsma at redhat.com
Tue Jun 14 14:04:51 UTC 2016


Acked-by: Jonathon Jongsma <jjongsma at redhat.com>



On Tue, 2016-06-14 at 10:32 +0100, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/dcc-encoders.c    | 121 +++++++++++++++++++++++++++++++++++++++-------
> -
>  server/dcc-encoders.h    |  33 +++++++++----
>  server/dcc.c             |  26 +++++-----
>  server/display-channel.c |  73 ++--------------------------
>  server/display-channel.h |   9 +---
>  5 files changed, 141 insertions(+), 121 deletions(-)
> 
> diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
> index 6aaf954..c79cf58 100644
> --- a/server/dcc-encoders.c
> +++ b/server/dcc-encoders.c
> @@ -398,10 +398,13 @@ static void image_encoders_init_zlib(ImageEncoders *enc)
>      }
>  }
>  
> -void dcc_encoders_init(DisplayChannelClient *dcc)
> +void dcc_encoders_init(DisplayChannelClient *dcc, ImageEncoderSharedData
> *shared_data)
>  {
>      ImageEncoders *enc = &dcc->encoders;
>  
> +    spice_assert(shared_data);
> +    enc->shared_data = shared_data;
> +
>      dcc_init_glz_data(dcc);
>      image_encoders_init_quic(enc);
>      image_encoders_init_lz(enc);
> @@ -708,15 +711,14 @@ void dcc_release_glz(DisplayChannelClient *dcc)
>  }
>  
>  int image_encoders_compress_quic(ImageEncoders *enc, SpiceImage *dest,
> -                                 SpiceBitmap *src, compress_send_data_t*
> o_comp_data,
> -                                 stat_info_t *stats)
> +                                 SpiceBitmap *src, compress_send_data_t*
> o_comp_data)
>  {
>      QuicData *quic_data = &enc->quic_data;
>      QuicContext *quic = enc->quic;
>      volatile QuicImageType type;
>      int size, stride;
>      stat_start_time_t start_time;
> -    stat_start_time_init(&start_time, stats);
> +    stat_start_time_init(&start_time, &enc->shared_data->quic_stat);
>  
>  #ifdef COMPRESS_DEBUG
>      spice_info("QUIC compress");
> @@ -776,7 +778,7 @@ int image_encoders_compress_quic(ImageEncoders *enc,
> SpiceImage *dest,
>      o_comp_data->comp_buf = quic_data->data.bufs_head;
>      o_comp_data->comp_buf_size = size << 2;
>  
> -    stat_compress_add(stats, start_time, src->stride * src->y,
> +    stat_compress_add(&enc->shared_data->quic_stat, start_time, src->stride *
> src->y,
>                        o_comp_data->comp_buf_size);
>      return TRUE;
>  }
> @@ -797,8 +799,7 @@ static const LzImageType bitmap_fmt_to_lz_image_type[] = {
>  
>  int image_encoders_compress_lz(ImageEncoders *enc,
>                                 SpiceImage *dest, SpiceBitmap *src,
> -                               compress_send_data_t* o_comp_data,
> -                               stat_info_t *stats)
> +                               compress_send_data_t* o_comp_data)
>  {
>      LzData *lz_data = &enc->lz_data;
>      LzContext *lz = enc->lz;
> @@ -806,7 +807,7 @@ int image_encoders_compress_lz(ImageEncoders *enc,
>      int size;            // size of the compressed data
>  
>      stat_start_time_t start_time;
> -    stat_start_time_init(&start_time, stats);
> +    stat_start_time_init(&start_time, &enc->shared_data->lz_stat);
>  
>  #ifdef COMPRESS_DEBUG
>      spice_info("LZ LOCAL compress");
> @@ -856,15 +857,13 @@ int image_encoders_compress_lz(ImageEncoders *enc,
>          o_comp_data->lzplt_palette = dest->u.lz_plt.palette;
>      }
>  
> -    stat_compress_add(stats, start_time, src->stride * src->y,
> +    stat_compress_add(&enc->shared_data->lz_stat, start_time, src->stride *
> src->y,
>                        o_comp_data->comp_buf_size);
>      return TRUE;
>  }
>  
>  int image_encoders_compress_jpeg(ImageEncoders *enc, SpiceImage *dest,
> -                                 SpiceBitmap *src, compress_send_data_t*
> o_comp_data,
> -                                 stat_info_t *jpeg_stats, // FIXME put all
> stats in a structure
> -                                 stat_info_t *jpeg_alpha_stats)
> +                                 SpiceBitmap *src, compress_send_data_t*
> o_comp_data)
>  {
>      JpegData *jpeg_data = &enc->jpeg_data;
>      LzData *lz_data = &enc->lz_data;
> @@ -879,7 +878,7 @@ int image_encoders_compress_jpeg(ImageEncoders *enc,
> SpiceImage *dest,
>      int stride;
>      uint8_t *lz_out_start_byte;
>      stat_start_time_t start_time;
> -    stat_start_time_init(&start_time, jpeg_alpha_stats);
> +    stat_start_time_init(&start_time, &enc->shared_data->jpeg_alpha_stat);
>  
>  #ifdef COMPRESS_DEBUG
>      spice_info("JPEG compress");
> @@ -943,7 +942,7 @@ int image_encoders_compress_jpeg(ImageEncoders *enc,
> SpiceImage *dest,
>          o_comp_data->comp_buf_size = jpeg_size;
>          o_comp_data->is_lossy = TRUE;
>  
> -        stat_compress_add(jpeg_stats, start_time, src->stride * src->y,
> +        stat_compress_add(&enc->shared_data->jpeg_stat, start_time, src-
> >stride * src->y,
>                            o_comp_data->comp_buf_size);
>          return TRUE;
>      }
> @@ -983,21 +982,20 @@ int image_encoders_compress_jpeg(ImageEncoders *enc,
> SpiceImage *dest,
>      o_comp_data->comp_buf = jpeg_data->data.bufs_head;
>      o_comp_data->comp_buf_size = jpeg_size + alpha_lz_size;
>      o_comp_data->is_lossy = TRUE;
> -    stat_compress_add(jpeg_alpha_stats, start_time, src->stride * src->y,
> +    stat_compress_add(&enc->shared_data->jpeg_alpha_stat, start_time, src-
> >stride * src->y,
>                        o_comp_data->comp_buf_size);
>      return TRUE;
>  }
>  
>  #ifdef USE_LZ4
>  int image_encoders_compress_lz4(ImageEncoders *enc, SpiceImage *dest,
> -                                SpiceBitmap *src, compress_send_data_t*
> o_comp_data,
> -                                stat_info_t *stats)
> +                                SpiceBitmap *src, compress_send_data_t*
> o_comp_data)
>  {
>      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, stats);
> +    stat_start_time_init(&start_time, &enc->shared_data->lz4_stat);
>  
>  #ifdef COMPRESS_DEBUG
>      spice_info("LZ4 compress");
> @@ -1034,8 +1032,93 @@ int image_encoders_compress_lz4(ImageEncoders *enc,
> SpiceImage *dest,
>      o_comp_data->comp_buf = lz4_data->data.bufs_head;
>      o_comp_data->comp_buf_size = lz4_size;
>  
> -    stat_compress_add(stats, start_time, src->stride * src->y,
> +    stat_compress_add(&enc->shared_data->lz4_stat, start_time, src->stride *
> src->y,
>                        o_comp_data->comp_buf_size);
>      return TRUE;
>  }
>  #endif
> +
> +void image_encoder_shared_init(ImageEncoderSharedData *shared_data)
> +{
> +    clockid_t stat_clock = CLOCK_THREAD_CPUTIME_ID;
> +
> +    stat_compress_init(&shared_data->off_stat, "off", stat_clock);
> +    stat_compress_init(&shared_data->lz_stat, "lz", stat_clock);
> +    stat_compress_init(&shared_data->glz_stat, "glz", stat_clock);
> +    stat_compress_init(&shared_data->quic_stat, "quic", stat_clock);
> +    stat_compress_init(&shared_data->jpeg_stat, "jpeg", stat_clock);
> +    stat_compress_init(&shared_data->zlib_glz_stat, "zlib", stat_clock);
> +    stat_compress_init(&shared_data->jpeg_alpha_stat, "jpeg_alpha",
> stat_clock);
> +    stat_compress_init(&shared_data->lz4_stat, "lz4", stat_clock);
> +}
> +
> +void image_encoder_shared_stat_reset(ImageEncoderSharedData *shared_data)
> +{
> +    stat_reset(&shared_data->off_stat);
> +    stat_reset(&shared_data->quic_stat);
> +    stat_reset(&shared_data->lz_stat);
> +    stat_reset(&shared_data->glz_stat);
> +    stat_reset(&shared_data->jpeg_stat);
> +    stat_reset(&shared_data->zlib_glz_stat);
> +    stat_reset(&shared_data->jpeg_alpha_stat);
> +    stat_reset(&shared_data->lz4_stat);
> +}
> +
> +#define STAT_FMT "%s\t%8u\t%13.8g\t%12.8g\t%12.8g"
> +
> +#ifdef COMPRESS_STAT
> +static void stat_print_one(const char *name, const stat_info_t *stat)
> +{
> +    spice_info(STAT_FMT, name, stat->count,
> +               stat_byte_to_mega(stat->orig_size),
> +               stat_byte_to_mega(stat->comp_size),
> +               stat_cpu_time_to_sec(stat->total));
> +}
> +
> +static void stat_sum(stat_info_t *total, const stat_info_t *stat)
> +{
> +    total->count += stat->count;
> +    total->orig_size += stat->orig_size;
> +    total->comp_size += stat->comp_size;
> +    total->total += stat->total;
> +}
> +#endif
> +
> +void image_encoder_shared_stat_print(const ImageEncoderSharedData
> *shared_data)
> +{
> +#ifdef COMPRESS_STAT
> +    /* sum all statistics */
> +    stat_info_t total = {
> +        .count = 0,
> +        .orig_size = 0,
> +        .comp_size = 0,
> +        .total = 0
> +    };
> +    stat_sum(&total, &shared_data->off_stat);
> +    stat_sum(&total, &shared_data->quic_stat);
> +    stat_sum(&total, &shared_data->glz_stat);
> +    stat_sum(&total, &shared_data->lz_stat);
> +    stat_sum(&total, &shared_data->jpeg_stat);
> +    stat_sum(&total, &shared_data->jpeg_alpha_stat);
> +    stat_sum(&total, &shared_data->lz4_stat);
> +
> +    /* fix for zlib glz */
> +    total.total += shared_data->zlib_glz_stat.total;
> +    if (shared_data->zlib_glz_stat.count) {
> +        total.comp_size = total.comp_size - shared_data->glz_stat.comp_size +
> +                          shared_data->zlib_glz_stat.comp_size;
> +    }
> +
> +    spice_info("Method   \t  count  \torig_size(MB)\tenc_size(MB)\tenc_time(s
> )");
> +    stat_print_one("OFF      ", &shared_data->off_stat);
> +    stat_print_one("QUIC     ", &shared_data->quic_stat);
> +    stat_print_one("GLZ      ", &shared_data->glz_stat);
> +    stat_print_one("ZLIB GLZ ", &shared_data->zlib_glz_stat);
> +    stat_print_one("LZ       ", &shared_data->lz_stat);
> +    stat_print_one("JPEG     ", &shared_data->jpeg_stat);
> +    stat_print_one("JPEG-RGBA", &shared_data->jpeg_alpha_stat);
> +    stat_print_one("LZ4      ", &shared_data->lz4_stat);
> +    spice_info("-------------------------------------------------------------
> ------");
> +    stat_print_one("Total    ", &total);
> +#endif
> +}
> diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h
> index 23355f7..4b89cc9 100644
> --- a/server/dcc-encoders.h
> +++ b/server/dcc-encoders.h
> @@ -35,8 +35,13 @@ typedef struct RedCompressBuf RedCompressBuf;
>  typedef struct GlzDrawableInstanceItem GlzDrawableInstanceItem;
>  typedef struct RedGlzDrawable RedGlzDrawable;
>  typedef struct ImageEncoders ImageEncoders;
> +typedef struct ImageEncoderSharedData ImageEncoderSharedData;
>  
> -void             dcc_encoders_init                           (DisplayChannelC
> lient *dcc);
> +void image_encoder_shared_init(ImageEncoderSharedData *shared_data);
> +void image_encoder_shared_stat_reset(ImageEncoderSharedData *shared_data);
> +void image_encoder_shared_stat_print(const ImageEncoderSharedData
> *shared_data);
> +
> +void dcc_encoders_init(DisplayChannelClient *dcc, ImageEncoderSharedData
> *shared_data);
>  void image_encoders_free(ImageEncoders *enc);
>  void             dcc_free_glz_drawable                       (DisplayChannelC
> lient *dcc,
>                                                                RedGlzDrawable
> *drawable);
> @@ -161,7 +166,20 @@ struct RedGlzDrawable {
>      DisplayChannelClient *dcc;
>  };
>  
> +struct ImageEncoderSharedData {
> +    stat_info_t off_stat;
> +    stat_info_t lz_stat;
> +    stat_info_t glz_stat;
> +    stat_info_t quic_stat;
> +    stat_info_t jpeg_stat;
> +    stat_info_t zlib_glz_stat;
> +    stat_info_t jpeg_alpha_stat;
> +    stat_info_t lz4_stat;
> +};
> +
>  struct ImageEncoders {
> +    ImageEncoderSharedData *shared_data;
> +
>      QuicData quic_data;
>      QuicContext *quic;
>  
> @@ -192,19 +210,14 @@ typedef struct compress_send_data_t {
>  } compress_send_data_t;
>  
>  int image_encoders_compress_quic(ImageEncoders *enc, SpiceImage *dest,
> -                                 SpiceBitmap *src, compress_send_data_t*
> o_comp_data,
> -                                 stat_info_t *stats);
> +                                 SpiceBitmap *src, compress_send_data_t*
> o_comp_data);
>  int image_encoders_compress_lz(ImageEncoders *enc,
>                                 SpiceImage *dest, SpiceBitmap *src,
> -                               compress_send_data_t* o_comp_data,
> -                               stat_info_t *stats);
> +                               compress_send_data_t* o_comp_data);
>  int image_encoders_compress_jpeg(ImageEncoders *enc, SpiceImage *dest,
> -                                 SpiceBitmap *src, compress_send_data_t*
> o_comp_data,
> -                                 stat_info_t *jpeg_stats,
> -                                 stat_info_t *jpeg_alpha_stats);
> +                                 SpiceBitmap *src, compress_send_data_t*
> o_comp_data);
>  int image_encoders_compress_lz4(ImageEncoders *enc, SpiceImage *dest,
> -                                SpiceBitmap *src, compress_send_data_t*
> o_comp_data,
> -                                stat_info_t *stats);
> +                                SpiceBitmap *src, compress_send_data_t*
> o_comp_data);
>  
>  #define RED_RELEASE_BUNCH_SIZE 64
>  
> diff --git a/server/dcc.c b/server/dcc.c
> index 7724e11..8f44e64 100644
> --- a/server/dcc.c
> +++ b/server/dcc.c
> @@ -396,7 +396,7 @@ DisplayChannelClient *dcc_new(DisplayChannel *display,
>      ring_init(&dcc->glz_drawables_inst_to_free);
>      pthread_mutex_init(&dcc->glz_drawables_inst_to_free_lock, NULL);
>  
> -    dcc_encoders_init(dcc);
> +    dcc_encoders_init(dcc, &display->encoder_globals);
>  
>      return dcc;
>  }
> @@ -709,7 +709,7 @@ static int dcc_compress_image_glz(DisplayChannelClient
> *dcc,
>  {
>      DisplayChannel *display_channel = DCC_TO_DC(dcc);
>      stat_start_time_t start_time;
> -    stat_start_time_init(&start_time, &display_channel->zlib_glz_stat);
> +    stat_start_time_init(&start_time, &display_channel-
> >encoder_globals.zlib_glz_stat);
>      spice_assert(bitmap_fmt_is_rgb(src->format));
>      GlzData *glz_data = &dcc->glz_data;
>      ZlibData *zlib_data;
> @@ -740,12 +740,12 @@ static int dcc_compress_image_glz(DisplayChannelClient
> *dcc,
>                            glz_drawable_instance,
>                            &glz_drawable_instance->context);
>  
> -    stat_compress_add(&display_channel->glz_stat, start_time, src->stride *
> src->y, glz_size);
> +    stat_compress_add(&display_channel->encoder_globals.glz_stat, start_time,
> src->stride * src->y, glz_size);
>  
>      if (!display_channel->enable_zlib_glz_wrap || (glz_size <
> MIN_GLZ_SIZE_FOR_ZLIB)) {
>          goto glz;
>      }
> -    stat_start_time_init(&start_time, &display_channel->zlib_glz_stat);
> +    stat_start_time_init(&start_time, &display_channel-
> >encoder_globals.zlib_glz_stat);
>      zlib_data = &dcc->encoders.zlib_data;
>  
>      encoder_data_init(&zlib_data->data);
> @@ -772,7 +772,7 @@ static int dcc_compress_image_glz(DisplayChannelClient
> *dcc,
>      o_comp_data->comp_buf = zlib_data->data.bufs_head;
>      o_comp_data->comp_buf_size = zlib_size;
>  
> -    stat_compress_add(&display_channel->zlib_glz_stat, start_time, glz_size,
> zlib_size);
> +    stat_compress_add(&display_channel->encoder_globals.zlib_glz_stat,
> start_time, glz_size, zlib_size);
>      return TRUE;
>  glz:
>      dest->descriptor.type = SPICE_IMAGE_TYPE_GLZ_RGB;
> @@ -878,7 +878,7 @@ int dcc_compress_image(DisplayChannelClient *dcc,
>      stat_start_time_t start_time;
>      int success = FALSE;
>  
> -    stat_start_time_init(&start_time, &display_channel->off_stat);
> +    stat_start_time_init(&start_time, &display_channel-
> >encoder_globals.off_stat);
>  
>      image_compression = get_compression_for_bitmap(src, dcc-
> >image_compression, drawable);
>      switch (image_compression) {
> @@ -887,13 +887,10 @@ int dcc_compress_image(DisplayChannelClient *dcc,
>      case SPICE_IMAGE_COMPRESSION_QUIC:
>          if (can_lossy && display_channel->enable_jpeg &&
>              (src->format != SPICE_BITMAP_FMT_RGBA ||
> !bitmap_has_extra_stride(src))) {
> -            success = image_encoders_compress_jpeg(&dcc->encoders, dest, src,
> o_comp_data,
> -                                                   &display_channel-
> >jpeg_stat,
> -                                                   &display_channel-
> >jpeg_alpha_stat);
> +            success = image_encoders_compress_jpeg(&dcc->encoders, dest, src,
> o_comp_data);
>              break;
>          }
> -        success = image_encoders_compress_quic(&dcc->encoders, dest, src,
> o_comp_data,
> -                                               &display_channel->quic_stat);
> +        success = image_encoders_compress_quic(&dcc->encoders, dest, src,
> o_comp_data);
>          break;
>      case SPICE_IMAGE_COMPRESSION_GLZ:
>          if ((src->x * src->y) < glz_enc_dictionary_get_size(dcc->glz_dict-
> >dict)) {
> @@ -914,14 +911,13 @@ 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 = image_encoders_compress_lz4(&dcc->encoders, dest, src,
> o_comp_data,
> -                                                  &display_channel-
> >lz4_stat);
> +            success = image_encoders_compress_lz4(&dcc->encoders, dest, src,
> o_comp_data);
>              break;
>          }
>  #endif
>  lz_compress:
>      case SPICE_IMAGE_COMPRESSION_LZ:
> -        success = image_encoders_compress_lz(&dcc->encoders, dest, src,
> o_comp_data, &display_channel->lz_stat);
> +        success = image_encoders_compress_lz(&dcc->encoders, dest, src,
> o_comp_data);
>          if (success && !bitmap_fmt_is_rgb(src->format)) {
>              dcc_palette_cache_palette(dcc, dest->u.lz_plt.palette, &(dest-
> >u.lz_plt.flags));
>          }
> @@ -932,7 +928,7 @@ lz_compress:
>  
>      if (!success) {
>          uint64_t image_size = src->stride * src->y;
> -        stat_compress_add(&display_channel->off_stat, start_time, image_size,
> image_size);
> +        stat_compress_add(&display_channel->encoder_globals.off_stat,
> start_time, image_size, image_size);
>      }
>  
>      return success;
> diff --git a/server/display-channel.c b/server/display-channel.c
> index 2888cad..6ec8692 100644
> --- a/server/display-channel.c
> +++ b/server/display-channel.c
> @@ -38,75 +38,16 @@ void display_channel_compress_stats_reset(DisplayChannel
> *display)
>  {
>      spice_return_if_fail(display);
>  
> -    stat_reset(&display->off_stat);
> -    stat_reset(&display->quic_stat);
> -    stat_reset(&display->lz_stat);
> -    stat_reset(&display->glz_stat);
> -    stat_reset(&display->jpeg_stat);
> -    stat_reset(&display->zlib_glz_stat);
> -    stat_reset(&display->jpeg_alpha_stat);
> -    stat_reset(&display->lz4_stat);
> +    image_encoder_shared_stat_reset(&display->encoder_globals);
>  }
>  
> -#define STAT_FMT "%s\t%8u\t%13.8g\t%12.8g\t%12.8g"
> -
> -#ifdef COMPRESS_STAT
> -static void stat_print_one(const char *name, const stat_info_t *stat)
> -{
> -    spice_info(STAT_FMT, name, stat->count,
> -               stat_byte_to_mega(stat->orig_size),
> -               stat_byte_to_mega(stat->comp_size),
> -               stat_cpu_time_to_sec(stat->total));
> -}
> -
> -static void stat_sum(stat_info_t *total, const stat_info_t *stat)
> -{
> -    total->count += stat->count;
> -    total->orig_size += stat->orig_size;
> -    total->comp_size += stat->comp_size;
> -    total->total += stat->total;
> -}
> -#endif
> -
>  void display_channel_compress_stats_print(const DisplayChannel
> *display_channel)
>  {
> -    spice_return_if_fail(display_channel);
> -
>  #ifdef COMPRESS_STAT
> -    /* sum all statistics */
> -    stat_info_t total = {
> -        .count = 0,
> -        .orig_size = 0,
> -        .comp_size = 0,
> -        .total = 0
> -    };
> -    stat_sum(&total, &display_channel->off_stat);
> -    stat_sum(&total, &display_channel->quic_stat);
> -    stat_sum(&total, &display_channel->glz_stat);
> -    stat_sum(&total, &display_channel->lz_stat);
> -    stat_sum(&total, &display_channel->jpeg_stat);
> -    stat_sum(&total, &display_channel->jpeg_alpha_stat);
> -    stat_sum(&total, &display_channel->lz4_stat);
> -
> -    /* fix for zlib glz */
> -    total.total += display_channel->zlib_glz_stat.total;
> -    if (display_channel->enable_zlib_glz_wrap) {
> -        total.comp_size = total.comp_size - display_channel-
> >glz_stat.comp_size +
> -                          display_channel->zlib_glz_stat.comp_size;
> -    }
> +    spice_return_if_fail(display_channel);
>  
>      spice_info("==> Compression stats for display %u", display_channel-
> >common.base.id);
> -    spice_info("Method   \t  count  \torig_size(MB)\tenc_size(MB)\tenc_time(s
> )");
> -    stat_print_one("OFF      ", &display_channel->off_stat);
> -    stat_print_one("QUIC     ", &display_channel->quic_stat);
> -    stat_print_one("GLZ      ", &display_channel->glz_stat);
> -    stat_print_one("ZLIB GLZ ", &display_channel->zlib_glz_stat);
> -    stat_print_one("LZ       ", &display_channel->lz_stat);
> -    stat_print_one("JPEG     ", &display_channel->jpeg_stat);
> -    stat_print_one("JPEG-RGBA", &display_channel->jpeg_alpha_stat);
> -    stat_print_one("LZ4      ", &display_channel->lz4_stat);
> -    spice_info("-------------------------------------------------------------
> ------");
> -    stat_print_one("Total    ", &total);
> +    image_encoder_shared_stat_print(&display_channel->encoder_globals);
>  #endif
>  }
>  
> @@ -1984,13 +1925,7 @@ DisplayChannel* display_channel_new(SpiceServer *reds,
> RedWorker *worker,
>      display->non_cache_counter = stat_add_counter(reds, channel->stat,
>                                                    "non_cache", TRUE);
>  #endif
> -    stat_compress_init(&display->lz_stat, "lz", stat_clock);
> -    stat_compress_init(&display->glz_stat, "glz", stat_clock);
> -    stat_compress_init(&display->quic_stat, "quic", stat_clock);
> -    stat_compress_init(&display->jpeg_stat, "jpeg", stat_clock);
> -    stat_compress_init(&display->zlib_glz_stat, "zlib", stat_clock);
> -    stat_compress_init(&display->jpeg_alpha_stat, "jpeg_alpha", stat_clock);
> -    stat_compress_init(&display->lz4_stat, "lz4", stat_clock);
> +    image_encoder_shared_init(&display->encoder_globals);
>  
>      display->n_surfaces = n_surfaces;
>      display->renderer = RED_RENDERER_INVALID;
> diff --git a/server/display-channel.h b/server/display-channel.h
> index 16ea709..db1cdba 100644
> --- a/server/display-channel.h
> +++ b/server/display-channel.h
> @@ -216,14 +216,7 @@ struct DisplayChannel {
>      uint64_t *add_to_cache_counter;
>      uint64_t *non_cache_counter;
>  #endif
> -    stat_info_t off_stat;
> -    stat_info_t lz_stat;
> -    stat_info_t glz_stat;
> -    stat_info_t quic_stat;
> -    stat_info_t jpeg_stat;
> -    stat_info_t zlib_glz_stat;
> -    stat_info_t jpeg_alpha_stat;
> -    stat_info_t lz4_stat;
> +    ImageEncoderSharedData encoder_globals;
>  };
>  
>  static inline int get_stream_id(DisplayChannel *display, Stream *stream)


More information about the Spice-devel mailing list