summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorRichard Sandiford <[email protected]>2013-06-17 12:10:49 -0400
committerAdam Jackson <[email protected]>2013-06-17 12:14:32 -0400
commit876fefe2ff8901ae4b908cff89ac5dd4324f4fe5 (patch)
tree05e169c681efd235eb77eccda6de90e97dddbd9f /src/gallium/state_trackers
parentebd68dd02998a8595cb10844c37a6b02dc3078a8 (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 <[email protected]> Signed-off-by: Richard Sandiford <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-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 b758c8eaae7..7ed401c514b 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -1407,9 +1407,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],