From patchwork Sat Nov 6 10:04:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Clifton X-Patchwork-Id: 305472 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA6A7ISk002603 for ; Sat, 6 Nov 2010 10:07:39 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AB4779ED84 for ; Sat, 6 Nov 2010 03:07:18 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org 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) X-Cam-AntiVirus: no malware found X-Cam-SpamDetails: not scanned X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from client-86-31-29-41.midd.adsl.virginmedia.com ([86.31.29.41]:10027 helo=[192.168.1.2]) by ppsw-52.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:465) with esmtpsa (LOGIN:pcjc2) (SSLv3:DHE-RSA-CAMELLIA256-SHA:256) id 1PEffS-00080e-Fp (Exim 4.72) (return-path ); Sat, 06 Nov 2010 10:06:39 +0000 From: Peter Clifton To: "intel-gfx@lists.freedesktop.org" , "mesa3d-dev@lists.sourceforge.net" Date: Sat, 06 Nov 2010 10:04:31 +0000 Message-ID: <1289037871.2453.3.camel@pcjc2lap> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Subject: [Intel-gfx] [PATCH] intel: Fix emit_linear_blit to use DWORD aligned width blits X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 06 Nov 2010 10:07:39 +0000 (UTC) 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