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

Frediano Ziglio fziglio at redhat.com
Tue Feb 2 16:58:19 CET 2016


> 
> From: Jonathon Jongsma <jjongsma at redhat.com>
> 
> Also required adding reds_get_jpeg_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 dae5e6b..0549047 100644
> --- a/server/red-worker.c
> +++ b/server/red-worker.c
> @@ -1507,7 +1507,7 @@ RedWorker* red_worker_new(QXLInstance *qxl,
> RedDispatcher *red_dispatcher)
>      }
>  
>      worker->image_compression = spice_server_get_image_compression(reds);
> -    worker->jpeg_state = jpeg_state;
> +    worker->jpeg_state = reds_get_jpeg_state(reds);
>      worker->zlib_glz_state = zlib_glz_state;
>      worker->driver_cap_monitors_config = 0;
>  #ifdef RED_STATISTICS
> diff --git a/server/reds-private.h b/server/reds-private.h
> index 7b8159f..5d080c9 100644
> --- a/server/reds-private.h
> +++ b/server/reds-private.h
> @@ -219,6 +219,7 @@ struct RedsState {
>      int ticketing_enabled;
>      uint32_t streaming_video;
>      SpiceImageCompression image_compression;
> +    spice_wan_compression_t jpeg_state;
>  };
>  
>  #endif
> diff --git a/server/reds.c b/server/reds.c
> index c6ffd56..129a9c7 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -145,7 +145,6 @@ static SpiceCoreInterfaceInternal core_interface_adapter
> = {
>  
>  static pthread_mutex_t *lock_cs;
>  static long *lock_count;
> -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;
>  int agent_copypaste = TRUE;
> @@ -3435,6 +3434,7 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
>      reds->ticketing_enabled = TRUE; /* ticketing enabled by default */
>      reds->streaming_video = SPICE_STREAM_VIDEO_FILTER;
>      reds->image_compression = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
> +    reds->jpeg_state = SPICE_WAN_COMPRESSION_AUTO;
>      return reds;
>  }
>  
> @@ -3695,7 +3695,7 @@ SPICE_GNUC_VISIBLE int
> spice_server_set_jpeg_compression(SpiceServer *s, spice_w
>          return -1;
>      }
>      // todo: support dynamically changing the state
> -    jpeg_state = comp;
> +    s->jpeg_state = comp;
>      return 0;
>  }
>  
> @@ -4028,3 +4028,8 @@ GArray* reds_get_renderers(RedsState *reds)
>  {
>      return reds->renderers;
>  }
> +
> +spice_wan_compression_t reds_get_jpeg_state(RedsState *reds)
> +{
> +    return reds->jpeg_state;
> +}
> diff --git a/server/reds.h b/server/reds.h
> index 5c8a8a5..fb17ec8 100644
> --- a/server/reds.h
> +++ b/server/reds.h
> @@ -73,7 +73,6 @@ enum {
>  };
>  
>  extern struct SpiceCoreInterfaceInternal *core;
> -extern spice_wan_compression_t jpeg_state;
>  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(RedsState *reds);
>  
>  #endif

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

Frediano


More information about the Spice-devel mailing list