[Spice-devel] [PATCH 6/6] LZ4: Add support for 24bit pixman surfaces

Christophe Fergeau cfergeau at redhat.com
Mon Jan 26 06:15:01 PST 2015


Hey,

A bit worried to add new cases to surface_create, but it seems nothing
is going to try to pass a r8g8b8 there except for the lz4 code, so ACK
with the last hunk removed (whitespace change in alloc_lz_surface).

Christophe

On Thu, Jan 22, 2015 at 05:21:24PM +0100, Javier Celaya wrote:
> ---
>  common/canvas_base.c  |  4 ++++
>  common/canvas_utils.c | 10 +++++++++-
>  2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/common/canvas_base.c b/common/canvas_base.c
> index 170def1..107d056 100644
> --- a/common/canvas_base.c
> +++ b/common/canvas_base.c
> @@ -584,6 +584,10 @@ static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image, int
>              stride_encoded *= 2;
>              break;
>          case SPICE_BITMAP_FMT_24BIT:
> +            format = PIXMAN_r8g8b8;
> +            stride_encoded *= 3;
> +            spice_warning("24bit bitmap");
> +            break;
>          case SPICE_BITMAP_FMT_32BIT:
>              format = PIXMAN_x8r8g8b8;
>              stride_encoded *= 4;
> diff --git a/common/canvas_utils.c b/common/canvas_utils.c
> index d52292b..789cd76 100644
> --- a/common/canvas_utils.c
> +++ b/common/canvas_utils.c
> @@ -165,6 +165,10 @@ pixman_image_t * surface_create(pixman_format_code_t format, int width, int heig
>              bitmap_info.inf.bmiHeader.biBitCount = 32;
>              nstride = width * 4;
>              break;
> +        case PIXMAN_r8g8b8:
> +            bitmap_info.inf.bmiHeader.biBitCount = 24;
> +            nstride = SPICE_ALIGN(width * 3, 4);
> +            break;
>          case PIXMAN_x1r5g5b5:
>          case PIXMAN_r5g6b5:
>              bitmap_info.inf.bmiHeader.biBitCount = 16;
> @@ -233,6 +237,10 @@ pixman_image_t * surface_create(pixman_format_code_t format, int width, int heig
>          case PIXMAN_x8r8g8b8:
>              stride = width * 4;
>              break;
> +        case PIXMAN_r8g8b8:
> +            // NOTE: LZ4 also decodes to RGB24
> +            stride = SPICE_ALIGN(width * 3, 4);
> +            break;
>          case PIXMAN_x1r5g5b5:
>          case PIXMAN_r5g6b5:
>              stride = SPICE_ALIGN(width * 2, 4);
> @@ -285,7 +293,7 @@ pixman_image_t *alloc_lz_image_surface(LzDecodeUsrData *canvas_data,
>  
>      /* pixman requires strides to be 4-byte aligned */
>      stride = SPICE_ALIGN(stride, 4);
> -    
> +
>      if (!top_down) {
>          stride = -stride;
>      }
> -- 
> 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/20150126/a200e9e6/attachment.sig>


More information about the Spice-devel mailing list