xserver: Branch 'dri2-swapbuffers'

Kristian Høgsberg krh at kemper.freedesktop.org
Thu Jul 23 14:39:58 PDT 2009


 glx/glxcontext.h |    4 ++++
 glx/glxdri2.c    |   13 +++++++++++++
 glx/glxext.c     |    3 +++
 glx/glxserver.h  |   18 ++++++++----------
 4 files changed, 28 insertions(+), 10 deletions(-)

New commits:
commit 176e9f30c3dba8f159781473c1e9c2637e177bd4
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Thu Jul 23 09:39:23 2009 -0400

    Block AIGLX clients if they draw before swap is complete

diff --git a/glx/glxcontext.h b/glx/glxcontext.h
index 70a1411..79bc083 100644
--- a/glx/glxcontext.h
+++ b/glx/glxcontext.h
@@ -55,6 +55,10 @@ struct __GLXcontext {
 				     unsigned long mask);
     int            (*forceCurrent)  (__GLXcontext *context);
 
+    Bool           (*wait)          (__GLXcontext *context,
+				     __GLXclientState *cl,
+				     int *error);
+
     __GLXtextureFromPixmap *textureFromPixmap;
 
     /*
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 6fb4cf1..4b89c31 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -245,6 +245,18 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext)
 					read->driDrawable);
 }
 
+static Bool
+__glXDRIcontextWait(__GLXcontext *baseContext,
+		    __GLXclientState *cl, int *error)
+{
+    if (DRI2WaitSwap(cl->client, baseContext->drawPriv->pDraw)) {
+	*error = cl->client->noClientException;
+	return TRUE;
+    }
+
+    return FALSE;
+}
+
 #ifdef __DRI_TEX_BUFFER
 
 static int
@@ -350,6 +362,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
     context->base.copy              = __glXDRIcontextCopy;
     context->base.forceCurrent      = __glXDRIcontextForceCurrent;
     context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
+    context->base.wait              = __glXDRIcontextWait;
 
     context->driContext =
 	(*screen->dri2->createNewContext)(screen->driScreen,
diff --git a/glx/glxext.c b/glx/glxext.c
index 19d70d4..f57ccf5 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -439,6 +439,9 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag,
     	}
     }
     
+    if (cx->wait && (*cx->wait)(cx, cl, error))
+	return NULL;
+
     if (cx == __glXLastContext) {
 	/* No need to re-bind */
 	return cx;
diff --git a/glx/glxserver.h b/glx/glxserver.h
index 46c9382..3e62782 100644
--- a/glx/glxserver.h
+++ b/glx/glxserver.h
@@ -56,7 +56,14 @@
 #include <GL/gl.h>
 #include <GL/glxproto.h>
 
-/* For glxscreens.h */
+/*
+** GLX resources.
+*/
+typedef XID GLXContextID;
+typedef XID GLXPixmap;
+typedef XID GLXDrawable;
+
+typedef struct __GLXclientStateRec __GLXclientState;
 typedef struct __GLXdrawable __GLXdrawable;
 typedef struct __GLXcontext __GLXcontext;
 
@@ -75,15 +82,6 @@ typedef struct __GLXcontext __GLXcontext;
 #define False 0
 #endif
 
-/*
-** GLX resources.
-*/
-typedef XID GLXContextID;
-typedef XID GLXPixmap;
-typedef XID GLXDrawable;
-
-typedef struct __GLXclientStateRec __GLXclientState;
-
 extern __GLXscreen *glxGetScreen(ScreenPtr pScreen);
 extern __GLXclientState *glxGetClient(ClientPtr pClient);
 


More information about the xorg-commit mailing list