Block AIGLX clients if they draw before swap is complete

This commit is contained in:
Kristian Høgsberg 2009-07-23 09:39:23 -04:00 committed by Jesse Barnes
parent d8342156dd
commit f2cdca03e3
4 changed files with 28 additions and 10 deletions

View file

@ -55,6 +55,10 @@ struct __GLXcontext {
unsigned long mask);
int (*forceCurrent) (__GLXcontext *context);
Bool (*wait) (__GLXcontext *context,
__GLXclientState *cl,
int *error);
__GLXtextureFromPixmap *textureFromPixmap;
/*

View file

@ -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,

View file

@ -445,6 +445,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;

View file

@ -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;
@ -71,15 +78,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);