[Mesa-dev] [PATCH 2/2] st/xlib: Fix XImage stride calculation

Brian Paul brianp at vmware.com
Fri Jun 14 06:17:05 PDT 2013


On 06/14/2013 04:11 AM, Richard Sandiford wrote:
> Fixes window skew seen while running gnome on a 16-bit screen over vnc.
>
> Signed-off-by: Richard Sandiford <rsandifo at linux.vnet.ibm.com>
> ---
>   src/gallium/state_trackers/glx/xlib/xm_api.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
> index 36ebb46..ca717bd 100644
> --- a/src/gallium/state_trackers/glx/xlib/xm_api.c
> +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
> @@ -1381,7 +1381,7 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer,
>         enum pipe_format internal_format = res->format;
>         struct pipe_transfer *tex_xfer;
>         char *map;
> -      int line, ximage_stride;
> +      int line, byte_width;
>         XImage *img;
>
>         internal_format = choose_pixel_format(drawable->xm_visual);
> @@ -1408,12 +1408,12 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer,
>         }
>
>         /* The pipe transfer has a pitch rounded up to the nearest 64 pixels.  */
> -      ximage_stride = w * ((img->bits_per_pixel + 7) / 8);
> +      byte_width = w * ((img->bits_per_pixel + 7) / 8);
>
>         for (line = 0; line < h; line++)
>            memcpy(&map[line * tex_xfer->stride],
> -                &img->data[line * ximage_stride],
> -                ximage_stride);
> +                &img->data[line * img->bytes_per_line],
> +                byte_width);
>
>         pipe_transfer_unmap(pipe, tex_xfer);
>
>

For both, Reviewed-by: Brian Paul <brianp at vmware.com>

Should probably be tagged as candidates for the stable branch.



More information about the mesa-dev mailing list