From patchwork Fri Nov 22 13:52:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 3222591 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8287D9F3A0 for ; Fri, 22 Nov 2013 13:53:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A93E520795 for ; Fri, 22 Nov 2013 13:52:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B89FB2079E for ; Fri, 22 Nov 2013 13:52:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8E8DBFABB1; Fri, 22 Nov 2013 05:52:45 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from keithp.com (home.keithp.com [63.227.221.253]) by gabe.freedesktop.org (Postfix) with ESMTP id B748EFAA78; Fri, 22 Nov 2013 05:52:38 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by keithp.com (Postfix) with ESMTP id 6FB6A1488006; Fri, 22 Nov 2013 05:52:38 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at keithp.com Received: from keithp.com ([127.0.0.1]) by localhost (keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 6X7r4K7mxQc7; Fri, 22 Nov 2013 05:52:35 -0800 (PST) Received: by keithp.com (Postfix, from userid 1033) id 454211488007; Fri, 22 Nov 2013 05:52:31 -0800 (PST) Received: from miki.keithp.com (localhost [127.0.0.1]) by keithp.com (Postfix) with ESMTP id BE07615803D; Fri, 22 Nov 2013 05:52:31 -0800 (PST) Received: by miki.keithp.com (Postfix, from userid 1001) id 4AC8C9E1; Fri, 22 Nov 2013 05:52:31 -0800 (PST) From: Keith Packard To: mesa-dev@lists.freedesktop.org Subject: [PATCH 1/2] i965: Correct check for re-bound buffer in intel_update_image_buffer Date: Fri, 22 Nov 2013 05:52:26 -0800 Message-Id: <1385128347-17777-2-git-send-email-keithp@keithp.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1385128347-17777-1-git-send-email-keithp@keithp.com> References: <1385128347-17777-1-git-send-email-keithp@keithp.com> Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The buffer-object is the persistent thing passed through the loader, so when updating an image buffer, check to see if it is already bound to the provided bo. The region, on the other hand, is allocated separately for the miptree, and so will never be the same as that passed back from the loader. Signed-off-by: Keith Packard --- src/mesa/drivers/dri/i965/brw_context.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index bee98e3..64ff855 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -1339,10 +1339,21 @@ intel_update_image_buffer(struct brw_context *intel, unsigned num_samples = rb->Base.Base.NumSamples; - if (rb->mt && - rb->mt->region && - rb->mt->region == region) - return; + /* Check and see if we're already bound to the right + * buffer object + */ + if (num_samples == 0) { + if (rb->mt && + rb->mt->region && + rb->mt->region->bo == region->bo) + return; + } else { + if (rb->mt && + rb->mt->singlesample_mt && + rb->mt->singlesample_mt->region && + rb->mt->singlesample_mt->region->bo == region->bo) + return; + } intel_miptree_release(&rb->mt); rb->mt = intel_miptree_create_for_image_buffer(intel,