summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2012-03-22 11:56:43 +0000
committerDave Airlie <[email protected]>2012-03-25 17:15:23 +0100
commitd6c5ad52b2473064f0b3e031a2e1b59480c68c43 (patch)
treec08b8b4e21793c6268e2cf9b2ee4a03d3a9cc0c4 /src
parentba3a4d79a7bad959c0d9efbe0daa8d73c281d664 (diff)
drisw: fix image stride calculation for 16-bit.
If you ran g-s in 16-bpp we'd do a bunch of memory corruption. now it just misrenders for some other reasons. applies to stable. Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/dri/sw/drisw.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c
index f5d1555b01d..c4c4264d351 100644
--- a/src/gallium/state_trackers/dri/sw/drisw.c
+++ b/src/gallium/state_trackers/dri/sw/drisw.c
@@ -253,6 +253,7 @@ drisw_update_tex_buffer(struct dri_drawable *drawable,
char *map;
int x, y, w, h;
int ximage_stride, line;
+ int cpp = util_format_get_blocksize(res->format);
get_drawable_info(dPriv, &x, &y, &w, &h);
@@ -265,9 +266,8 @@ 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.
- 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 * cpp;
for (line = h-1; line; --line) {
memmove(&map[line * transfer->stride],
&map[line * ximage_stride],