[Spice-devel] [PATCH v7 spice-protocol] LZ4 compression is now available at the Spicevmc channel

Frediano Ziglio fziglio at redhat.com
Tue Jun 14 07:47:42 UTC 2016


> 
> -New message type for compressed messages has been added to the protocol
> 
> Compressed message type is CompressedData which contains compression
> type (1 byte) followed by the uncompressed data size (4 bytes -exists
> only if data was compressed) followed by the compressed data
> 
> -SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4 capability has been added
> 
> When both sides has the capabilty all usb redirected data will be compressed
> (only if size > threshold and AF_LOCAL socket is not in use)
> 
> To send compressed msg use SpiceMsgCompressedData type with
> spice_marshall_SpiceMsgCompressedData and then use add_ref to add the
> compressed data
> 
> Signed-off-by: Snir Sheriber <ssheribe at redhat.com>
> ---
>  spice/enums.h    | 9 +++++++++
>  spice/protocol.h | 4 ++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/spice/enums.h b/spice/enums.h
> index c6e9840..1d0c2db 100644
> --- a/spice/enums.h
> +++ b/spice/enums.h
> @@ -106,6 +106,13 @@ typedef enum SpiceMouseMode {
>      SPICE_MOUSE_MODE_MASK = 0x3
>  } SpiceMouseMode;
>  
> +typedef enum SpiceDataCompressionType {
> +    SPICE_DATA_COMPRESSION_TYPE_NONE,
> +    SPICE_DATA_COMPRESSION_TYPE_LZ4,
> +
> +    SPICE_DATA_COMPRESSION_TYPE_ENUM_END
> +} SpiceDataCompressionType;
> +
>  typedef enum SpicePubkeyType {
>      SPICE_PUBKEY_TYPE_INVALID,
>      SPICE_PUBKEY_TYPE_RSA,
> @@ -634,12 +641,14 @@ enum {
>  
>  enum {
>      SPICE_MSG_SPICEVMC_DATA = 101,
> +    SPICE_MSG_SPICEVMC_COMPRESSED_DATA,
>  
>      SPICE_MSG_END_SPICEVMC
>  };
>  
>  enum {
>      SPICE_MSGC_SPICEVMC_DATA = 101,
> +    SPICE_MSGC_SPICEVMC_COMPRESSED_DATA,
>  
>      SPICE_MSGC_END_SPICEVMC
>  };
> diff --git a/spice/protocol.h b/spice/protocol.h
> index f4a2259..d742eda 100644
> --- a/spice/protocol.h
> +++ b/spice/protocol.h
> @@ -148,6 +148,10 @@ enum {
>  };
>  
>  enum {
> +    SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4,
> +};
> +
> +enum {
>      SPICE_PORT_EVENT_OPENED,
>      SPICE_PORT_EVENT_CLOSED,
>      SPICE_PORT_EVENT_BREAK,

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

Frediano


More information about the Spice-devel mailing list