From patchwork Tue Jul 19 00:08:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chad Versace X-Patchwork-Id: 987942 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6J0AN0D002051 for ; Tue, 19 Jul 2011 00:10:43 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 459FC9E7FF for ; Mon, 18 Jul 2011 17:10:23 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from cloud01.chad-versace.us (184-106-247-128.static.cloud-ips.com [184.106.247.128]) by gabe.freedesktop.org (Postfix) with ESMTP id 90E499E8DD; Mon, 18 Jul 2011 17:08:49 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by cloud01.chad-versace.us (Postfix) with ESMTP id 131401D4222; Tue, 19 Jul 2011 00:11:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at static.cloud-ips.com X-Spam-Flag: NO X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-1 tagged_above=-100 required=5 tests=[ALL_TRUSTED=-1] autolearn=ham Received: from cloud01.chad-versace.us ([127.0.0.1]) by localhost (cloud01.static.cloud-ips.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zEszW6yFzXvp; Tue, 19 Jul 2011 00:11:12 +0000 (UTC) Received: from localhost (unknown [64.122.13.55]) by cloud01.chad-versace.us (Postfix) with ESMTPSA id B444B1D424F; Tue, 19 Jul 2011 00:11:11 +0000 (UTC) From: Chad Versace To: intel-gfx@lists.freedesktop.org, mesa-dev@lists.freedesktop.org Date: Mon, 18 Jul 2011 17:08:34 -0700 Message-Id: <1311034115-4191-2-git-send-email-chad@chad-versace.us> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1311034115-4191-1-git-send-email-chad@chad-versace.us> References: <1311034115-4191-1-git-send-email-chad@chad-versace.us> Cc: Chad Versace , Ian Romancik Subject: [Intel-gfx] [PATCH] dri: Do not tile stencil buffer 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: , MIME-Version: 1.0 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.6 (demeter2.kernel.org [140.211.167.43]); Tue, 19 Jul 2011 00:10:43 +0000 (UTC) Until now, the stencil buffer was allocated as a Y tiled buffer, because in several locations the PRM states that it is. However, it is actually W tiled. From the PRM, 2011 Sandy Bridge, Volume 1, Part 2, Section 4.5.2.1 W-Major Format: W-Major Tile Format is used for separate stencil. The GTT is incapable of W fencing, so we allocate the stencil buffer with I915_TILING_NONE and decode the tile's layout in software. This commit mutually depends on the mesa commit: intel: Fix stencil buffer to be W tiled Author: Chad Versace Date: Mon Jul 18 00:37:45 2011 -0700 CC: Eric Anholt CC: Kenneth Graunke CC: Ian Romancik Signed-off-by: Chad Versace Acked-by: Kenneth Graunke --- src/intel_dri.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/intel_dri.c b/src/intel_dri.c index 1269422..90abe5f 100644 --- a/src/intel_dri.c +++ b/src/intel_dri.c @@ -335,7 +335,6 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment, switch (attachment) { case DRI2BufferDepth: case DRI2BufferDepthStencil: - case DRI2BufferStencil: case DRI2BufferHiz: if (SUPPORTS_YTILING(intel)) { hint |= INTEL_CREATE_PIXMAP_TILING_Y; @@ -350,6 +349,14 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment, case DRI2BufferFrontRight: hint |= INTEL_CREATE_PIXMAP_TILING_X; break; + case DRI2BufferStencil: + /* + * The stencil buffer is W tiled. However, we + * request from the kernel a non-tiled buffer + * because the GTT is incapable of W fencing. + */ + hint |= INTEL_CREATE_PIXMAP_TILING_NONE; + break; default: free(privates); free(buffer); @@ -367,11 +374,12 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment, * To accomplish this, we resort to the nasty hack of doubling * the drm region's cpp and halving its height. * - * If we neglect to double the pitch, then - * drm_intel_gem_bo_map_gtt() maps the memory incorrectly. + * If we neglect to double the pitch, then render corruption + * occurs. */ if (attachment == DRI2BufferStencil) { - pixmap_height /= 2; + pixmap_width = ALIGN(pixmap_width, 64); + pixmap_height = ALIGN((pixmap_height + 1) / 2, 64); pixmap_cpp *= 2; }