[Mesa-dev] [PATCH 3/3] intel: Handle small linear blits using just the single-line code.

Eric Anholt eric at anholt.net
Wed Jan 25 17:51:05 PST 2012


Fixes piglit ARB_copy_buffer/overlap, and glean bufferObject when run
non-quick.

NOTE: This is a candidate for the 8.0 branch.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44971
---
 src/mesa/drivers/dri/intel/intel_blit.c |   40 +++++++++++++++++--------------
 1 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
index 9eacadd..c3f5964 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -487,24 +487,28 @@ intel_emit_linear_blit(struct intel_context *intel,
    GLuint pitch, height;
    bool ok;
 
-   /* The pitch given to the GPU must be DWORD aligned, and
-    * we want width to match pitch. Max width is (1 << 15 - 1),
-    * rounding that down to the nearest DWORD is 1 << 15 - 4
-    */
-   pitch = ROUND_DOWN_TO(MIN2(size, (1 << 15) - 1), 4);
-   height = size / pitch;
-   ok = intelEmitCopyBlit(intel, 1,
-			  pitch, src_bo, src_offset, I915_TILING_NONE,
-			  pitch, dst_bo, dst_offset, I915_TILING_NONE,
-			  0, 0, /* src x/y */
-			  0, 0, /* dst x/y */
-			  pitch, height, /* w, h */
-			  GL_COPY);
-   assert(ok);
-
-   src_offset += pitch * height;
-   dst_offset += pitch * height;
-   size -= pitch * height;
+   /* If we have more than can fit in a single line of copy, do that first. */
+   if (size > (1 << 15) - 3) {
+      /* The pitch given to the GPU must be DWORD aligned, and
+       * we want width to match pitch. Max width is (1 << 15 - 1),
+       * rounding that down to the nearest DWORD is 1 << 15 - 4
+       */
+      pitch = ROUND_DOWN_TO(MIN2(size, (1 << 15) - 1), 4);
+      height = size / pitch;
+      ok = intelEmitCopyBlit(intel, 1,
+			     pitch, src_bo, src_offset, I915_TILING_NONE,
+			     pitch, dst_bo, dst_offset, I915_TILING_NONE,
+			     0, 0, /* src x/y */
+			     0, 0, /* dst x/y */
+			     pitch, height, /* w, h */
+			     GL_COPY);
+      assert(ok);
+
+      src_offset += pitch * height;
+      dst_offset += pitch * height;
+      size -= pitch * height;
+   }
+
    assert (size < (1 << 15));
    pitch = ALIGN(size, 4);
    if (size != 0) {
-- 
1.7.7.3



More information about the mesa-dev mailing list