[Spice-devel] [PATCH spice-server 1/2] red_worker: fix sending internal images with stride > bpp*width to lz compression

Hans de Goede hdegoede at redhat.com
Wed Nov 28 12:00:25 PST 2012


Looks good,

ACK series.

Regards,

Hans


On 11/28/2012 08:10 PM, Yonit Halperin wrote:
> rhbz#876685
>
> The current lz implementation does not support such bitmaps.
> The following patch will actually prevent allocating stride > bpp*width
> for internal images.
> ---
>   server/red_worker.c | 26 +++++++++++++-------------
>   1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 54cad53..9bab003 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -8607,20 +8607,20 @@ static void red_marshall_image(RedChannelClient *rcc, SpiceMarshaller *m, ImageI
>
>       comp_mode = display_channel->common.worker->image_compression;
>
> -    if ((comp_mode == SPICE_IMAGE_COMPRESS_AUTO_LZ) ||
> -        (comp_mode == SPICE_IMAGE_COMPRESS_AUTO_GLZ)) {
> +    if (((comp_mode == SPICE_IMAGE_COMPRESS_AUTO_LZ) ||
> +        (comp_mode == SPICE_IMAGE_COMPRESS_AUTO_GLZ)) && !_stride_is_extra(&bitmap)) {
> +
>           if (BITMAP_FMT_HAS_GRADUALITY(item->image_format)) {
> -            if (!_stride_is_extra(&bitmap)) {
> -                BitmapGradualType grad_level;
> -                grad_level = _get_bitmap_graduality_level(display_channel->common.worker,
> -                                                          &bitmap,
> -                                                          worker->mem_slots.internal_groupslot_id);
> -                if (grad_level == BITMAP_GRADUAL_HIGH) {
> -                    // if we use lz for alpha, the stride can't be extra
> -                    lossy_comp = display_channel->enable_jpeg && item->can_lossy;
> -                } else {
> -                    lz_comp = TRUE;
> -                }
> +            BitmapGradualType grad_level;
> +
> +            grad_level = _get_bitmap_graduality_level(display_channel->common.worker,
> +                                                      &bitmap,
> +                                                      worker->mem_slots.internal_groupslot_id);
> +            if (grad_level == BITMAP_GRADUAL_HIGH) {
> +                // if we use lz for alpha, the stride can't be extra
> +                lossy_comp = display_channel->enable_jpeg && item->can_lossy;
> +            } else {
> +                lz_comp = TRUE;
>               }
>           } else {
>               lz_comp = TRUE;
>


More information about the Spice-devel mailing list