Re: [PATCH v7 spice-common 3/3] Add LZ4 data compression and use it in spicevmc channel

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

 



> 
> 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
> 
> Update the required protocol to 0.12.12:
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> Signed-off-by: Snir Sheriber <ssheribe@xxxxxxxxxx>
> ---
>  common/client_marshallers.h |  1 +
>  common/messages.h           |  7 +++++++
>  configure.ac                |  2 +-
>  spice.proto                 | 24 ++++++++++++++++++++++++
>  4 files changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/common/client_marshallers.h b/common/client_marshallers.h
> index 728987e..2074323 100644
> --- a/common/client_marshallers.h
> +++ b/common/client_marshallers.h
> @@ -33,6 +33,7 @@ SPICE_BEGIN_DECLS
>  typedef struct {
>      void (*msg_SpiceMsgEmpty)(SpiceMarshaller *m, SpiceMsgEmpty *msg);
>      void (*msg_SpiceMsgData)(SpiceMarshaller *m, SpiceMsgData *msg);
> +    void (*msg_SpiceMsgCompressedData)(SpiceMarshaller *m,
> SpiceMsgCompressedData *msg);
>      void (*msgc_ack_sync)(SpiceMarshaller *m, SpiceMsgcAckSync *msg);
>      void (*msgc_pong)(SpiceMarshaller *m, SpiceMsgPing *msg);
>      void (*msgc_disconnecting)(SpiceMarshaller *m, SpiceMsgDisconnect *msg);
> diff --git a/common/messages.h b/common/messages.h
> index f537950..516a345 100644
> --- a/common/messages.h
> +++ b/common/messages.h
> @@ -55,6 +55,13 @@ typedef struct SpiceMsgData {
>      uint8_t data[0];
>  } SpiceMsgData;
>  
> +typedef struct SpiceMsgCompressedData {
> +    uint8_t type;
> +    uint32_t uncompressed_size;
> +    uint32_t compressed_size;
> +    uint8_t *compressed_data;
> +} SpiceMsgCompressedData;
> +
>  typedef struct SpiceMsgEmpty {
>      uint8_t padding;
>  } SpiceMsgEmpty;
> diff --git a/configure.ac b/configure.ac
> index f8ff024..c3ad5a4 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -28,7 +28,7 @@ AM_PROG_CC_C_O
>  SPICE_CHECK_SYSDEPS
>  
>  # Checks for libraries
> -PKG_CHECK_MODULES([PROTOCOL], [spice-protocol >= 0.12.10])
> +PKG_CHECK_MODULES([PROTOCOL], [spice-protocol >= 0.12.12])
>  
>  SPICE_CHECK_PYTHON_MODULES()
>  
> diff --git a/spice.proto b/spice.proto
> index d21510d..0bfc515 100644
> --- a/spice.proto
> +++ b/spice.proto
> @@ -120,6 +120,28 @@ message Data {
>      uint8 data[] @end @ctype(uint8_t);
>  } @nocopy;
>  
> +enum8 data_compression_type {
> +    NONE,
> +    LZ4,
> +};
> +
> +struct EmptyStructure {
> +};
> +
> +message CompressedData {
> +    data_compression_type type;
> +    switch (type) {
> +    /* we cannot use !NONE (works only with flags) */
> +    case NONE:
> +        /* due to the way cases are defined after NONE we must have
> something */
> +        /* due to a bug we cannot use @virtual to write 0 to compressed_size
> */
> +        EmptyStructure empty;
> +    default:
> +        uint32 uncompressed_size;
> +    } u @anon;
> +    uint8 compressed_data[] @as_ptr(compressed_size);
> +} @ctype(SpiceMsgCompressedData);
> +
>  struct ChannelWait {
>      uint8 channel_type;
>      uint8 channel_id;
> @@ -1373,8 +1395,10 @@ channel SmartcardChannel : BaseChannel {
>  channel SpicevmcChannel : BaseChannel {
>  server:
>      Data data = 101;
> +    CompressedData compressed_data = 102;
>  client:
>      Data data = 101;
> +    CompressedData compressed_data = 102;
>  };
>  
>  channel UsbredirChannel : SpicevmcChannel {

Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://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]