summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorRichard Sandiford <[email protected]>2013-06-18 16:41:43 +0100
committerIan Romanick <[email protected]>2013-07-03 12:30:08 -0700
commitcda92f5191cd2ed4782dbdd41143d520857861c9 (patch)
treeec41d712d7b861406304756135b00db3e9317f88 /src/gallium
parent5412ae63dca1b1a6c43fccb5bafe56a0cd9c9a88 (diff)
st/dri/sw: Fix pitch calculation in drisw_update_tex_buffer
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. NOTE: This is a candidate for the stable branches. [ajax: fixed typo in comment] Reviewed-by: Stéphane Marchesin <[email protected]> Signed-off-by: Richard Sandiford <[email protected]> (cherry picked from commit 5a0556f061d9db00dd7637433d393beead3b3d85)
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/dri/sw/drisw.c5
1 files 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 7a5f79716c0..41f66d5e4d4 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 pitch rounded up to 4 bytes. */
+ ximage_stride = ((w * cpp) + 3) & -4;
for (line = h-1; line; --line) {
memmove(&map[line * transfer->stride],
&map[line * ximage_stride],