i965: Fix handling of MESA_pack_invert in blit (PBO) readpixels.
authorEric Anholt <eric@anholt.net>
Mon, 23 Dec 2013 20:11:25 +0000 (12:11 -0800)
committerEric Anholt <eric@anholt.net>
Thu, 9 Jan 2014 07:30:33 +0000 (15:30 +0800)
Fixes piglit GL_MESA_pack_invert/readpixels and GPU hangs with glamor and
cairo-gl.

Cc: 10.0 9.2 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
src/mesa/drivers/dri/i965/intel_pixel_read.c

index 0f6d2aaa38724d98072e9af95c0d2b685d49fafc..2c85811841c24e0d4866e9800d555fd4117b48b1 100644 (file)
@@ -106,13 +106,15 @@ do_blit_readpixels(struct gl_context * ctx,
    /* Mesa flips the dst_stride for pack->Invert, but we want our mt to have a
     * normal dst_stride.
     */
+   struct gl_pixelstore_attrib uninverted_pack = *pack;
    if (pack->Invert) {
       dst_stride = -dst_stride;
       dst_flip = true;
+      uninverted_pack.Invert = false;
    }
 
    dst_offset = (GLintptr)pixels;
-   dst_offset += _mesa_image_offset(2, pack, width, height,
+   dst_offset += _mesa_image_offset(2, &uninverted_pack, width, height,
                                    format, type, 0, 0, 0);
 
    if (!_mesa_clip_copytexsubimage(ctx,