From patchwork Mon Jun 6 03:36:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chad Versace X-Patchwork-Id: 850592 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 p563beTk008558 for ; Mon, 6 Jun 2011 03:38:01 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 66EE59ED2C for ; Sun, 5 Jun 2011 20:37:40 -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 155279EFA7 for ; Sun, 5 Jun 2011 20:36:59 -0700 (PDT) Received: from localhost (c-76-105-164-10.hsd1.or.comcast.net [76.105.164.10]) by cloud01.chad-versace.us (Postfix) with ESMTPSA id CDD491D4078; Mon, 6 Jun 2011 03:38:45 +0000 (UTC) From: Chad Versace To: intel-gfx@lists.freedesktop.org Date: Sun, 5 Jun 2011 20:36:06 -0700 Message-Id: <1307331367-524-3-git-send-email-chad@chad-versace.us> X-Mailer: git-send-email 1.7.5.2 In-Reply-To: <1307331367-524-1-git-send-email-chad@chad-versace.us> References: <1307331367-524-1-git-send-email-chad@chad-versace.us> MIME-Version: 1.0 Subject: [Intel-gfx] =?utf-8?q?=5BPATCH_2/3=5D_dri=3A_Do_not_create_DRI2_b?= =?utf-8?q?uffers_for_unrecognized_DRI2_buffer_tokens?= 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.6 (demeter1.kernel.org [140.211.167.41]); Mon, 06 Jun 2011 03:38:01 +0000 (UTC) X-MIME-Autoconverted: from base64 to 8bit by demeter1.kernel.org id p563beTk008558 Before this commit, if a client were to request an unrecognized DRI2 buffer, such as DRI2BufferStencil, then I830DRI2CreateBuffer() allocated and returned an X-tiled buffer by accident. The problem was that unrecognized tokens were caught by the default case of a switch statement. Now, when given unrecognized DRI2 tokens, I830DRI2CreateBuffers() returns null. This shouldn't break older Mesa versions, because they never query (via DRI2GetBuffersWithFormat) for the drawable's DRI2BufferStencil. CC: Eric Anholt CC: Ian Romanick CC: Kristian Høgsberg CC: Kenneth Graunke Signed-off-by: Chad Versace --- src/intel_dri.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/intel_dri.c b/src/intel_dri.c index 48d0f56..4571d07 100644 --- a/src/intel_dri.c +++ b/src/intel_dri.c @@ -338,10 +338,20 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment, hint |= INTEL_CREATE_PIXMAP_TILING_Y; break; } - default: + case DRI2BufferAccum: + case DRI2BufferBackLeft: + case DRI2BufferBackRight: + case DRI2BufferFakeFrontLeft: + case DRI2BufferFakeFrontRight: + case DRI2BufferFrontLeft: + case DRI2BufferFrontRight: hint |= INTEL_CREATE_PIXMAP_TILING_X; break; - } + default: + free(privates); + free(buffer); + return NULL; + } } pixmap = screen->CreatePixmap(screen,