[Spice-devel] [PATCH 03/18] move calc_compression_level to reds

Fabiano Fidêncio ffidenci at redhat.com
Mon Feb 15 22:40:21 UTC 2016


On Mon, 2016-02-15 at 16:01 +0000, Frediano Ziglio wrote:
> Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/red-dispatcher.c | 18 +++---------------
>  server/reds.c           | 12 ++++++++++++
>  server/reds.h           |  1 +
>  3 files changed, 16 insertions(+), 15 deletions(-)
> 
> diff --git a/server/red-dispatcher.c b/server/red-dispatcher.c
> index 3061735..9ec760f 100644
> --- a/server/red-dispatcher.c
> +++ b/server/red-dispatcher.c
> @@ -682,22 +682,10 @@ static void
> qxl_worker_loadvm_commands(QXLWorker *qxl_worker,
>      red_dispatcher_loadvm_commands((RedDispatcher*)qxl_worker, ext,
> count);
>  }
>  
> -static inline int calc_compression_level(void)
> -{
> -    spice_assert(reds_get_streaming_video(reds) !=
> SPICE_STREAM_VIDEO_INVALID);
> -
> -    if ((reds_get_streaming_video(reds) != SPICE_STREAM_VIDEO_OFF)
> ||
> -        (spice_server_get_image_compression(reds) !=
> SPICE_IMAGE_COMPRESSION_QUIC)) {
> -        return 0;
> -    } else {
> -        return 1;
> -    }
> -}
> -
>  void red_dispatcher_on_ic_change(void)
>  {
>      RedWorkerMessageSetCompression payload;
> -    int compression_level = calc_compression_level();
> +    int compression_level = calc_compression_level(reds);
>      RedDispatcher *now = dispatchers;
>  
>      while (now) {
> @@ -713,7 +701,7 @@ void red_dispatcher_on_ic_change(void)
>  void red_dispatcher_on_sv_change(void)
>  {
>      RedWorkerMessageSetStreamingVideo payload;
> -    int compression_level = calc_compression_level();
> +    int compression_level = calc_compression_level(reds);
>      RedDispatcher *now = dispatchers;
>      while (now) {
>          now->qxl->st->qif->set_compression_level(now->qxl,
> compression_level);
> @@ -1093,7 +1081,7 @@ void red_dispatcher_init(QXLInstance *qxl)
>      dispatchers = red_dispatcher;
>  
>      qxl->st->qif->attache_worker(qxl, &red_dispatcher->base);
> -    qxl->st->qif->set_compression_level(qxl,
> calc_compression_level());
> +    qxl->st->qif->set_compression_level(qxl,
> calc_compression_level(reds));
>  }
>  
>  struct Dispatcher *red_dispatcher_get_dispatcher(RedDispatcher
> *red_dispatcher)
> diff --git a/server/reds.c b/server/reds.c
> index e621a25..418f89a 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -4042,3 +4042,15 @@ SpiceCoreInterfaceInternal*
> reds_get_core_interface(RedsState *reds)
>  {
>      return reds->core;
>  }
> +
> +int calc_compression_level(RedsState *reds)
> +{
> +    spice_assert(reds_get_streaming_video(reds) !=
> SPICE_STREAM_VIDEO_INVALID);
> +
> +    if ((reds_get_streaming_video(reds) != SPICE_STREAM_VIDEO_OFF)
> ||
> +        (spice_server_get_image_compression(reds) !=
> SPICE_IMAGE_COMPRESSION_QUIC)) {
> +        return 0;
> +    } else {
> +        return 1;
> +    }
> +}
> diff --git a/server/reds.h b/server/reds.h
> index 6caed73..df34a88 100644
> --- a/server/reds.h
> +++ b/server/reds.h
> @@ -111,5 +111,6 @@ uint32_t reds_get_streaming_video(const RedsState
> *reds);
>  spice_wan_compression_t reds_get_jpeg_state(const RedsState *reds);
>  spice_wan_compression_t reds_get_zlib_glz_state(const RedsState
> *reds);
>  SpiceCoreInterfaceInternal* reds_get_core_interface(RedsState
> *reds);
> +int calc_compression_level(RedsState *reds);
>  
>  #endif

Acked-by: Fabiano Fidêncio <fidencio at redhat.com>


More information about the Spice-devel mailing list