[Spice-devel] [PATCH 07/18] Move zlib_glz_state to RedsState struct

Frediano Ziglio fziglio at redhat.com
Wed Feb 3 15:45:31 CET 2016


> 
> From: Jonathon Jongsma <jjongsma at redhat.com>
> 
> Also required adding reds_get_zlib_glz_state() for external access.
> ---
>  server/red-worker.c   | 2 +-
>  server/reds-private.h | 1 +
>  server/reds.c         | 9 +++++++--
>  server/reds.h         | 2 +-
>  4 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/server/red-worker.c b/server/red-worker.c
> index 0549047..a22aa48 100644
> --- a/server/red-worker.c
> +++ b/server/red-worker.c
> @@ -1508,7 +1508,7 @@ RedWorker* red_worker_new(QXLInstance *qxl,
> RedDispatcher *red_dispatcher)
>  
>      worker->image_compression = spice_server_get_image_compression(reds);
>      worker->jpeg_state = reds_get_jpeg_state(reds);
> -    worker->zlib_glz_state = zlib_glz_state;
> +    worker->zlib_glz_state = reds_get_zlib_glz_state(reds);
>      worker->driver_cap_monitors_config = 0;
>  #ifdef RED_STATISTICS
>      char worker_str[20];
> diff --git a/server/reds-private.h b/server/reds-private.h
> index 67fada9..a32a016 100644
> --- a/server/reds-private.h
> +++ b/server/reds-private.h
> @@ -219,6 +219,7 @@ struct RedsState {
>      uint32_t streaming_video;
>      SpiceImageCompression image_compression;
>      spice_wan_compression_t jpeg_state;
> +    spice_wan_compression_t zlib_glz_state;
>  };
>  
>  #endif
> diff --git a/server/reds.c b/server/reds.c
> index 4cbfde4..19ee54b 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -146,7 +146,6 @@ static SpiceCoreInterfaceInternal core_interface_adapter
> = {
>  
>  static pthread_mutex_t *lock_cs;
>  static long *lock_count;
> -spice_wan_compression_t zlib_glz_state = SPICE_WAN_COMPRESSION_AUTO;
>  int agent_mouse = TRUE;
>  int agent_copypaste = TRUE;
>  int agent_file_xfer = TRUE;
> @@ -3428,6 +3427,7 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
>      reds->streaming_video = SPICE_STREAM_VIDEO_FILTER;
>      reds->image_compression = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
>      reds->jpeg_state = SPICE_WAN_COMPRESSION_AUTO;
> +    reds->zlib_glz_state = SPICE_WAN_COMPRESSION_AUTO;
>      return reds;
>  }
>  
> @@ -3700,7 +3700,7 @@ SPICE_GNUC_VISIBLE int
> spice_server_set_zlib_glz_compression(SpiceServer *s, spi
>          return -1;
>      }
>      // todo: support dynamically changing the state
> -    zlib_glz_state = comp;
> +    s->zlib_glz_state = comp;
>      return 0;
>  }
>  
> @@ -4025,3 +4025,8 @@ spice_wan_compression_t reds_get_jpeg_state(const
> RedsState *reds)
>  {
>      return reds->jpeg_state;
>  }
> +
> +spice_wan_compression_t reds_get_zlib_glz_state(RedsState *reds)

I don't think is any harm if we use const RedsState* here.

> +{
> +    return reds->zlib_glz_state;
> +}
> diff --git a/server/reds.h b/server/reds.h
> index e62f0ba..ae9aef4 100644
> --- a/server/reds.h
> +++ b/server/reds.h
> @@ -73,7 +73,6 @@ enum {
>  };
>  
>  extern struct SpiceCoreInterfaceInternal *core;
> -extern spice_wan_compression_t zlib_glz_state;
>  
>  // Temporary measures to make splitting reds.c to inputs-channel.c easier
>  
> @@ -112,5 +111,6 @@ void reds_on_char_device_state_destroy(RedsState *reds,
> SpiceCharDeviceState *de
>  void reds_set_client_mm_time_latency(RedsState *reds, RedClient *client,
>  uint32_t latency);
>  uint32_t reds_get_streaming_video(RedsState *reds);
>  spice_wan_compression_t reds_get_jpeg_state(const RedsState *reds);
> +spice_wan_compression_t reds_get_zlib_glz_state(RedsState *reds);
>  
>  #endif

Beside that

Acked-by: Frediano Ziglio <fziglio at redhat.com>

Frediano


More information about the Spice-devel mailing list