Mesa (7.9): intel: Fix emit_linear_blit to use DWORD aligned width blits

Ian Romanick idr at kemper.freedesktop.org
Wed Dec 15 22:06:30 UTC 2010


Module: Mesa
Branch: 7.9
Commit: 4b30da86a73666e80c4a70beb6d98b35ab6045b7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b30da86a73666e80c4a70beb6d98b35ab6045b7

Author: Peter Clifton <pcjc2 at cam.ac.uk>
Date:   Sat Nov  6 09:23:06 2010 +0000

intel: Fix emit_linear_blit to use DWORD aligned width blits

The width of the 2D blits used to copy the data is defined as a 16-bit
signed integer, but the pitch must be DWORD aligned. Limit to an integral
number of DWORDs, (1 << 15 - 4) rather than (1 << 15 -1).

Fixes corruption to data uploaded with glBufferSubData.

Signed-off-by: Peter Clifton <pcjc2 at cam.ac.uk>
(cherry picked from commit 10b9e018ca4b37c66a6e0215d4551ed74b4981a6)

---

 src/mesa/drivers/dri/intel/intel_blit.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
index 2c85ad3..38d9a09 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -483,8 +483,11 @@ intel_emit_linear_blit(struct intel_context *intel,
    /* Blits are in a different ringbuffer so we don't use them. */
    assert(intel->gen < 6);
 
-   /* The pitch is a signed value. */
-   pitch = MIN2(size, (1 << 15) - 1);
+   /* The pitch hits the GPU as a is a signed value, IN DWORDs.
+    * But we want width to match pitch. Max width is (1 << 15 - 1),
+    * rounding that down to the nearest DWORD is 1 << 15 - 4
+    */
+   pitch = MIN2(size, (1 << 15) - 4);
    height = size / pitch;
    ok = intelEmitCopyBlit(intel, 1,
 			  pitch, src_bo, src_offset, I915_TILING_NONE,




More information about the mesa-commit mailing list