All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] intel: Fix emit_linear_blit to use DWORD aligned width blits
@ 2010-11-06  9:23 Peter Clifton
  2010-11-08 18:17 ` [Mesa3d-dev] " Eric Anholt
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Clifton @ 2010-11-06  9:23 UTC (permalink / raw)
  To: intel-gfx, mesa3d-dev

[-- Attachment #1: Type: text/plain, Size: 333 bytes --]

Fixes corruption with glBufferSubData on my machine,

Can someone review and push?

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)
Tel: +44 (0)1223 748328 - (Shared lab phone, ask for me)

[-- Attachment #2: 0001-intel-Fix-emit_linear_blit-to-use-DWORD-aligned-widt.patch --]
[-- Type: text/x-patch, Size: 1480 bytes --]

>From 1e07dce2b9664861d92917426cbb153cc89a1c8d Mon Sep 17 00:00:00 2001
From: Peter Clifton <pcjc2@cam.ac.uk>
Date: Fri, 5 Nov 2010 14:26:24 +0000
Subject: [PATCH] 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@cam.ac.uk>
---
 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 a74e217..7118898 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,
-- 
1.7.1


[-- Attachment #3: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Mesa3d-dev] [PATCH] intel: Fix emit_linear_blit to use DWORD aligned width blits
  2010-11-06  9:23 [PATCH] intel: Fix emit_linear_blit to use DWORD aligned width blits Peter Clifton
@ 2010-11-08 18:17 ` Eric Anholt
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Anholt @ 2010-11-08 18:17 UTC (permalink / raw)
  To: Peter Clifton, intel-gfx, mesa3d-dev


[-- Attachment #1.1: Type: text/plain, Size: 192 bytes --]

On Sat, 06 Nov 2010 09:23:06 +0000, Peter Clifton <pcjc2@cam.ac.uk> wrote:
> Fixes corruption with glBufferSubData on my machine,
> 
> Can someone review and push?

Looks good.  Thanks!

[-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-08 18:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-06  9:23 [PATCH] intel: Fix emit_linear_blit to use DWORD aligned width blits Peter Clifton
2010-11-08 18:17 ` [Mesa3d-dev] " Eric Anholt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.