summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <r.sandiford@uk.ibm.com>2013-06-17 12:10:49 -0400
committerIan Romanick <ian.d.romanick@intel.com>2013-07-03 12:29:25 -0700
commit2cfc0072a80cfd9503be7e57a1d8375d64d7eb98 (patch)
tree7e9bcd466a9d1f62da25c155c306f0ff0bdd41da
parent307a703c759263bb37285b0919721ff2c413fc56 (diff)
st/xlib Fix XIMage bytes-per-pixel calculation
Fixes a crash seen while running gnome on a 16-bit screen over vnc. NOTE: This is a candidate for stable release branches. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com> (cherry picked from commit 876fefe2ff8901ae4b908cff89ac5dd4324f4fe5)
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 5c6d6a73005..4f99e23131c 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -1392,9 +1392,8 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer,
return;
}
- /* The pipe transfer has a pitch rounded up to the nearest 64 pixels.
- We assume 32 bit pixels. */
- ximage_stride = w * 4;
+ /* The pipe transfer has a pitch rounded up to the nearest 64 pixels. */
+ ximage_stride = w * ((img->bits_per_pixel + 7) / 8);
for (line = 0; line < h; line++)
memcpy(&map[line * tex_xfer->stride],