Mesa (mesa_7_5_branch): util: fix util_blit_pixels() test for surface_copy( ) path

Brian Paul brianp at kemper.freedesktop.org
Wed Aug 5 19:50:51 UTC 2009


Module: Mesa
Branch: mesa_7_5_branch
Commit: 05d393f59fdacbbe181f007efd3054966734b3b7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=05d393f59fdacbbe181f007efd3054966734b3b7

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Aug  5 13:09:15 2009 -0600

util: fix util_blit_pixels() test for surface_copy() path

For the surface_copy() path require same format, no flipping and no stretching.

Fixes progs/tests/copypixrate -blit

---

 src/gallium/auxiliary/util/u_blit.c |   40 +++++++++++++++++++++--------------
 1 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index 261a9b6..bc90813 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -268,6 +268,7 @@ setup_vertex_data_tex(struct blit_state *ctx,
 /**
  * Copy pixel block from src surface to dst surface.
  * Overlapping regions are acceptable.
+ * Flipping and stretching are supported.
  * XXX need some control over blitting Z and/or stencil.
  */
 void
@@ -294,6 +295,29 @@ util_blit_pixels(struct blit_state *ctx,
    assert(filter == PIPE_TEX_MIPFILTER_NEAREST ||
           filter == PIPE_TEX_MIPFILTER_LINEAR);
 
+   assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D,
+                                      PIPE_TEXTURE_USAGE_SAMPLER, 0));
+   assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
+                                      PIPE_TEXTURE_USAGE_SAMPLER, 0));
+
+   /*
+    * Check for simple case:  no format conversion, no flipping, no stretching.
+    */
+   if (dst->format == src->format &&
+       srcX0 < srcX1 &&
+       dstX0 < dstX1 &&
+       srcY0 < srcY1 &&
+       dstY0 < dstY1 &&
+       (dstX1 - dstX0) == (srcX1 - srcX0) &&
+       (dstY1 - dstY0) == (srcY1 - srcY0)) {
+      /* FIXME: this will most surely fail for overlapping rectangles */
+      pipe->surface_copy(pipe,
+			 dst, dstX0, dstY0, /* dest */
+			 src, srcX0, srcY0, /* src */
+			 srcW, srcH);       /* size */
+      return;
+   }
+   
    if (srcLeft != srcX0) {
       /* left-right flip */
       int tmp = dstX0;
@@ -308,22 +332,6 @@ util_blit_pixels(struct blit_state *ctx,
       dstY1 = tmp;
    }
 
-   assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D,
-                                      PIPE_TEXTURE_USAGE_SAMPLER, 0));
-   assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
-                                      PIPE_TEXTURE_USAGE_SAMPLER, 0));
-
-   if (dst->format == src->format &&
-       (dstX1 - dstX0) == srcW &&
-       (dstY1 - dstY0) == srcH) {
-      /* FIXME: this will most surely fail for overlapping rectangles */
-      pipe->surface_copy(pipe,
-			 dst, dstX0, dstY0,   /* dest */
-			 src, srcX0, srcY0, /* src */
-			 srcW, srcH);     /* size */
-      return;
-   }
-   
    assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
                                       PIPE_TEXTURE_USAGE_RENDER_TARGET, 0));
 




More information about the mesa-commit mailing list