From patchwork Thu Oct 31 23:13:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 3122631 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 8F5629F3E3 for ; Thu, 31 Oct 2013 23:26:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 695FB201C0 for ; Thu, 31 Oct 2013 23:31:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5D8BF201DC for ; Thu, 31 Oct 2013 23:31:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6409EF00B0; Thu, 31 Oct 2013 16:31:33 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DAA5F00BC; Thu, 31 Oct 2013 16:31:22 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Vc1hq-0005QN-Fo; Thu, 31 Oct 2013 23:31:14 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Vc1hi-0005PV-Ns; Thu, 31 Oct 2013 23:31:06 +0000 X-ACL-Warn: Received: from home.keithp.com ([63.227.221.253] helo=keithp.com) by sog-mx-2.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1Vc1hg-0004WL-5J; Thu, 31 Oct 2013 23:31:06 +0000 Received: from localhost (localhost [127.0.0.1]) by keithp.com (Postfix) with ESMTP id 82958158400D; Thu, 31 Oct 2013 16:13:23 -0700 (PDT) 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 8lp_pOUHNB6X; Thu, 31 Oct 2013 16:13:18 -0700 (PDT) Received: by keithp.com (Postfix, from userid 1033) id 544A01584006; Thu, 31 Oct 2013 16:13:18 -0700 (PDT) Received: from miki.keithp.com (localhost [127.0.0.1]) by keithp.com (Postfix) with ESMTP id 23A6914A8038; Thu, 31 Oct 2013 16:13:18 -0700 (PDT) Received: by miki.keithp.com (Postfix, from userid 1001) id 6F0D8B82; Thu, 31 Oct 2013 16:13:17 -0700 (PDT) From: Keith Packard To: mesa3d-dev@lists.sourceforge.net Subject: [PATCH 2/6] dri/intel: Split out DRI2 buffer update code to separate function Date: Thu, 31 Oct 2013 16:13:12 -0700 Message-Id: <1383261196-25093-3-git-send-email-keithp@keithp.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1383261196-25093-1-git-send-email-keithp@keithp.com> References: <1383261196-25093-1-git-send-email-keithp@keithp.com> X-Spam-Score: -0.5 (/) X-Headers-End: 1Vc1hg-0004WL-5J X-BeenThere: dri-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list MIME-Version: 1.0 Cc: dri-devel@lists.sourceforge.net X-BeenThere: dri-devel@lists.freedesktop.org List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Make an easy place to splice in a DRI3 version of this function Signed-off-by: Keith Packard Reviewed-by: Kristian Høgsberg --- src/mesa/drivers/dri/i915/intel_context.c | 90 +++++++++++++++++-------------- src/mesa/drivers/dri/i965/brw_context.c | 22 ++++++-- 2 files changed, 68 insertions(+), 44 deletions(-) diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index 2748514..1798bc7 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -133,15 +133,58 @@ intel_process_dri2_buffer(struct intel_context *intel, struct intel_renderbuffer *rb, const char *buffer_name); -void -intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) +static void +intel_update_dri2_buffers(struct intel_context *intel, __DRIdrawable *drawable) { - struct gl_framebuffer *fb = drawable->driverPrivate; - struct intel_renderbuffer *rb; - struct intel_context *intel = context->driverPrivate; __DRIbuffer *buffers = NULL; int i, count; const char *region_name; + struct intel_renderbuffer *rb; + struct gl_framebuffer *fb = drawable->driverPrivate; + + intel_query_dri2_buffers(intel, drawable, &buffers, &count); + + if (buffers == NULL) + return; + + for (i = 0; i < count; i++) { + switch (buffers[i].attachment) { + case __DRI_BUFFER_FRONT_LEFT: + rb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT); + region_name = "dri2 front buffer"; + break; + + case __DRI_BUFFER_FAKE_FRONT_LEFT: + rb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT); + region_name = "dri2 fake front buffer"; + break; + + case __DRI_BUFFER_BACK_LEFT: + rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT); + region_name = "dri2 back buffer"; + break; + + case __DRI_BUFFER_DEPTH: + case __DRI_BUFFER_HIZ: + case __DRI_BUFFER_DEPTH_STENCIL: + case __DRI_BUFFER_STENCIL: + case __DRI_BUFFER_ACCUM: + default: + fprintf(stderr, + "unhandled buffer attach event, attachment type %d\n", + buffers[i].attachment); + return; + } + + intel_process_dri2_buffer(intel, drawable, &buffers[i], rb, region_name); + } +} + +void +intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) +{ + struct intel_context *intel = context->driverPrivate; + __DRIscreen *screen = intel->intelScreen->driScrnPriv; /* Set this up front, so that in case our buffers get invalidated * while we're getting new buffers, we don't clobber the stamp and @@ -151,42 +194,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) if (unlikely(INTEL_DEBUG & DEBUG_DRI)) fprintf(stderr, "enter %s, drawable %p\n", __func__, drawable); - intel_query_dri2_buffers(intel, drawable, &buffers, &count); - - if (buffers == NULL) - return; - - for (i = 0; i < count; i++) { - switch (buffers[i].attachment) { - case __DRI_BUFFER_FRONT_LEFT: - rb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT); - region_name = "dri2 front buffer"; - break; - - case __DRI_BUFFER_FAKE_FRONT_LEFT: - rb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT); - region_name = "dri2 fake front buffer"; - break; - - case __DRI_BUFFER_BACK_LEFT: - rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT); - region_name = "dri2 back buffer"; - break; - - case __DRI_BUFFER_DEPTH: - case __DRI_BUFFER_HIZ: - case __DRI_BUFFER_DEPTH_STENCIL: - case __DRI_BUFFER_STENCIL: - case __DRI_BUFFER_ACCUM: - default: - fprintf(stderr, - "unhandled buffer attach event, attachment type %d\n", - buffers[i].attachment); - return; - } - - intel_process_dri2_buffer(intel, drawable, &buffers[i], rb, region_name); - } + intel_update_dri2_buffers(intel, drawable); driUpdateFramebufferSize(&intel->ctx, drawable); } diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 38147e9..c213b31 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -929,12 +929,11 @@ intel_process_dri2_buffer(struct brw_context *brw, struct intel_renderbuffer *rb, const char *buffer_name); -void -intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) +static void +intel_update_dri2_buffers(struct brw_context *brw, __DRIdrawable *drawable) { struct gl_framebuffer *fb = drawable->driverPrivate; struct intel_renderbuffer *rb; - struct brw_context *brw = context->driverPrivate; __DRIbuffer *buffers = NULL; int i, count; const char *region_name; @@ -984,6 +983,23 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) intel_process_dri2_buffer(brw, drawable, &buffers[i], rb, region_name); } +} + +void +intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) +{ + struct brw_context *brw = context->driverPrivate; + + /* Set this up front, so that in case our buffers get invalidated + * while we're getting new buffers, we don't clobber the stamp and + * thus ignore the invalidate. */ + drawable->lastStamp = drawable->dri2.stamp; + + if (unlikely(INTEL_DEBUG & DEBUG_DRI)) + fprintf(stderr, "enter %s, drawable %p\n", __func__, drawable); + + intel_update_dri2_buffers(brw, drawable); + driUpdateFramebufferSize(&brw->ctx, drawable); }