[Spice-devel] [PATCH] Adjust to new SpiceImageCompress name

Jonathon Jongsma jjongsma at redhat.com
Wed Jul 29 14:08:47 PDT 2015


ACK

On Thu, 2015-07-23 at 16:37 +0200, Christophe Fergeau wrote:
> This has been renamed to SpiceImageCompression in order to avoid clashes
> with older spice-server in the SPICE_IMAGE_COMPRESS_ namespace. This
> commit is a straight rename of SpiceImageCompress to
> SpiceImageCompression and SPICE_IMAGE_COMPRESS_ to
> SPICE_IMAGE_COMPRESSION_
> ---
>  server/red_dispatcher.c |  4 +--
>  server/red_dispatcher.h |  2 +-
>  server/red_worker.c     | 76 ++++++++++++++++++++++++-------------------------
>  server/red_worker.h     |  2 +-
>  server/reds.c           | 12 ++++----
>  server/spice-server.h   | 14 +++++++--
>  spice-common            |  2 +-
>  7 files changed, 60 insertions(+), 52 deletions(-)
> 
> diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
> index d2420cf..113848a 100644
> --- a/server/red_dispatcher.c
> +++ b/server/red_dispatcher.c
> @@ -70,7 +70,7 @@ struct RedDispatcher {
>  };
>  
>  extern uint32_t streaming_video;
> -extern SpiceImageCompress image_compression;
> +extern SpiceImageCompression image_compression;
>  extern spice_wan_compression_t jpeg_state;
>  extern spice_wan_compression_t zlib_glz_state;
>  
> @@ -747,7 +747,7 @@ static inline int calc_compression_level(void)
>  {
>      spice_assert(streaming_video != SPICE_STREAM_VIDEO_INVALID);
>      if ((streaming_video != SPICE_STREAM_VIDEO_OFF) ||
> -        (image_compression != SPICE_IMAGE_COMPRESS_QUIC)) {
> +        (image_compression != SPICE_IMAGE_COMPRESSION_QUIC)) {
>          return 0;
>      } else {
>          return 1;
> diff --git a/server/red_dispatcher.h b/server/red_dispatcher.h
> index b29cb8b..320b7e3 100644
> --- a/server/red_dispatcher.h
> +++ b/server/red_dispatcher.h
> @@ -167,7 +167,7 @@ typedef struct RedWorkerMessageLoadvmCommands {
>  } RedWorkerMessageLoadvmCommands;
>  
>  typedef struct RedWorkerMessageSetCompression {
> -    SpiceImageCompress image_compression;
> +    SpiceImageCompression image_compression;
>  } RedWorkerMessageSetCompression;
>  
>  typedef struct RedWorkerMessageSetStreamingVideo {
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 74c585a..e4407a8 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -986,7 +986,7 @@ typedef struct RedWorker {
>  
>      ImageCache image_cache;
>  
> -    SpiceImageCompress image_compression;
> +    SpiceImageCompression image_compression;
>      spice_wan_compression_t jpeg_state;
>      spice_wan_compression_t zlib_glz_state;
>  
> @@ -6557,14 +6557,14 @@ static inline int red_compress_image(DisplayChannelClient *dcc,
>                                       compress_send_data_t* o_comp_data)
>  {
>      DisplayChannel *display_channel = DCC_TO_DC(dcc);
> -    SpiceImageCompress image_compression =
> +    SpiceImageCompression image_compression =
>          display_channel->common.worker->image_compression;
>      int quic_compress = FALSE;
>  
> -    if ((image_compression == SPICE_IMAGE_COMPRESS_OFF) ||
> +    if ((image_compression == SPICE_IMAGE_COMPRESSION_OFF) ||
>          ((src->y * src->stride) < MIN_SIZE_TO_COMPRESS)) { // TODO: change the size cond
>          return FALSE;
> -    } else if (image_compression == SPICE_IMAGE_COMPRESS_QUIC) {
> +    } else if (image_compression == SPICE_IMAGE_COMPRESSION_QUIC) {
>          if (BITMAP_FMT_IS_PLT[src->format]) {
>              return FALSE;
>          } else {
> @@ -6576,17 +6576,17 @@ static inline int red_compress_image(DisplayChannelClient *dcc,
>              of the image in bytes (2) unstable bitmaps
>          */
>          if (_stride_is_extra(src) || (src->data->flags & SPICE_CHUNKS_FLAGS_UNSTABLE)) {
> -            if ((image_compression == SPICE_IMAGE_COMPRESS_LZ) ||
> -                (image_compression == SPICE_IMAGE_COMPRESS_GLZ) ||
> -                (image_compression == SPICE_IMAGE_COMPRESS_LZ4) ||
> +            if ((image_compression == SPICE_IMAGE_COMPRESSION_LZ) ||
> +                (image_compression == SPICE_IMAGE_COMPRESSION_GLZ) ||
> +                (image_compression == SPICE_IMAGE_COMPRESSION_LZ4) ||
>                  BITMAP_FMT_IS_PLT[src->format]) {
>                  return FALSE;
>              } else {
>                  quic_compress = TRUE;
>              }
>          } else {
> -            if ((image_compression == SPICE_IMAGE_COMPRESS_AUTO_LZ) ||
> -                (image_compression == SPICE_IMAGE_COMPRESS_AUTO_GLZ)) {
> +            if ((image_compression == SPICE_IMAGE_COMPRESSION_AUTO_LZ) ||
> +                (image_compression == SPICE_IMAGE_COMPRESSION_AUTO_GLZ)) {
>                  if ((src->x < MIN_DIMENSION_TO_QUIC) || (src->y < MIN_DIMENSION_TO_QUIC)) {
>                      quic_compress = FALSE;
>                  } else {
> @@ -6611,8 +6611,8 @@ static inline int red_compress_image(DisplayChannelClient *dcc,
>  #endif
>          // if bitmaps is picture-like, compress it using jpeg
>          if (can_lossy && display_channel->enable_jpeg &&
> -            ((image_compression == SPICE_IMAGE_COMPRESS_AUTO_LZ) ||
> -            (image_compression == SPICE_IMAGE_COMPRESS_AUTO_GLZ))) {
> +            ((image_compression == SPICE_IMAGE_COMPRESSION_AUTO_LZ) ||
> +            (image_compression == SPICE_IMAGE_COMPRESSION_AUTO_GLZ))) {
>              // if we use lz for alpha, the stride can't be extra
>              if (src->format != SPICE_BITMAP_FMT_RGBA || !_stride_is_extra(src)) {
>                  return red_jpeg_compress_image(dcc, dest,
> @@ -6624,14 +6624,14 @@ static inline int red_compress_image(DisplayChannelClient *dcc,
>      } else {
>          int glz;
>          int ret;
> -        if ((image_compression == SPICE_IMAGE_COMPRESS_AUTO_GLZ) ||
> -            (image_compression == SPICE_IMAGE_COMPRESS_GLZ)) {
> +        if ((image_compression == SPICE_IMAGE_COMPRESSION_AUTO_GLZ) ||
> +            (image_compression == SPICE_IMAGE_COMPRESSION_GLZ)) {
>              glz = BITMAP_FMT_HAS_GRADUALITY(src->format) && (
>                      (src->x * src->y) < glz_enc_dictionary_get_size(
>                          dcc->glz_dict->dict));
> -        } else if ((image_compression == SPICE_IMAGE_COMPRESS_AUTO_LZ) ||
> -                   (image_compression == SPICE_IMAGE_COMPRESS_LZ) ||
> -                   (image_compression == SPICE_IMAGE_COMPRESS_LZ4)) {
> +        } else if ((image_compression == SPICE_IMAGE_COMPRESSION_AUTO_LZ) ||
> +                   (image_compression == SPICE_IMAGE_COMPRESSION_LZ) ||
> +                   (image_compression == SPICE_IMAGE_COMPRESSION_LZ4)) {
>              glz = FALSE;
>          } else {
>              spice_error("invalid image compression type %u", image_compression);
> @@ -6653,7 +6653,7 @@ static inline int red_compress_image(DisplayChannelClient *dcc,
>  
>          if (!glz) {
>  #ifdef USE_LZ4
> -            if (image_compression == SPICE_IMAGE_COMPRESS_LZ4 &&
> +            if (image_compression == SPICE_IMAGE_COMPRESSION_LZ4 &&
>                  bitmap_fmt_is_rgb(src->format) &&
>                  red_channel_client_test_remote_cap(&dcc->common.base,
>                          SPICE_DISPLAY_CAP_LZ4_COMPRESSION)) {
> @@ -6868,10 +6868,10 @@ static void fill_mask(RedChannelClient *rcc, SpiceMarshaller *m,
>      DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
>  
>      if (mask_bitmap && m) {
> -        if (display_channel->common.worker->image_compression != SPICE_IMAGE_COMPRESS_OFF) {
> -            SpiceImageCompress save_img_comp =
> +        if (display_channel->common.worker->image_compression != SPICE_IMAGE_COMPRESSION_OFF) {
> +            SpiceImageCompression save_img_comp =
>                  display_channel->common.worker->image_compression;
> -            display_channel->common.worker->image_compression = SPICE_IMAGE_COMPRESS_OFF;
> +            display_channel->common.worker->image_compression = SPICE_IMAGE_COMPRESSION_OFF;
>              fill_bits(dcc, m, mask_bitmap, drawable, FALSE);
>              display_channel->common.worker->image_compression = save_img_comp;
>          } else {
> @@ -8815,7 +8815,7 @@ static void red_marshall_image(RedChannelClient *rcc, SpiceMarshaller *m, ImageI
>      int comp_succeeded = FALSE;
>      int lossy_comp = FALSE;
>      int quic_comp = FALSE;
> -    SpiceImageCompress comp_mode;
> +    SpiceImageCompression comp_mode;
>      SpiceMsgDisplayDrawCopy copy;
>      SpiceMarshaller *src_bitmap_out, *mask_bitmap_out;
>      SpiceMarshaller *bitmap_palette_out, *lzplt_palette_out;
> @@ -8871,8 +8871,8 @@ static void red_marshall_image(RedChannelClient *rcc, SpiceMarshaller *m, ImageI
>  
>      comp_mode = display_channel->common.worker->image_compression;
>  
> -    if (((comp_mode == SPICE_IMAGE_COMPRESS_AUTO_LZ) ||
> -        (comp_mode == SPICE_IMAGE_COMPRESS_AUTO_GLZ)) && !_stride_is_extra(&bitmap)) {
> +    if (((comp_mode == SPICE_IMAGE_COMPRESSION_AUTO_LZ) ||
> +        (comp_mode == SPICE_IMAGE_COMPRESSION_AUTO_GLZ)) && !_stride_is_extra(&bitmap)) {
>  
>          if (BITMAP_FMT_HAS_GRADUALITY(item->image_format)) {
>              BitmapGradualType grad_level;
> @@ -8901,7 +8901,7 @@ static void red_marshall_image(RedChannelClient *rcc, SpiceMarshaller *m, ImageI
>                                                       worker->mem_slots.internal_groupslot_id);
>          } else {
>  #ifdef USE_LZ4
> -            if (comp_mode == SPICE_IMAGE_COMPRESS_LZ4 &&
> +            if (comp_mode == SPICE_IMAGE_COMPRESSION_LZ4 &&
>                  bitmap_fmt_is_rgb(bitmap.format) &&
>                  red_channel_client_test_remote_cap(&dcc->common.base,
>                          SPICE_DISPLAY_CAP_LZ4_COMPRESSION)) {
> @@ -10270,15 +10270,15 @@ static int display_channel_handle_preferred_compression(DisplayChannelClient *dc
>          SpiceMsgcDisplayPreferredCompression *pc) {
>      DisplayChannel *display_channel = DCC_TO_DC(dcc);
>      switch (pc->image_compression) {
> -    case SPICE_IMAGE_COMPRESS_AUTO_LZ:
> -    case SPICE_IMAGE_COMPRESS_AUTO_GLZ:
> -    case SPICE_IMAGE_COMPRESS_QUIC:
> +    case SPICE_IMAGE_COMPRESSION_AUTO_LZ:
> +    case SPICE_IMAGE_COMPRESSION_AUTO_GLZ:
> +    case SPICE_IMAGE_COMPRESSION_QUIC:
>  #ifdef USE_LZ4
> -    case SPICE_IMAGE_COMPRESS_LZ4:
> +    case SPICE_IMAGE_COMPRESSION_LZ4:
>  #endif
> -    case SPICE_IMAGE_COMPRESS_LZ:
> -    case SPICE_IMAGE_COMPRESS_GLZ:
> -    case SPICE_IMAGE_COMPRESS_OFF:
> +    case SPICE_IMAGE_COMPRESSION_LZ:
> +    case SPICE_IMAGE_COMPRESSION_GLZ:
> +    case SPICE_IMAGE_COMPRESSION_OFF:
>          display_channel->common.worker->image_compression = pc->image_compression;
>          return TRUE;
>      default:
> @@ -11745,27 +11745,27 @@ void handle_dev_set_compression(void *opaque, void *payload)
>  
>      worker->image_compression = msg->image_compression;
>      switch (worker->image_compression) {
> -    case SPICE_IMAGE_COMPRESS_AUTO_LZ:
> +    case SPICE_IMAGE_COMPRESSION_AUTO_LZ:
>          spice_info("ic auto_lz");
>          break;
> -    case SPICE_IMAGE_COMPRESS_AUTO_GLZ:
> +    case SPICE_IMAGE_COMPRESSION_AUTO_GLZ:
>          spice_info("ic auto_glz");
>          break;
> -    case SPICE_IMAGE_COMPRESS_QUIC:
> +    case SPICE_IMAGE_COMPRESSION_QUIC:
>          spice_info("ic quic");
>          break;
>  #ifdef USE_LZ4
> -    case SPICE_IMAGE_COMPRESS_LZ4:
> +    case SPICE_IMAGE_COMPRESSION_LZ4:
>          spice_info("ic lz4");
>          break;
>  #endif
> -    case SPICE_IMAGE_COMPRESS_LZ:
> +    case SPICE_IMAGE_COMPRESSION_LZ:
>          spice_info("ic lz");
>          break;
> -    case SPICE_IMAGE_COMPRESS_GLZ:
> +    case SPICE_IMAGE_COMPRESSION_GLZ:
>          spice_info("ic glz");
>          break;
> -    case SPICE_IMAGE_COMPRESS_OFF:
> +    case SPICE_IMAGE_COMPRESSION_OFF:
>          spice_info("ic off");
>          break;
>      default:
> diff --git a/server/red_worker.h b/server/red_worker.h
> index 2042b3d..c34369a 100644
> --- a/server/red_worker.h
> +++ b/server/red_worker.h
> @@ -92,7 +92,7 @@ typedef struct WorkerInitData {
>      uint32_t *pending;
>      uint32_t num_renderers;
>      uint32_t renderers[RED_MAX_RENDERERS];
> -    SpiceImageCompress image_compression;
> +    SpiceImageCompression image_compression;
>      spice_wan_compression_t jpeg_state;
>      spice_wan_compression_t zlib_glz_state;
>      int streaming_video;
> diff --git a/server/reds.c b/server/reds.c
> index c74894a..cec28b8 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -111,7 +111,7 @@ static int ticketing_enabled = 1; //Ticketing is enabled by default
>  static pthread_mutex_t *lock_cs;
>  static long *lock_count;
>  uint32_t streaming_video = SPICE_STREAM_VIDEO_FILTER;
> -SpiceImageCompress image_compression = SPICE_IMAGE_COMPRESS_AUTO_GLZ;
> +SpiceImageCompression image_compression = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
>  spice_wan_compression_t jpeg_state = SPICE_WAN_COMPRESSION_AUTO;
>  spice_wan_compression_t zlib_glz_state = SPICE_WAN_COMPRESSION_AUTO;
>  int agent_mouse = TRUE;
> @@ -2709,7 +2709,7 @@ static inline void on_activating_ticketing(void)
>      }
>  }
>  
> -static void set_image_compression(SpiceImageCompress val)
> +static void set_image_compression(SpiceImageCompression val)
>  {
>      if (val == image_compression) {
>          return;
> @@ -3553,13 +3553,13 @@ SPICE_GNUC_VISIBLE int spice_server_set_tls(SpiceServer *s, int port,
>  }
>  
>  SPICE_GNUC_VISIBLE int spice_server_set_image_compression(SpiceServer *s,
> -                                                          SpiceImageCompress comp)
> +                                                          SpiceImageCompression comp)
>  {
>      spice_assert(reds == s);
>  #ifndef USE_LZ4
> -    if (comp == SPICE_IMAGE_COMPRESS_LZ4) {
> +    if (comp == SPICE_IMAGE_COMPRESSION_LZ4) {
>          spice_warning("LZ4 compression not supported, falling back to auto GLZ");
> -        comp = SPICE_IMAGE_COMPRESS_AUTO_GLZ;
> +        comp = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
>          set_image_compression(comp);
>          return -1;
>      }
> @@ -3568,7 +3568,7 @@ SPICE_GNUC_VISIBLE int spice_server_set_image_compression(SpiceServer *s,
>      return 0;
>  }
>  
> -SPICE_GNUC_VISIBLE SpiceImageCompress spice_server_get_image_compression(SpiceServer *s)
> +SPICE_GNUC_VISIBLE SpiceImageCompression spice_server_get_image_compression(SpiceServer *s)
>  {
>      spice_assert(reds == s);
>      return image_compression;
> diff --git a/server/spice-server.h b/server/spice-server.h
> index 0c707a7..c2ff61d 100644
> --- a/server/spice-server.h
> +++ b/server/spice-server.h
> @@ -68,11 +68,19 @@ int spice_server_add_interface(SpiceServer *s,
>  int spice_server_remove_interface(SpiceBaseInstance *sin);
>  
>  // Needed for backward API compatibility
> -typedef SpiceImageCompress spice_image_compression_t;
> +typedef SpiceImageCompression spice_image_compression_t;
> +#define SPICE_IMAGE_COMPRESS_INVALID SPICE_IMAGE_COMPRESSION_INVALID
> +#define SPICE_IMAGE_COMPRESS_OFF SPICE_IMAGE_COMPRESSION_OFF
> +#define SPICE_IMAGE_COMPRESS_AUTO_GLZ SPICE_IMAGE_COMPRESSION_AUTO_GLZ
> +#define SPICE_IMAGE_COMPRESS_AUTO_LZ SPICE_IMAGE_COMPRESSION_AUTO_LZ
> +#define SPICE_IMAGE_COMPRESS_QUIC SPICE_IMAGE_COMPRESSION_QUIC
> +#define SPICE_IMAGE_COMPRESS_GLZ SPICE_IMAGE_COMPRESSION_GLZ
> +#define SPICE_IMAGE_COMPRESS_LZ SPICE_IMAGE_COMPRESSION_LZ
> +#define SPICE_IMAGE_COMPRESS_LZ4 SPICE_IMAGE_COMPRESSION_LZ4
>  
>  int spice_server_set_image_compression(SpiceServer *s,
> -                                       SpiceImageCompress comp);
> -SpiceImageCompress spice_server_get_image_compression(SpiceServer *s);
> +                                       SpiceImageCompression comp);
> +SpiceImageCompression spice_server_get_image_compression(SpiceServer *s);
>  
>  typedef enum {
>      SPICE_WAN_COMPRESSION_INVALID,
> diff --git a/spice-common b/spice-common
> index dcebede..c42f8ed 160000
> --- a/spice-common
> +++ b/spice-common
> @@ -1 +1 @@
> -Subproject commit dcebede0ca3d012786b9ab8fd95961c637b0b4a7
> +Subproject commit c42f8ed9272222e807f94e6d2274f8c63b5bcc32




More information about the Spice-devel mailing list