From patchwork Mon Jan 19 11:00:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 5657491 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D909B9F333 for ; Mon, 19 Jan 2015 11:17:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F02FD20353 for ; Mon, 19 Jan 2015 11:17:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 37ACE20351 for ; Mon, 19 Jan 2015 11:17:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E0A36E54A; Mon, 19 Jan 2015 03:17:22 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from relay.fireflyinternet.com (hostedrelay.fireflyinternet.com [109.228.30.76]) by gabe.freedesktop.org (Postfix) with ESMTP id 0CB7E6E53D; Mon, 19 Jan 2015 03:17:15 -0800 (PST) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by relay.fireflyinternet.com (FireflyRelay1) with ESMTP id 12848039-1305619 for multiple; Mon, 19 Jan 2015 11:00:52 +0000 From: Chris Wilson To: xorg-devel@lists.x.org, dri-devel@lists.freedesktop.org, mesa-dev@lists.freedesktop.org Subject: [xorg 3/3] dri2: Reuse unused flags in GetBuffers protocol to pass last SBC Date: Mon, 19 Jan 2015 11:00:40 +0000 Message-Id: <1421665245-5994-5-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1421665245-5994-1-git-send-email-chris@chris-wilson.co.uk> References: <1421665245-5994-1-git-send-email-chris@chris-wilson.co.uk> X-Authenticated-User: chris.alporthouse@surfanytime.net X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 Allow mesa/dri2 to implement GLX_EXT_buffer_age by reporting the sbc of when the current back buffer was defined. As this may require ddx support, only set the value if enabled by the ddx and report the new semantics via a DRI2GetParam request. Signed-off-by: Chris Wilson --- configure.ac | 2 +- hw/xfree86/dri2/dri2.c | 24 ++++++++++++++++++++---- hw/xfree86/dri2/dri2.h | 1 + 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index b593fc7..e49c35e 100644 --- a/configure.ac +++ b/configure.ac @@ -768,7 +768,7 @@ RECORDPROTO="recordproto >= 1.13.99.1" SCRNSAVERPROTO="scrnsaverproto >= 1.1" RESOURCEPROTO="resourceproto >= 1.2.0" DRIPROTO="xf86driproto >= 2.1.0" -DRI2PROTO="dri2proto >= 2.8" +DRI2PROTO="dri2proto >= 2.9" DRI3PROTO="dri3proto >= 1.0" XINERAMAPROTO="xineramaproto" BIGFONTPROTO="xf86bigfontproto >= 1.2.0" diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 2c0367e..a998034 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -49,6 +49,8 @@ #include "damage.h" #include "xf86.h" +#include /* for parameter names */ + CARD8 dri2_major; /* version of DRI2 supported by DDX */ CARD8 dri2_minor; @@ -115,6 +117,7 @@ typedef struct _DRI2Screen { unsigned int lastSequence; int prime_id; int scheduleSwap0; + int bufferAge; DRI2CreateBufferProcPtr CreateBuffer; DRI2DestroyBufferProcPtr DestroyBuffer; @@ -1104,6 +1107,8 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, * it as early as possible, just to be sure. */ *swap_target = pPriv->swap_count + pPriv->swapsPending + 1; + if (ds->bufferAge) + pSrcBuffer->flags = *swap_target; for (i = 0; i < pPriv->bufferCount; i++) { if (pPriv->buffers[i]->attachment == DRI2BufferFrontLeft) @@ -1562,6 +1567,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) if (info->version >= 10) { ds->scheduleSwap0 = info->scheduleSwap0; + ds->bufferAge = info->bufferAge; } /* @@ -1684,10 +1690,20 @@ DRI2GetParam(ClientPtr client, switch (high_byte) { case 0: - /* Parameter names whose high_byte is 0 are reserved for the X - * server. The server currently recognizes no parameters. - */ - goto not_recognized; + /* Parameter names whose high_byte is 0 are reserved for the X + * server. + */ + switch (param) { + case DRI2ParamXHasBufferAge: + *value = ds->bufferAge; + break; + default: + goto not_recognized; + } + + *is_param_recognized = TRUE; + return Success; + case 1: /* Parameter names whose high byte is 1 are reserved for the DDX. */ if (ds->GetParam) diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h index 1cf4288..e76f7a8 100644 --- a/hw/xfree86/dri2/dri2.h +++ b/hw/xfree86/dri2/dri2.h @@ -255,6 +255,7 @@ typedef struct { /* added in version 10 */ int scheduleSwap0; + int bufferAge; } DRI2InfoRec, *DRI2InfoPtr; extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info);