summaryrefslogtreecommitdiffstats
path: root/src/glx/glx_pbuffer.c
diff options
context:
space:
mode:
authorAdel Gadllah <adel.gadllah@gmail.com>2014-02-24 20:44:42 +0100
committerEric Anholt <eric@anholt.net>2014-03-13 14:19:21 -0700
commita69fabc76cc5a8d744fb184bfc5a4096ee596c13 (patch)
treef17c9fe43fc9f9fe0f77c9de67f380cf20bfd254 /src/glx/glx_pbuffer.c
parent0b02d8a633da7ee19793eb12bb5ea407afe0de6f (diff)
downloadexternal_mesa3d-a69fabc76cc5a8d744fb184bfc5a4096ee596c13.zip
external_mesa3d-a69fabc76cc5a8d744fb184bfc5a4096ee596c13.tar.gz
external_mesa3d-a69fabc76cc5a8d744fb184bfc5a4096ee596c13.tar.bz2
dri3: Add GLX_EXT_buffer_age support
v2: Indent according to Mesa style, reuse sbc instead of making a new swap_count field, and actually get a usable back before returning the age of the back (fixing updated piglit tests). Changes by anholt. Signed-off-by: Adel Gadllah <adel.gadllah@gmail.com> Reviewed-by: Robert Bragg <robert@sixbynine.org> (v1) Reviewed-by: Adel Gadllah <adel.gadllah@gmail.com> (v2) Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/glx/glx_pbuffer.c')
-rw-r--r--src/glx/glx_pbuffer.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index 978730c..0cd0554 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -285,6 +285,10 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
unsigned int num_attributes;
GLboolean use_glx_1_3;
+#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+ __GLXDRIdrawable *pdraw;
+#endif
+
if (dpy == NULL)
return 0;
@@ -311,6 +315,32 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
if (!opcode)
return 0;
+#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+ pdraw = GetGLXDRIDrawable(dpy, drawable);
+
+ if (attribute == GLX_BACK_BUFFER_AGE_EXT) {
+ struct glx_screen *psc = pdraw->psc;
+ struct glx_context *gc = __glXGetCurrentContext();
+
+ /* The GLX_EXT_buffer_age spec says:
+ *
+ * "If querying GLX_BACK_BUFFER_AGE_EXT and <draw> is not bound to
+ * the calling thread's current context a GLXBadDrawable error is
+ * generated."
+ */
+ if (gc == NULL || gc->currentDpy != dpy ||
+ (gc->currentDrawable != drawable && gc->currentReadable != drawable)) {
+ __glXSendError(dpy, GLXBadDrawable, drawable, X_GLXGetDrawableAttributes, false);
+ return 0;
+ }
+
+ if (psc->driScreen->getBufferAge != NULL)
+ *value = psc->driScreen->getBufferAge(pdraw);
+
+ return 0;
+ }
+#endif
+
LockDisplay(dpy);
if (use_glx_1_3) {
@@ -350,9 +380,6 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
_XEatData(dpy, length);
}
else {
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
-#endif
_XRead(dpy, (char *) data, length * sizeof(CARD32));
/* Search the set of returned attributes for the attribute requested by