Re: [PATCH spice-gtk v3 3/3] Display: Send a preferred compression message on init.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 01, 2015 at 04:48:48PM +0200, Javier Celaya wrote:
> If the user prefers a specific compression algorithm, report it when
> setting up the display channel.
> ---
>  gtk/channel-display.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/gtk/channel-display.c b/gtk/channel-display.c
> index efe2259..b440f9b 100644
> --- a/gtk/channel-display.c
> +++ b/gtk/channel-display.c
> @@ -789,12 +789,15 @@ static void spice_display_channel_up(SpiceChannel *channel)
>      SpiceMsgOut *out;
>      SpiceSession *s = spice_channel_get_session(channel);
>      SpiceMsgcDisplayInit init;
> +    SpiceMsgcDisplayPreferredCompression pref_comp_msg;
>      int cache_size;
>      int glz_window_size;
> +    SpiceImageCompress preferred_compression = SPICE_IMAGE_COMPRESS_INVALID;
>  
>      g_object_get(s,
>                   "cache-size", &cache_size,
>                   "glz-window-size", &glz_window_size,
> +                 "preferred-compression", &preferred_compression,
>                   NULL);
>      CHANNEL_DEBUG(channel, "%s: cache_size %d, glz_window_size %d (bytes)", __FUNCTION__,
>                    cache_size, glz_window_size);
> @@ -810,6 +813,15 @@ static void spice_display_channel_up(SpiceChannel *channel)
>         this monitor */
>      if (channel->priv->channel_id != 0)
>          g_coroutine_object_notify(G_OBJECT(channel), "monitors");
> +
> +    if (spice_channel_test_capability(channel, SPICE_DISPLAY_CAP_PREF_COMPRESSION) &&
> +            preferred_compression > SPICE_IMAGE_COMPRESS_INVALID &&
> +            preferred_compression < SPICE_IMAGE_COMPRESS_ENUM_END) {

I'd deal with the "preferred_compression >=
SPICE_IMAGE_COMPRESS_ENUM_END" case with a g_warn_if_fail() as
g_param_spec_enum should guarantee that you won't get a value not
covered by the registered GEnum.

Christophe

> +        pref_comp_msg.image_compression = preferred_compression;
> +        out = spice_msg_out_new(channel, SPICE_MSGC_DISPLAY_PREFERRED_COMPRESSION);
> +        out->marshallers->msgc_display_preferred_compression(out->marshaller, &pref_comp_msg);
> +        spice_msg_out_send_internal(out);
> +    }
>  }
>  
>  #define DRAW(type) {                                                    \
> -- 
> 1.9.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: pgpk5Pvo2zxG9.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]