Bug 14313 - [i915 PBO TTM] read pixels through PBO not working when pixel alignment is 1
[i915 PBO TTM] read pixels through PBO not working when pixel alignment is 1
Status: VERIFIED FIXED
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i915
unspecified
Other Linux (All)
: medium normal
Assigned To: Eric Anholt
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-31 01:49 UTC by Shuang He
Modified: 2008-07-08 02:02 UTC (History)
1 user (show)

See Also:


Attachments
test case (2.37 KB, text/plain)
2008-01-31 01:49 UTC, Shuang He
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shuang He 2008-01-31 01:49:32 UTC
Created attachment 14048 [details]
test case

System Environment:
--------------------------
Platform: 945gm 915gm 915gv 945g
drm   
commit c6f175cbea1dba3fc26426243acc55b89b8a8064

mesa 
commit 02d5ba849197e19843dad164239b51f18fb16faf

xf86_video_intel 
commit 633dbd28218fd8a746c1735fd44a14f35bd07faa 



Bug detailed description:
--------------------------
this issue only happen when pixel alignment is 1, in GL_BGRA format, and GL_UNSIGNED_BYTE
reading 8x8 pixels back through PBO(pixel alignment is 1, in GL_BGRA format, GL_UNSIGNED_BYTE) does not return expected result. seems following patch fix this, but glean test case readpixPerf still fails(it get 1000x1000 pixels back):

diff --git a/configs/linux-dri b/configs/linux-dri
diff --git a/src/mesa/drivers/dri/i915/intel_pixel_read.c b/src/mesa/drivers/dri/i915/intel_pixel_read.c
index 2e31656..0b80309 100644
--- a/src/mesa/drivers/dri/i915/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i915/intel_pixel_read.c
@@ -222,9 +222,6 @@ do_blit_readpixels(GLcontext * ctx,
          _mesa_printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__);
       return GL_FALSE;
    }
-   else {
-      rowLength = -rowLength;
-   }

    /* XXX 64-bit cast? */
    dst_offset = (GLuint) _mesa_image_address(2, pack, pixels, width, height,

 




Reproduce steps:
----------------
start X
compile & run attach test case, or
run glean -r log -t +readpixPerf
Comment 1 Shuang He 2008-02-03 00:17:43 UTC
I missed something. Actually the original code is meant to blit copy vertically in reverse direction. but that code seems not working. and following patch change it to blit copy in normal direction. But it seems it's handling differently when the area is exceed the screen size, compared with software rendering. That's why glean case readpixPerf(read 1000x1000 area) failed when screen resolution is 1024x768:

diff --git a/src/mesa/drivers/dri/i915/intel_pixel_read.c b/src/mesa/drivers/dri/i915/intel_pixel_read.c
index 2e31656..4c6c3b4 100644
--- a/src/mesa/drivers/dri/i915/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i915/intel_pixel_read.c
@@ -222,9 +222,6 @@ do_blit_readpixels(GLcontext * ctx,
          _mesa_printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__);
       return GL_FALSE;
    }
-   else {
-      rowLength = -rowLength;
-   }

    /* XXX 64-bit cast? */
    dst_offset = (GLuint) _mesa_image_address(2, pack, pixels, width, height,
@@ -269,7 +266,7 @@ do_blit_readpixels(GLcontext * ctx,
                            rect.x1,
                            rect.y1,
                            rect.x1 - src_rect.x1,
-                           rect.y2 - src_rect.y2,
+                           rect.y1 - src_rect.y1,
                            rect.x2 - rect.x1, rect.y2 - rect.y1,
                           GL_COPY);
       }
Comment 2 Eric Anholt 2008-06-18 13:52:58 UTC
accelerated readpixels should be fixed in master on cf29ab3ba075905cca786b52617d7dc993f58033.
Comment 3 Shuang He 2008-07-08 02:02:03 UTC
verified, thanks