All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: xorg-devel@lists.x.org, dri-devel@lists.freedesktop.org,
	mesa-dev@lsits.freedesktop.org
Subject: [PATCH v2] dri2: Reuse unused flags in GetBuffers protocol to pass last SBC
Date: Mon, 19 Jan 2015 14:29:06 +0000	[thread overview]
Message-ID: <1421677746-19622-1-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20150119141426.GH26577@nuc-i3427.alporthouse.com>

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 <chris@chris-wilson.co.uk>
---
 configure.ac           |  2 +-
 hw/xfree86/dri2/dri2.c | 25 +++++++++++++++++++++----
 hw/xfree86/dri2/dri2.h |  1 +
 3 files changed, 23 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..d70a632 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -49,6 +49,8 @@
 #include "damage.h"
 #include "xf86.h"
 
+#include <X11/extensions/dri2proto.h> /* 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;
@@ -1117,6 +1120,9 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
         return BadDrawable;
     }
 
+    if (ds->bufferAge)
+        pSrcBuffer->flags = *swap_target;
+
     /* Old DDX or PRIME, just blit */
     if (!ds->scheduleSwap0 || pPriv->prime_id) {
         BoxRec box;
@@ -1562,6 +1568,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
 
     if (info->version >= 10) {
         ds->scheduleSwap0 = info->scheduleSwap0;
+        ds->bufferAge = info->bufferAge;
     }
 
     /*
@@ -1684,10 +1691,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);
-- 
2.1.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-01-19 14:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-19 11:00 Implement GLX_EXT_buffer_age for DRI2 Chris Wilson
     [not found] ` <1421665245-5994-1-git-send-email-chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org>
2015-01-19 11:00   ` [dri2proto] Declare DRI2ParamXHasBufferAge Chris Wilson
     [not found]     ` <1421665245-5994-2-git-send-email-chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org>
2015-01-20 20:53       ` [Mesa-dev] " Ian Romanick
2015-06-16 12:25         ` Martin Peres
2015-01-19 11:00   ` [xorg 1/3] dri2: Allow GetBuffers to match any format Chris Wilson
2015-01-20 20:49     ` [Mesa-dev] " Ian Romanick
2015-06-16 13:11       ` Martin Peres
2015-01-19 11:00   ` [xorg 2/3] dri2: Pass swap-interval=0 ScheduleSwap requests to the ddx Chris Wilson
2015-02-18 19:57     ` Fredrik Höglund
2015-01-19 11:00   ` [xorg 3/3] dri2: Reuse unused flags in GetBuffers protocol to pass last SBC Chris Wilson
2015-01-19 14:14     ` Chris Wilson
2015-01-19 14:29       ` Chris Wilson [this message]
2015-01-20 21:55         ` [PATCH v2] " Ian Romanick
2015-01-19 11:00   ` [xf86-video-ati] dri2: Enable BufferAge support Chris Wilson
2015-01-20 16:47     ` Alex Deucher
2015-01-19 11:00   ` [xf86-video-nouveau] " Chris Wilson
     [not found]     ` <1421665245-5994-7-git-send-email-chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org>
2015-05-09  4:41       ` Mario Kleiner
2015-01-19 11:00   ` [mesa 7/9] glx/dri2: Add DRI2GetParam() Chris Wilson
     [not found]     ` <1421665245-5994-8-git-send-email-chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org>
2015-01-20 19:11       ` [Mesa-dev] " Ian Romanick
2015-01-19 11:00   ` [mesa 8/9] glx/dri2: Move the wait after SwapBuffers into the next GetBuffers Chris Wilson
2015-01-20 20:03     ` Ian Romanick
2015-01-19 11:00   ` [mesa 9/9] glx/dri2: Implement getBufferAge Chris Wilson
2015-01-20 20:35     ` Ian Romanick
     [not found]       ` <54BEBBF9.8010104-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org>
2015-01-20 20:49         ` [Mesa-dev] " Ian Romanick
2015-01-20 21:49 ` Implement GLX_EXT_buffer_age for DRI2 Dave Airlie
2015-02-18 18:40   ` [Mesa-dev] " Daniel Stone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421677746-19622-1-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mesa-dev@lsits.freedesktop.org \
    --cc=xorg-devel@lists.x.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.