Hello,

check_color in r200_pixel.c uses following (among other things) to reject
fast downloads to GART memory:

    if (        (pitch & 63) ||

but is called (from r200TryReadPixels) in the following manner:

    if (!check_color(ctx, type, format, pack, pixels, size, pitch))
       return GL_FALSE;

where pitch was earlier defined as:

    GLint pitch = pack->RowLength ? pack->RowLength : width;

i think this is bogus, pitch should be number of bytes not pixels.

diff --git a/src/mesa/drivers/dri/r200/r200_pixel.c 
b/src/mesa/drivers/dri/r200/r200_pixel.c
index db8ceea..161d623 100644
--- a/src/mesa/drivers/dri/r200/r200_pixel.c
+++ b/src/mesa/drivers/dri/r200/r200_pixel.c
@@ -155,6 +155,7 @@ r200TryReadPixels( GLcontext *ctx,
     GLint blit_format;
     GLuint cpp = rmesa->r200Screen->cpp;
     GLint size = width * height * cpp;
+   int dst_pitch = pitch * cpp;

     if (R200_DEBUG & DEBUG_PIXEL)
        fprintf(stderr, "%s\n", __FUNCTION__);
@@ -162,7 +163,7 @@ r200TryReadPixels( GLcontext *ctx,
     /* Only accelerate reading to GART buffers.
      */
     if ( !r200IsGartMemory(rmesa, pixels,
-                        pitch * height * rmesa->r200Screen->cpp ) ) {
+                        dst_pitch * height ) ) {
        if (R200_DEBUG & DEBUG_PIXEL)
         fprintf(stderr, "%s: dest not GART\n", __FUNCTION__);
        return GL_FALSE;
@@ -177,7 +178,7 @@ r200TryReadPixels( GLcontext *ctx,
        return GL_FALSE;
     }

-   if (!check_color(ctx, type, format, pack, pixels, size, pitch))
+   if (!check_color(ctx, type, format, pack, pixels, size, dst_pitch))
        return GL_FALSE;

     switch ( rmesa->r200Screen->cpp ) {
@@ -219,7 +220,6 @@ r200TryReadPixels( GLcontext *ctx,
                     + rmesa->r200Screen->fbLocation;
        int src_pitch = drb->pitch * drb->cpp;
        int dst_offset = r200GartOffsetFromVirtual( rmesa, pixels );
-      int dst_pitch = pitch * rmesa->r200Screen->cpp;
        drm_clip_rect_t *box = dPriv->pClipRects;
        int i;


-- 
mailto:[EMAIL PROTECTED]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to