Michel Dänzer <[email protected]> writes:

> From: Anthony Waters <[email protected]>
>
> The method __glamor_upload_pixmap_to_texture was updated to support a
> stride parameter for the data being uploaded to a texture.  This
> required correctly setting the alignment from 4 to a value based on the
> depth of the data and also required setting GL_UNPACK_ROW_LENGTH based
> on both the stride and the alignment.
>
> The stride parameter was also updated in glamor_put_image to be
> correctly specified, the old values would cause the xserver to crash.
> [ Michel Dänzer: squashed in follow-up fix for the stride ]
>
> Part of bug: https://bugs.freedesktop.org/show_bug.cgi?id=71813
>
> Signed-off-by: Anthony Waters <[email protected]>
> Signed-off-by: Alex Deucher <[email protected]>
> Signed-off-by: Michel Dänzer <[email protected]>
> ---
>  glamor/glamor_pixmap.c   | 38 +++++++++++++++++++++++++++++++++-----
>  glamor/glamor_putimage.c |  6 ++++--
>  2 files changed, 37 insertions(+), 7 deletions(-)
>
> diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c
> index 54b414b..8846741 100644
> --- a/glamor/glamor_pixmap.c
> +++ b/glamor/glamor_pixmap.c
> @@ -697,13 +697,38 @@ static void
>  __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
>                                    GLenum format,
>                                    GLenum type,
> -                                  int x, int y, int w, int h,
> +                                  int x, int y, int w, int h, int stride,
>                                    void *bits, int pbo)
>  {
>      glamor_screen_private *glamor_priv =
>          glamor_get_screen_private(pixmap->drawable.pScreen);
>      int non_sub = 0;
>      unsigned int iformat = 0;
> +    int bpp, alignment;
> +
> +    switch (type) {
> +    case GL_UNSIGNED_BYTE:
> +     bpp = 8;
> +     break;
> +    case GL_UNSIGNED_INT_8_8_8_8:
> +    case GL_UNSIGNED_INT_8_8_8_8_REV:
> +    case GL_UNSIGNED_INT_2_10_10_10_REV:
> +     bpp = 32;
> +     break;
> +    case GL_UNSIGNED_SHORT_5_6_5:
> +    case GL_UNSIGNED_SHORT_5_6_5_REV:
> +    case GL_UNSIGNED_SHORT_1_5_5_5_REV:
> +    case GL_UNSIGNED_SHORT_4_4_4_4_REV:
> +     bpp = 16;
> +     break;
> +    default:
> +        bpp = 0;
> +    }
> +    alignment = bpp / 8;

Why do we need this switch statement?  Isn't the type/format always the
same bits per pixel as pixmap->drawable.bitsPerPixel?

> +    if (stride == 0) {
> +        alignment = 4;
> +    }

I'd much rather see an explicit stride in the callers.

Attachment: pgpr9Wzev6Y0Q.pgp
Description: PGP signature

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to