[Spice-devel] [PATCH spice-server v2 2/2] Handle preferred image compression messages

Christophe Fergeau cfergeau at redhat.com
Tue Jun 2 05:33:35 PDT 2015


My last remaining comment about this patch is that now the client can
force the server to use a given compression method. This is something
the server admin might not want to allow (think "too expensive
compression methods).
Maybe image_compression should default to SPICE_IMAGE_COMPRESS_DEFAULT
rather than _AUTO_GLZ, and we should only allow
display_channel_handle_preferred_compression() to override
COMPRESS_DEFAULT, but not other values?

Christophe

On Mon, Jun 01, 2015 at 04:48:16PM +0200, Javier Celaya wrote:
> ---
>  server/red_dispatcher.c |  1 +
>  server/red_worker.c     | 25 +++++++++++++++++++++++++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
> index 4965a97..312b4f7 100644
> --- a/server/red_dispatcher.c
> +++ b/server/red_dispatcher.c
> @@ -1154,6 +1154,7 @@ void red_dispatcher_init(QXLInstance *qxl)
>          red_channel_set_data(display_channel, red_dispatcher);
>          red_channel_set_cap(display_channel, SPICE_DISPLAY_CAP_MONITORS_CONFIG);
>          red_channel_set_cap(display_channel, SPICE_DISPLAY_CAP_STREAM_REPORT);
> +        red_channel_set_cap(display_channel, SPICE_DISPLAY_CAP_PREF_COMPRESSION);
>          reds_register_channel(display_channel);
>      }
>  
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 29d6d6d..af2f1d6 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -10276,6 +10276,27 @@ static int display_channel_handle_stream_report(DisplayChannelClient *dcc,
>      return TRUE;
>  }
>  
> +static int display_channel_handle_preferred_compression(DisplayChannelClient *dcc,
> +        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:
> +#ifdef USE_LZ4
> +    case SPICE_IMAGE_COMPRESS_LZ4:
> +#endif
> +    case SPICE_IMAGE_COMPRESS_LZ:
> +    case SPICE_IMAGE_COMPRESS_GLZ:
> +    case SPICE_IMAGE_COMPRESS_OFF:
> +        display_channel->common.worker->image_compression = pc->image_compression;
> +        return TRUE;
> +    default:
> +        spice_warning("preferred-compression: unsupported image compression setting");
> +        return FALSE;
> +    }
> +}
> +
>  static int display_channel_handle_message(RedChannelClient *rcc, uint32_t size, uint16_t type,
>                                            void *message)
>  {
> @@ -10292,6 +10313,10 @@ static int display_channel_handle_message(RedChannelClient *rcc, uint32_t size,
>      case SPICE_MSGC_DISPLAY_STREAM_REPORT:
>          return display_channel_handle_stream_report(dcc,
>                                                      (SpiceMsgcDisplayStreamReport *)message);
> +    case SPICE_MSGC_DISPLAY_PREFERRED_COMPRESSION:
> +        return display_channel_handle_preferred_compression(dcc,
> +            (SpiceMsgcDisplayPreferredCompression *)message);
> +
>      default:
>          return red_channel_client_handle_message(rcc, size, type, message);
>      }
> -- 
> 1.9.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150602/5fc8b754/attachment.sig>


More information about the Spice-devel mailing list