[Mesa-dev] [PATCH] st/dri/sw: Fix pitch calculation in drisw_update_tex_buffer

Stéphane Marchesin stephane.marchesin at gmail.com
Wed Jun 19 23:16:48 PDT 2013


On Tue, Jun 18, 2013 at 8:41 AM, Richard Sandiford
<rsandifo at linux.vnet.ibm.com> wrote:
> swrastGetImage rounds the pitch up to 4 bytes for compatibility reasons
> that are explained in drisw_glx.c:bytes_per_line, so drisw_update_tex_buffer
> must do the same.
>
> Fixes window skew seen while running firefox over vnc on a 16-bit screen.
>
> Signed-off-by: Richard Sandiford <rsandifo at linux.vnet.ibm.com>
> ---
>  src/gallium/state_trackers/dri/sw/drisw.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c
> index 7a5f797..f9fddf7 100644
> --- a/src/gallium/state_trackers/dri/sw/drisw.c
> +++ b/src/gallium/state_trackers/dri/sw/drisw.c
> @@ -265,8 +265,9 @@ drisw_update_tex_buffer(struct dri_drawable *drawable,
>     /* Copy the Drawable content to the mapped texture buffer */
>     get_image(dPriv, x, y, w, h, map);
>
> -   /* The pipe transfer has a pitch rounded up to the nearest 64 pixels. */
> -   ximage_stride = w * cpp;
> +   /* The pipe transfer has a pitch rounded up to the nearest 64 pixels.
> +      get_image() has a patch rounded up to 4 bytes.  */

"has a pitch"

Other than that:
Reviewed-by: Stéphane Marchesin <marcheu at chromium.org>

> +   ximage_stride = ((w * cpp) + 3) & -4;
>     for (line = h-1; line; --line) {
>        memmove(&map[line * transfer->stride],
>                &map[line * ximage_stride],
> --
> 1.7.11.7
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list