From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Clifton Subject: [PATCH] intel: Fix emit_linear_blit to use DWORD aligned width blits Date: Sat, 06 Nov 2010 10:04:31 +0000 Message-ID: <1289037871.2453.3.camel@pcjc2lap> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-NA27haB4/VWf69Vjd2AA" Return-path: Received: from ppsw-52.csi.cam.ac.uk (ppsw-52.csi.cam.ac.uk [131.111.8.152]) by gabe.freedesktop.org (Postfix) with ESMTP id 7A2809EEB1 for ; Sat, 6 Nov 2010 03:06:40 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: "intel-gfx@lists.freedesktop.org" , "mesa3d-dev@lists.sourceforge.net" List-Id: intel-gfx@lists.freedesktop.org --=-NA27haB4/VWf69Vjd2AA Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Fixes corruption with glBufferSubData on my machine, Can someone review and push? (Resent with code comment fixed) -- 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) --=-NA27haB4/VWf69Vjd2AA Content-Disposition: attachment; filename*0=0001-intel-Fix-emit_linear_blit-to-use-DWORD-aligned-widt.pat; filename*1=ch Content-Type: text/x-patch; name="0001-intel-Fix-emit_linear_blit-to-use-DWORD-aligned-widt.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit >>From 1e07dce2b9664861d92917426cbb153cc89a1c8d Mon Sep 17 00:00:00 2001 From: Peter Clifton 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 --- 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 --=-NA27haB4/VWf69Vjd2AA Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx --=-NA27haB4/VWf69Vjd2AA--