summaryrefslogtreecommitdiff
path: root/GL/glx
diff options
context:
space:
mode:
Diffstat (limited to 'GL/glx')
-rw-r--r--GL/glx/g_disptab.h2
-rw-r--r--GL/glx/glxcmds.c751
-rw-r--r--GL/glx/glxcmdsswap.c134
-rw-r--r--GL/glx/glxcontext.h18
-rw-r--r--GL/glx/glxdrawable.h35
-rw-r--r--GL/glx/glxdri.c542
-rw-r--r--GL/glx/glxext.c254
-rw-r--r--GL/glx/glxext.h38
-rw-r--r--GL/glx/glxglcore.c5
-rw-r--r--GL/glx/glxscreens.c148
-rw-r--r--GL/glx/glxscreens.h29
-rw-r--r--GL/glx/glxserver.h5
-rw-r--r--GL/glx/glxutil.c11
-rw-r--r--GL/glx/glxutil.h2
-rw-r--r--GL/glx/glxvisuals.c8
-rw-r--r--GL/glx/indirect_dispatch.h22
-rw-r--r--GL/glx/indirect_size_get.c4
-rw-r--r--GL/glx/indirect_table.c6
18 files changed, 921 insertions, 1093 deletions
diff --git a/GL/glx/g_disptab.h b/GL/glx/g_disptab.h
index f9a09ccd6..946e86ba6 100644
--- a/GL/glx/g_disptab.h
+++ b/GL/glx/g_disptab.h
@@ -34,7 +34,6 @@
** version 1.2.1 Specification.
*/
-extern int __glXDisp_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc);
extern int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc);
extern int __glXDisp_QueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc);
extern int __glXDisp_QueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc);
@@ -42,7 +41,6 @@ extern int __glXDisp_DestroyHyperpipeConfigSGIX (__GLXclientState *cl, GLbyte *p
extern int __glXDisp_QueryHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc);
extern int __glXDisp_HyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDispSwap_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc);
extern int __glXDispSwap_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc);
extern int __glXDispSwap_QueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc);
extern int __glXDispSwap_QueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc);
diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c
index 900a34798..f6e032193 100644
--- a/GL/glx/glxcmds.c
+++ b/GL/glx/glxcmds.c
@@ -73,6 +73,8 @@ GlxSetRenderTables (struct _glapi_table *table)
void
__glXContextDestroy(__GLXcontext *context)
{
+ if (!context->isDirect)
+ __glXDeassociateContext(context);
__glXFlushContextCache();
}
@@ -107,9 +109,10 @@ static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
* same as the VisualID.
*/
-int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
- GLXContextID shareList, VisualID visual,
- GLuint screen, GLboolean isDirect)
+static int
+DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
+ GLXContextID shareList, VisualID visual,
+ GLuint screen, GLboolean isDirect)
{
ClientPtr client = cl->client;
VisualPtr pVisual;
@@ -129,8 +132,8 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
return BadValue;
}
pScreen = screenInfo.screens[screen];
- pGlxScreen = __glXActiveScreens[screen];
-
+ pGlxScreen = glxGetScreen(pScreen);
+
/*
** Check if the visual ID is valid for this screen.
*/
@@ -147,7 +150,7 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
/*
** Get configuration of the visual. This assumes that the
- ** glXActiveScreens structure contains visual configurations only for the
+ ** glxScreen structure contains visual configurations only for the
** subset of Visuals that are supported by this implementation of the
** OpenGL.
*/
@@ -383,36 +386,6 @@ static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
glxc->isCurrent = GL_TRUE;
}
-/*****************************************************************************/
-/*
-** Make an OpenGL context and drawable current.
-*/
-
-int __glXDisp_MakeCurrent(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
-
- return DoMakeCurrent( cl, req->drawable, req->drawable,
- req->context, req->oldContextTag );
-}
-
-int __glXDisp_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
-
- return DoMakeCurrent( cl, req->drawable, req->readdrawable,
- req->context, req->oldContextTag );
-}
-
-int __glXDisp_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
-
- return DoMakeCurrent( cl, req->drawable, req->readable,
- req->context, req->oldContextTag );
-}
-
-
/**
* Given a drawable ID, get the associated drawable and / or pixmap.
*
@@ -423,119 +396,94 @@ int __glXDisp_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
*
* \param glxc Associated GLX context.
* \param drawId ID of the drawable.
- * \param ppDraw Location to store the pointer to the drawable.
- * \param ppPixmap Location to store the pointer to the pixmap.
* \param client Pointer to the client state.
- * \return Zero is returned on success. Otherwise a GLX / X11 protocol error
- * is returned.
+ * \return the __GLXdrawable is returned on success. Otherwise NULL.
*
* \notes This function will need some modification when support pbuffers
* is added.
*/
-static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId,
- __GLXdrawable **ppGlxDraw,
- __GLXpixmap **ppPixmap,
- ClientPtr client )
+static __GLXdrawable *
+__glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
+ int *error)
{
DrawablePtr pDraw;
__GLcontextModes *modes;
__GLXdrawable *pGlxDraw;
- __GLXpixmap *drawPixmap = NULL;
+ VisualID vid;
int rc;
- /* This is the GLX 1.3 case - the client passes in a GLXWindow and
- * we just return the __GLXdrawable. The first time a GLXPixmap
- * comes in, it doesn't have a corresponding __GLXdrawable, so it
- * falls through to the else-case below, but after that it'll have
- * a __GLXdrawable and we'll handle it here. */
+ /* This is the GLX 1.3 case - the client passes in a GLXWindow or
+ * GLXPixmap and we just return the __GLXdrawable. */
pGlxDraw = (__GLXdrawable *) LookupIDByType(drawId, __glXDrawableRes);
if (pGlxDraw != NULL) {
if (glxc != NULL && pGlxDraw->modes != glxc->modes) {
client->errorValue = drawId;
- return BadMatch;
+ *error = BadMatch;
+ return NULL;
}
- *ppGlxDraw = pGlxDraw;
- *ppPixmap = pGlxDraw->pGlxPixmap;
- return Success;
+ return pGlxDraw;
}
- /* The drawId wasn't a GLXWindow, so presumably it's a regular X
- * window. In that case, we create a shadow GLXWindow for it on
+ /* The drawId wasn't a GLX drawable, so presumably it's a regular
+ * X window. In that case, we create a shadow GLXWindow for it on
* demand here for pre GLX 1.3 compatibility and use the X Window
* XID as its GLXWindow XID. The client can't explicitly create a
* GLXWindow with the same XID as an X Window, so we wont get any
* resource ID clashes. Effectively, the X Window is now also a
* GLXWindow. */
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
- if (rc == Success) {
- if (pDraw->type == DRAWABLE_WINDOW) {
- VisualID vid = wVisual((WindowPtr)pDraw);
- modes = _gl_context_modes_find_visual(glxc->pGlxScreen->modes,
- vid);
- } else {
- /*
- ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
- ** is, but it must first be created with glxCreateGLXPixmap).
- */
- client->errorValue = drawId;
- return __glXError(GLXBadDrawable);
- }
- } else {
- drawPixmap = (__GLXpixmap *) LookupIDByType(drawId, __glXPixmapRes);
- if (drawPixmap) {
- pDraw = drawPixmap->pDraw;
- modes = drawPixmap->modes;
- } else {
- /*
- ** Drawable is neither a Window nor a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXError(GLXBadDrawable);
- }
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
+ if (rc != Success || pDraw->type != DRAWABLE_WINDOW) {
+ client->errorValue = drawId;
+ *error = __glXError(GLXBadDrawable);
+ return NULL;
}
/* If we're not given a context, don't create the __GLXdrawable */
if (glxc == NULL) {
- *ppPixmap = NULL;
- *ppGlxDraw = NULL;
- return Success;
+ *error = __glXError(GLXBadDrawable);
+ return NULL;
}
- /* We're binding an X Window or a GLX Pixmap for the first time
- * and need to create a GLX drawable for it. First check that the
- * drawable screen and fbconfig matches the context ditto. */
+ vid = wVisual((WindowPtr)pDraw);
+ modes = _gl_context_modes_find_visual(glxc->pGlxScreen->modes, vid);
+
+ /* We're binding an X Window for the first time and need to create
+ * a GLX drawable for it. First check that the drawable screen
+ * and fbconfig matches the context ditto. */
if (pDraw->pScreen != glxc->pScreen || modes != glxc->modes) {
client->errorValue = drawId;
- return BadMatch;
+ *error = BadMatch;
+ return NULL;
}
- pGlxDraw =
- glxc->pGlxScreen->createDrawable(glxc->pGlxScreen,
- pDraw, drawId, modes);
+ pGlxDraw = glxc->pGlxScreen->createDrawable(glxc->pGlxScreen,
+ pDraw, GLX_DRAWABLE_WINDOW,
+ drawId, modes);
/* since we are creating the drawablePrivate, drawId should be new */
if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
pGlxDraw->destroy (pGlxDraw);
- return BadAlloc;
+ *error = BadAlloc;
+ return NULL;
}
- *ppPixmap = drawPixmap;
- *ppGlxDraw = pGlxDraw;
-
- return 0;
+ return pGlxDraw;
}
+/*****************************************************************************/
+/*
+** Make an OpenGL context and drawable current.
+*/
-int DoMakeCurrent( __GLXclientState *cl,
- GLXDrawable drawId, GLXDrawable readId,
- GLXContextID contextId, GLXContextTag tag )
+static int
+DoMakeCurrent(__GLXclientState *cl,
+ GLXDrawable drawId, GLXDrawable readId,
+ GLXContextID contextId, GLXContextTag tag)
{
ClientPtr client = cl->client;
xGLXMakeCurrentReply reply;
- __GLXpixmap *drawPixmap = NULL;
- __GLXpixmap *readPixmap = NULL;
__GLXcontext *glxc, *prevglxc;
__GLXdrawable *drawPriv = NULL;
__GLXdrawable *readPriv = NULL;
@@ -593,21 +541,13 @@ int DoMakeCurrent( __GLXclientState *cl,
assert( drawId != None );
assert( readId != None );
- status = GetDrawableOrPixmap(glxc, drawId, &drawPriv, &drawPixmap,
- client);
- if ( status != 0 ) {
+ drawPriv = __glXGetDrawable(glxc, drawId, client, &status);
+ if (drawPriv == NULL)
return status;
- }
- if ( readId != drawId ) {
- status = GetDrawableOrPixmap(glxc, readId, &readPriv, &readPixmap,
- client);
- if ( status != 0 ) {
- return status;
- }
- } else {
- readPriv = drawPriv;
- }
+ readPriv = __glXGetDrawable(glxc, readId, client, &status);
+ if (readPriv == NULL)
+ return status;
} else {
/* Switching to no context. Ignore new drawable. */
@@ -669,42 +609,6 @@ int DoMakeCurrent( __GLXclientState *cl,
}
if (prevglxc) {
- if (prevglxc->drawPixmap) {
- if (prevglxc->readPixmap &&
- prevglxc->drawPixmap != prevglxc->readPixmap) {
- /*
- ** The previous drawable was a glx pixmap, release it.
- */
- prevglxc->readPixmap->refcnt--;
- if (!prevglxc->readPixmap->idExists &&
- !prevglxc->readPixmap->refcnt) {
- PixmapPtr pPixmap = (PixmapPtr) prevglxc->readPixmap->pDraw;
- /*
- ** The DestroyPixmap routine should decrement the
- ** refcount of the X pixmap and free only if it's zero.
- */
- (*prevglxc->readPixmap->pScreen->DestroyPixmap)(pPixmap);
- xfree(prevglxc->readPixmap);
- }
- }
-
- /*
- ** The previous drawable was a glx pixmap, release it.
- */
- prevglxc->drawPixmap->refcnt--;
- if (!prevglxc->drawPixmap->idExists &&
- !prevglxc->drawPixmap->refcnt) {
- PixmapPtr pPixmap = (PixmapPtr) prevglxc->drawPixmap->pDraw;
- /*
- ** The DestroyPixmap routine should decrement the
- ** refcount of the X pixmap and free only if it's zero.
- */
- (*prevglxc->drawPixmap->pScreen->DestroyPixmap)(pPixmap);
- xfree(prevglxc->drawPixmap);
- }
-
- prevglxc->drawPixmap = NULL;
- }
ChangeCurrentContext(cl, glxc, tag);
StopUsingContext(prevglxc);
} else {
@@ -712,16 +616,6 @@ int DoMakeCurrent( __GLXclientState *cl,
}
if (glxc) {
- if (drawPixmap) {
- drawPixmap->refcnt++;
- glxc->drawPixmap = drawPixmap;
- }
-
- if (readPixmap && (readPixmap != drawPixmap)) {
- readPixmap->refcnt++;
- glxc->readPixmap = readPixmap;
- }
-
StartUsingContext(cl, glxc);
reply.contextTag = tag;
} else {
@@ -740,6 +634,30 @@ int DoMakeCurrent( __GLXclientState *cl,
return Success;
}
+int __glXDisp_MakeCurrent(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
+
+ return DoMakeCurrent( cl, req->drawable, req->drawable,
+ req->context, req->oldContextTag );
+}
+
+int __glXDisp_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
+
+ return DoMakeCurrent( cl, req->drawable, req->readdrawable,
+ req->context, req->oldContextTag );
+}
+
+int __glXDisp_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
+
+ return DoMakeCurrent( cl, req->drawable, req->readable,
+ req->context, req->oldContextTag );
+}
+
int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
@@ -912,8 +830,8 @@ int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc)
}
-int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen,
- GLboolean do_swap)
+static int
+DoGetVisualConfigs(__GLXclientState *cl, unsigned screen)
{
ClientPtr client = cl->client;
xGLXGetVisualConfigsReply reply;
@@ -929,7 +847,7 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen,
client->errorValue = screen;
return BadValue;
}
- pGlxScreen = __glXActiveScreens[screen];
+ pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
reply.numVisuals = pGlxScreen->numUsableVisuals;
reply.numProps = __GLX_TOTAL_CONFIG;
@@ -938,7 +856,7 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen,
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
- if ( do_swap ) {
+ if (client->swapped) {
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.numVisuals);
@@ -992,7 +910,7 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen,
buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
buf[p++] = modes->transparentIndex;
- if ( do_swap ) {
+ if (client->swapped) {
__GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);
}
WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
@@ -1004,7 +922,7 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen,
int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
{
xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
- return DoGetVisualConfigs( cl, req->screen, GL_FALSE );
+ return DoGetVisualConfigs(cl, req->screen);
}
@@ -1100,7 +1018,8 @@ __glXCreateARGBConfig(__GLXscreen *screen)
* is the same, so this routine pulls double duty.
*/
-int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap)
+static int
+DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
{
ClientPtr client = cl->client;
xGLXGetFBConfigsReply reply;
@@ -1117,7 +1036,7 @@ int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap)
client->errorValue = screen;
return BadValue;
}
- pGlxScreen = __glXActiveScreens[screen];
+ pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
/* Create the "extra" 32bpp ARGB visual, if not already added.
* XXX This is questionable place to do so! Re-examine this someday.
@@ -1130,7 +1049,7 @@ int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap)
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
- if ( do_swap ) {
+ if (client->swapped) {
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.numFBConfigs);
@@ -1185,7 +1104,7 @@ int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap)
WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex );
WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod );
- if ( do_swap ) {
+ if (client->swapped) {
__GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH);
}
WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_FBCONFIG_ATTRIBS_LENGTH,
@@ -1198,41 +1117,32 @@ int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap)
int __glXDisp_GetFBConfigs(__GLXclientState *cl, GLbyte *pc)
{
xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
- return DoGetFBConfigs( cl, req->screen, GL_FALSE );
+ return DoGetFBConfigs(cl, req->screen);
}
-
int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
- return DoGetFBConfigs( cl, req->screen, GL_FALSE );
+ return DoGetFBConfigs(cl, req->screen);
}
-static int ValidateCreateDrawable(ClientPtr client,
- int screenNum, XID fbconfigId,
- XID drawablId, XID glxDrawableId,
- int type, __GLcontextModes **modes,
- DrawablePtr *ppDraw)
+static int
+DoCreateGLXDrawable(ClientPtr client, int screenNum, XID fbconfigId,
+ DrawablePtr pDraw, XID glxDrawableId, int type)
{
- DrawablePtr pDraw;
ScreenPtr pScreen;
VisualPtr pVisual;
__GLXscreen *pGlxScreen;
- int i, rc;
+ __GLXdrawable *pGlxDraw;
+ __GLcontextModes *modes;
+ int i;
LEGAL_NEW_RESOURCE(glxDrawableId, client);
- rc = dixLookupDrawable(&pDraw, drawablId, client, 0, DixUnknownAccess);
- if (rc != Success || pDraw->type != type) {
- client->errorValue = drawablId;
- return type == DRAWABLE_WINDOW ? BadWindow : BadPixmap;
- }
-
/* Check if screen of the fbconfig matches screen of drawable. */
pScreen = pDraw->pScreen;
- if (screenNum != pScreen->myNum) {
+ if (screenNum != pScreen->myNum)
return BadMatch;
- }
/* If this fbconfig has a corresponding VisualRec the number of
* planes must match the drawable depth. */
@@ -1243,56 +1153,59 @@ static int ValidateCreateDrawable(ClientPtr client,
}
/* Get configuration of the visual. */
- pGlxScreen = __glXgetActiveScreen(screenNum);
- *modes = _gl_context_modes_find_visual(pGlxScreen->modes, fbconfigId);
- if (*modes == NULL) {
+ pGlxScreen = glxGetScreen(pScreen);
+ modes = _gl_context_modes_find_visual(pGlxScreen->modes, fbconfigId);
+ if (modes == NULL) {
/* Visual not support on this screen by this OpenGL implementation. */
client->errorValue = fbconfigId;
return BadValue;
}
- *ppDraw = pDraw;
+ /* FIXME: We need to check that the window visual is compatible
+ * with the specified fbconfig. */
+ pGlxDraw = pGlxScreen->createDrawable(pGlxScreen, pDraw, type,
+ glxDrawableId, modes);
+ if (pGlxDraw == NULL)
+ return BadAlloc;
+
+ if (!AddResource(glxDrawableId, __glXDrawableRes, pGlxDraw)) {
+ pGlxDraw->destroy (pGlxDraw);
+ return BadAlloc;
+ }
return Success;
}
-/*
-** Create a GLX Pixmap from an X Pixmap.
-*/
-int DoCreateGLXPixmap(__GLXclientState *cl, XID fbconfigId,
- GLuint screenNum, XID pixmapId, XID glxPixmapId,
- CARD32 *attribs, CARD32 numAttribs)
+static int
+DoCreateGLXPixmap(ClientPtr client, int screenNum, XID fbconfigId,
+ XID drawableId, XID glxDrawableId)
{
- ClientPtr client = cl->client;
DrawablePtr pDraw;
- __GLXpixmap *pGlxPixmap;
- __GLcontextModes *modes;
- GLenum target = 0;
- int retval, i;
+ int err;
- retval = ValidateCreateDrawable (client, screenNum, fbconfigId,
- pixmapId, glxPixmapId,
- DRAWABLE_PIXMAP, &modes, &pDraw);
- if (retval != Success)
- return retval;
-
- pGlxPixmap = (__GLXpixmap *) xalloc(sizeof(__GLXpixmap));
- if (!pGlxPixmap) {
- return BadAlloc;
+ err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixUnknownAccess);
+ if (err != Success || pDraw->type != DRAWABLE_PIXMAP) {
+ client->errorValue = drawableId;
+ return BadPixmap;
}
- if (!(AddResource(glxPixmapId, __glXPixmapRes, pGlxPixmap))) {
- return BadAlloc;
- }
- pGlxPixmap->pDraw = pDraw;
- pGlxPixmap->pGlxScreen = __glXgetActiveScreen(screenNum);
- pGlxPixmap->pScreen = pDraw->pScreen;
- pGlxPixmap->idExists = True;
-#ifdef XF86DRI
- pGlxPixmap->pDamage = NULL;
-#endif
- pGlxPixmap->refcnt = 0;
- pGlxPixmap->modes = modes;
+ err = DoCreateGLXDrawable(client, screenNum, fbconfigId, pDraw,
+ glxDrawableId, GLX_DRAWABLE_PIXMAP);
+
+ if (err == Success)
+ ((PixmapPtr) pDraw)->refcnt++;
+
+ return err;
+}
+
+static void
+determineTextureTarget(XID glxDrawableID, CARD32 *attribs, CARD32 numAttribs)
+{
+ GLenum target = 0;
+ int i;
+ __GLXdrawable *pGlxDraw;
+
+ pGlxDraw = LookupIDByType(glxDrawableID, __glXDrawableRes);
for (i = 0; i < numAttribs; i++) {
if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
@@ -1306,63 +1219,74 @@ int DoCreateGLXPixmap(__GLXclientState *cl, XID fbconfigId,
}
}
}
-
+
if (!target) {
- int w = pDraw->width, h = pDraw->height;
-
+ int w = pGlxDraw->pDraw->width, h = pGlxDraw->pDraw->height;
+
if (h & (h - 1) || w & (w - 1))
target = GL_TEXTURE_RECTANGLE_ARB;
else
target = GL_TEXTURE_2D;
}
- pGlxPixmap->target = target;
-
- /*
- ** Bump the ref count on the X pixmap so it won't disappear.
- */
- ((PixmapPtr) pDraw)->refcnt++;
-
- return Success;
+ pGlxDraw->target = target;
}
int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
- return DoCreateGLXPixmap( cl, req->visual, req->screen,
- req->pixmap, req->glxpixmap, NULL, 0 );
+
+ return DoCreateGLXPixmap(cl->client, req->screen, req->visual,
+ req->pixmap, req->glxpixmap);
}
int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
- return DoCreateGLXPixmap( cl, req->fbconfig, req->screen,
- req->pixmap, req->glxpixmap,
- (CARD32*)(req + 1),
- req->numAttribs );
+ int err;
+
+ err = DoCreateGLXPixmap(cl->client, req->screen, req->fbconfig,
+ req->pixmap, req->glxpixmap);
+ if (err != Success)
+ return err;
+
+ determineTextureTarget(req->glxpixmap,
+ (CARD32*) (req + 1), req->numAttribs);
+
+ return Success;
}
int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateGLXPixmapWithConfigSGIXReq *req =
(xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
- return DoCreateGLXPixmap( cl, req->fbconfig, req->screen,
- req->pixmap, req->glxpixmap, NULL, 0 );
+
+ return DoCreateGLXPixmap(cl->client, req->screen, req->fbconfig,
+ req->pixmap, req->glxpixmap);
}
-int DoDestroyPixmap(__GLXclientState *cl, XID glxpixmap)
+static int DoDestroyDrawable(__GLXclientState *cl, XID glxdrawable, int type)
{
ClientPtr client = cl->client;
+ __GLXdrawable *pGlxDraw;
/*
- ** Check if it's a valid GLX pixmap.
+ ** Check it's the right type of drawable.
*/
- if (!LookupIDByType(glxpixmap, __glXPixmapRes)) {
- client->errorValue = glxpixmap;
- return __glXError(GLXBadPixmap);
+ pGlxDraw = LookupIDByType(glxdrawable, __glXDrawableRes);
+ if (pGlxDraw == NULL || pGlxDraw->type != type) {
+ client->errorValue = glxdrawable;
+ switch (type) {
+ case GLX_DRAWABLE_WINDOW:
+ return __glXError(GLXBadWindow);
+ case GLX_DRAWABLE_PIXMAP:
+ return __glXError(GLXBadDrawable);
+ case GLX_DRAWABLE_PBUFFER:
+ return __glXError(GLXBadPbuffer);
+ }
}
- FreeResource(glxpixmap, FALSE);
+ FreeResource(glxdrawable, FALSE);
return Success;
}
@@ -1371,32 +1295,116 @@ int __glXDisp_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
- return DoDestroyPixmap(cl, req->glxpixmap);
+ return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
}
int __glXDisp_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc;
- return DoDestroyPixmap(cl, req->glxpixmap);
+ return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
+}
+
+static int
+DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
+ int width, int height, XID glxDrawableId)
+{
+ ScreenPtr pScreen;
+ VisualPtr pVisual;
+ PixmapPtr pPixmap;
+ int i;
+
+ pScreen = screenInfo.screens[screenNum];
+
+ pVisual = pScreen->visuals;
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == fbconfigId)
+ break;
+ }
+ if (i == pScreen->numVisuals)
+ return __glXError(GLXBadFBConfig);
+
+ __glXenterServer(GL_FALSE);
+ pPixmap = (*pScreen->CreatePixmap) (pScreen,
+ width, height, pVisual->nplanes);
+ __glXleaveServer(GL_FALSE);
+
+ return DoCreateGLXDrawable(client, screenNum, fbconfigId,
+ &pPixmap->drawable, glxDrawableId,
+ GLX_DRAWABLE_PBUFFER);
}
int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
{
- xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
+ xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
+ CARD32 *attrs;
+ int width, height, i;
- (void) req;
+ attrs = (CARD32 *) (req + 1);
+ width = 0;
+ height = 0;
- return BadRequest;
+ for (i = 0; i < req->numAttribs; i++) {
+ switch (attrs[i * 2]) {
+ case GLX_PBUFFER_WIDTH:
+ width = attrs[i * 2 + 1];
+ break;
+ case GLX_PBUFFER_HEIGHT:
+ height = attrs[i * 2 + 1];
+ break;
+ case GLX_LARGEST_PBUFFER:
+ case GLX_PRESERVED_CONTENTS:
+ /* FIXME: huh... */
+ break;
+ }
+ }
+
+ return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
+ width, height, req->pbuffer);
+}
+
+int __glXDisp_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
+
+ return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
+ req->width, req->height, req->pbuffer);
}
int __glXDisp_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
- (void) req;
+ return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER);
+}
- return BadRequest;
+int __glXDisp_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc;
+
+ return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER);
+}
+
+static int
+DoChangeDrawableAttributes(ClientPtr client, XID glxdrawable,
+ int numAttribs, CARD32 *attribs)
+{
+ __GLXdrawable *pGlxDraw;
+ int i;
+
+ pGlxDraw = LookupIDByType(glxdrawable, __glXDrawableRes);
+ for (i = 0; i < numAttribs; i++) {
+ switch(attribs[i * 2]) {
+ case GLX_EVENT_MASK:
+ /* All we do is to record the event mask so we can send it
+ * back when queried. We never actually clobber the
+ * pbuffers, so we never need to send out the event. */
+ pGlxDraw->eventMask = attribs[i * 2 + 1];
+ break;
+ }
+ }
+
+ return Success;
}
int __glXDisp_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
@@ -1404,58 +1412,41 @@ int __glXDisp_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
xGLXChangeDrawableAttributesReq *req =
(xGLXChangeDrawableAttributesReq *) pc;
- (void) req;
-
- return BadRequest;
+ return DoChangeDrawableAttributes(cl->client, req->drawable,
+ req->numAttribs, (CARD32 *) (req + 1));
}
-int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
+int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
{
- xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
- ClientPtr client = cl->client;
- DrawablePtr pDraw;
- __GLXdrawable *glxPriv;
- __GLXscreen *screen;
- __GLcontextModes *modes;
- int retval;
-
- retval = ValidateCreateDrawable (client, req->screen, req->fbconfig,
- req->window, req->glxwindow,
- DRAWABLE_WINDOW, &modes, &pDraw);
- if (retval != Success)
- return retval;
+ xGLXChangeDrawableAttributesSGIXReq *req =
+ (xGLXChangeDrawableAttributesSGIXReq *)pc;
- /* FIXME: We need to check that the window visual is compatible
- * with the specified fbconfig. */
+ return DoChangeDrawableAttributes(cl->client, req->drawable,
+ req->numAttribs, (CARD32 *) (req + 1));
+}
- screen = __glXgetActiveScreen(req->screen);
- glxPriv = screen->createDrawable(screen, pDraw, req->glxwindow, modes);
- if (glxPriv == NULL)
- return BadAlloc;
+int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
+ ClientPtr client = cl->client;
+ DrawablePtr pDraw;
+ int err;
- if (!AddResource(req->glxwindow, __glXDrawableRes, glxPriv)) {
- glxPriv->destroy (glxPriv);
- return BadAlloc;
+ err = dixLookupDrawable(&pDraw, req->window, client, 0, DixUnknownAccess);
+ if (err != Success || pDraw->type != DRAWABLE_WINDOW) {
+ client->errorValue = req->window;
+ return BadWindow;
}
- return Success;
+ return DoCreateGLXDrawable(client, req->screen, req->fbconfig,
+ pDraw, req->glxwindow, GLX_DRAWABLE_WINDOW);
}
int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
- ClientPtr client = cl->client;
-
- /*
- ** Check if it's a valid GLX window.
- */
- if (!LookupIDByType(req->glxwindow, __glXDrawableRes)) {
- client->errorValue = req->glxwindow;
- return __glXError(GLXBadWindow);
- }
- FreeResource(req->glxwindow, FALSE);
- return Success;
+ return DoDestroyDrawable(cl, req->glxwindow, GLX_DRAWABLE_WINDOW);
}
@@ -1474,7 +1465,6 @@ int __glXDisp_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
XID drawId = req->drawable;
__GLXcontext *glxc = NULL;
__GLXdrawable *pGlxDraw;
- __GLXpixmap *pPixmap;
int error;
if (tag) {
@@ -1499,11 +1489,11 @@ int __glXDisp_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
}
}
- error = GetDrawableOrPixmap(glxc, drawId, &pGlxDraw, &pPixmap, client);
- if (error != Success)
+ pGlxDraw = __glXGetDrawable(glxc, drawId, client, &error);
+ if (pGlxDraw == NULL)
return error;
- if (pGlxDraw != NULL && pGlxDraw->type == DRAWABLE_WINDOW &&
+ if (pGlxDraw->type == DRAWABLE_WINDOW &&
(*pGlxDraw->swapBuffers)(pGlxDraw) == GL_FALSE)
return __glXError(GLXBadDrawable);
@@ -1511,7 +1501,8 @@ int __glXDisp_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
}
-int DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
+static int
+DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
{
ClientPtr client = cl->client;
__GLXcontext *ctx;
@@ -1574,8 +1565,8 @@ int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
ClientPtr client = cl->client;
- __GLXpixmap *pGlxPixmap;
__GLXcontext *context;
+ __GLXdrawable *pGlxDraw;
GLXDrawable drawId;
int buffer;
int error;
@@ -1592,8 +1583,8 @@ int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
if (!context)
return error;
- pGlxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes);
- if (!pGlxPixmap) {
+ pGlxDraw = __glXGetDrawable(NULL, drawId, client, &error);
+ if (!pGlxDraw || pGlxDraw->type != GLX_DRAWABLE_PIXMAP) {
client->errorValue = drawId;
return __glXError(GLXBadPixmap);
}
@@ -1603,14 +1594,14 @@ int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
return context->textureFromPixmap->bindTexImage(context,
buffer,
- pGlxPixmap);
+ pGlxDraw);
}
int __glXDisp_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
ClientPtr client = cl->client;
- __GLXpixmap *pGlxPixmap;
+ __GLXdrawable *pGlxDraw;
__GLXcontext *context;
GLXDrawable drawId;
int buffer;
@@ -1625,10 +1616,10 @@ int __glXDisp_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
if (!context)
return error;
- pGlxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes);
- if (!pGlxPixmap) {
+ pGlxDraw = __glXGetDrawable(NULL, drawId, client, &error);
+ if (!pGlxDraw || pGlxDraw->type != GLX_DRAWABLE_PIXMAP) {
client->errorValue = drawId;
- return __glXError(GLXBadDrawable);
+ return error;
}
if (!context->textureFromPixmap)
@@ -1636,7 +1627,7 @@ int __glXDisp_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
return context->textureFromPixmap->releaseTexImage(context,
buffer,
- pGlxPixmap);
+ pGlxDraw);
}
int __glXDisp_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
@@ -1645,7 +1636,6 @@ int __glXDisp_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
GLXContextTag tag = req->contextTag;
__GLXcontext *glxc = NULL;
__GLXdrawable *pGlxDraw;
- __GLXpixmap *pPixmap;
ClientPtr client = cl->client;
GLXDrawable drawId;
int error;
@@ -1684,12 +1674,12 @@ int __glXDisp_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
}
}
- error = GetDrawableOrPixmap(glxc, drawId, &pGlxDraw, &pPixmap, client);
- if (error != Success)
+ pGlxDraw = __glXGetDrawable(glxc, drawId, client, &error);
+ if (!pGlxDraw)
return error;
if (pGlxDraw == NULL ||
- pGlxDraw->type != DRAWABLE_WINDOW ||
+ pGlxDraw->type != GLX_DRAWABLE_WINDOW ||
pGlxDraw->copySubBuffer == NULL)
return __glXError(GLXBadDrawable);
@@ -1705,28 +1695,30 @@ static int
DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
{
ClientPtr client = cl->client;
- __GLXpixmap *glxPixmap;
xGLXGetDrawableAttributesReply reply;
- CARD32 attributes[4];
- int numAttribs;
+ __GLXdrawable *pGlxDraw;
+ CARD32 attributes[6];
+ int numAttribs, error;
- glxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes);
- if (!glxPixmap) {
+ pGlxDraw = __glXGetDrawable(NULL, drawId, client, &error);
+ if (!pGlxDraw) {
client->errorValue = drawId;
- return __glXError(GLXBadPixmap);
+ return error;
}
- numAttribs = 2;
+ numAttribs = 3;
reply.length = numAttribs << 1;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.numAttribs = numAttribs;
attributes[0] = GLX_TEXTURE_TARGET_EXT;
- attributes[1] = glxPixmap->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT :
+ attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT :
GLX_TEXTURE_RECTANGLE_EXT;
attributes[2] = GLX_Y_INVERTED_EXT;
attributes[3] = GL_FALSE;
+ attributes[4] = GLX_EVENT_MASK;
+ attributes[5] = pGlxDraw->eventMask;
if (client->swapped) {
__glXSwapGetDrawableAttributesReply(client, &reply, attributes);
@@ -1740,22 +1732,18 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
return Success;
}
-int __glXDisp_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
+int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
{
- xGLXVendorPrivateWithReplyReq *req = (xGLXVendorPrivateWithReplyReq *)pc;
- CARD32 *data;
- XID drawable;
-
- data = (CARD32 *) (req + 1);
- drawable = data[0];
+ xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
- return DoGetDrawableAttributes(cl, drawable);
+ return DoGetDrawableAttributes(cl, req->drawable);
}
-int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+int __glXDisp_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
{
- xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
-
+ xGLXGetDrawableAttributesSGIXReq *req =
+ (xGLXGetDrawableAttributesSGIXReq *)pc;
+
return DoGetDrawableAttributes(cl, req->drawable);
}
@@ -1766,7 +1754,10 @@ int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
** client library to send batches of GL rendering commands.
*/
-int DoRender(__GLXclientState *cl, GLbyte *pc, int do_swap)
+/*
+** Execute all the drawing commands in a request.
+*/
+int __glXDisp_Render(__GLXclientState *cl, GLbyte *pc)
{
xGLXRenderReq *req;
ClientPtr client= cl->client;
@@ -1777,9 +1768,8 @@ int DoRender(__GLXclientState *cl, GLbyte *pc, int do_swap)
__GLXcontext *glxc;
__GLX_DECLARE_SWAP_VARIABLES;
-
req = (xGLXRenderReq *) pc;
- if (do_swap) {
+ if (client->swapped) {
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->contextTag);
}
@@ -1803,7 +1793,7 @@ int DoRender(__GLXclientState *cl, GLbyte *pc, int do_swap)
** Also, each command must be word aligned.
*/
hdr = (__GLXrenderHeader *) pc;
- if (do_swap) {
+ if (client->swapped) {
__GLX_SWAP_SHORT(&hdr->length);
__GLX_SWAP_SHORT(&hdr->opcode);
}
@@ -1815,7 +1805,8 @@ int DoRender(__GLXclientState *cl, GLbyte *pc, int do_swap)
*/
err = __glXGetProtocolSizeData(& Render_dispatch_info, opcode, & entry);
proc = (__GLXdispatchRenderProcPtr)
- __glXGetProtocolDecodeFunction(& Render_dispatch_info, opcode, do_swap);
+ __glXGetProtocolDecodeFunction(& Render_dispatch_info,
+ opcode, client->swapped);
if ((err < 0) || (proc == NULL)) {
client->errorValue = commandsDone;
@@ -1824,7 +1815,8 @@ int DoRender(__GLXclientState *cl, GLbyte *pc, int do_swap)
if (entry.varsize) {
/* variable size command */
- extra = (*entry.varsize)(pc + __GLX_RENDER_HDR_SIZE, do_swap);
+ extra = (*entry.varsize)(pc + __GLX_RENDER_HDR_SIZE,
+ client->swapped);
if (extra < 0) {
extra = 0;
}
@@ -1857,15 +1849,11 @@ int DoRender(__GLXclientState *cl, GLbyte *pc, int do_swap)
return Success;
}
+
/*
-** Execute all the drawing commands in a request.
+** Execute a large rendering request (one that spans multiple X requests).
*/
-int __glXDisp_Render(__GLXclientState *cl, GLbyte *pc)
-{
- return DoRender(cl, pc, False);
-}
-
-int DoRenderLarge(__GLXclientState *cl, GLbyte *pc, int do_swap)
+int __glXDisp_RenderLarge(__GLXclientState *cl, GLbyte *pc)
{
xGLXRenderLargeReq *req;
ClientPtr client= cl->client;
@@ -1875,10 +1863,9 @@ int DoRenderLarge(__GLXclientState *cl, GLbyte *pc, int do_swap)
int error;
CARD16 opcode;
__GLX_DECLARE_SWAP_VARIABLES;
-
req = (xGLXRenderLargeReq *) pc;
- if (do_swap) {
+ if (client->swapped) {
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->contextTag);
__GLX_SWAP_INT(&req->dataBytes);
@@ -1921,7 +1908,7 @@ int DoRenderLarge(__GLXclientState *cl, GLbyte *pc, int do_swap)
}
hdr = (__GLXrenderLargeHeader *) pc;
- if (do_swap) {
+ if (client->swapped) {
__GLX_SWAP_INT(&hdr->length);
__GLX_SWAP_INT(&hdr->opcode);
}
@@ -1943,7 +1930,8 @@ int DoRenderLarge(__GLXclientState *cl, GLbyte *pc, int do_swap)
** be computed from its parameters), all the parameters needed
** will be in the 1st request, so it's okay to do this.
*/
- extra = (*entry.varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE, do_swap);
+ extra = (*entry.varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE,
+ client->swapped);
if (extra < 0) {
extra = 0;
}
@@ -2043,7 +2031,8 @@ int DoRenderLarge(__GLXclientState *cl, GLbyte *pc, int do_swap)
opcode = hdr->opcode;
proc = (__GLXdispatchRenderProcPtr)
- __glXGetProtocolDecodeFunction(& Render_dispatch_info, opcode, do_swap);
+ __glXGetProtocolDecodeFunction(& Render_dispatch_info, opcode,
+ client->swapped);
if (proc == NULL) {
client->errorValue = opcode;
return __glXError(GLXBadLargeRequest);
@@ -2068,14 +2057,6 @@ int DoRenderLarge(__GLXclientState *cl, GLbyte *pc, int do_swap)
}
}
-/*
-** Execute a large rendering request (one that spans multiple X requests).
-*/
-int __glXDisp_RenderLarge(__GLXclientState *cl, GLbyte *pc)
-{
- return DoRenderLarge(cl, pc, False);
-}
-
extern RESTYPE __glXSwapBarrierRes;
int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
@@ -2086,13 +2067,14 @@ int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
int barrier = req->barrier;
DrawablePtr pDraw;
int screen, rc;
+ __GLXscreen *pGlxScreen;
rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixUnknownAccess);
+ pGlxScreen = glxGetScreen(pDraw->pScreen);
if (rc == Success && (pDraw->type == DRAWABLE_WINDOW)) {
screen = pDraw->pScreen->myNum;
- if (__glXSwapBarrierFuncs &&
- __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc) {
- int ret = __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc(screen, drawable, barrier);
+ if (pGlxScreen->swapBarrierFuncs) {
+ int ret = pGlxScreen->swapBarrierFuncs->bindSwapBarrierFunc(screen, drawable, barrier);
if (ret == Success) {
if (barrier)
/* add source for cleanup when drawable is gone */
@@ -2116,10 +2098,11 @@ int __glXDisp_QueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc)
(xGLXQueryMaxSwapBarriersSGIXReq *) pc;
xGLXQueryMaxSwapBarriersSGIXReply reply;
int screen = req->screen;
+ __GLXscreen *pGlxScreen;
- if (__glXSwapBarrierFuncs &&
- __glXSwapBarrierFuncs[screen].queryMaxSwapBarriersFunc)
- reply.max = __glXSwapBarrierFuncs[screen].queryMaxSwapBarriersFunc(screen);
+ pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
+ if (pGlxScreen->swapBarrierFuncs)
+ reply.max = pGlxScreen->swapBarrierFuncs->queryMaxSwapBarriersFunc(screen);
else
reply.max = 0;
@@ -2152,11 +2135,12 @@ int __glXDisp_QueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc)
int npipes=0;
int n= 0;
+ __GLXscreen *pGlxScreen;
- if (__glXHyperpipeFuncs &&
- __glXHyperpipeFuncs[screen].queryHyperpipeNetworkFunc != NULL) {
+ pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
+ if (pGlxScreen->hyperpipeFuncs) {
rdata =
- (__glXHyperpipeFuncs[screen].queryHyperpipeNetworkFunc(screen, &npipes, &n));
+ (pGlxScreen->hyperpipeFuncs->queryHyperpipeNetworkFunc(screen, &npipes, &n));
}
length = __GLX_PAD(n) >> 2;
reply.type = X_Reply;
@@ -2189,13 +2173,13 @@ int __glXDisp_DestroyHyperpipeConfigSGIX (__GLXclientState *cl, GLbyte *pc)
int screen = req->screen;
int success = GLX_BAD_HYPERPIPE_SGIX;
int hpId ;
+ __GLXscreen *pGlxScreen;
hpId = req->hpId;
-
- if (__glXHyperpipeFuncs &&
- __glXHyperpipeFuncs[screen].destroyHyperpipeConfigFunc != NULL) {
- success = __glXHyperpipeFuncs[screen].destroyHyperpipeConfigFunc(screen, hpId);
+ pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
+ if (pGlxScreen->hyperpipeFuncs) {
+ success = pGlxScreen->hyperpipeFuncs->destroyHyperpipeConfigFunc(screen, hpId);
}
reply.type = X_Reply;
@@ -2227,12 +2211,13 @@ int __glXDisp_QueryHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc)
int npipes=0;
int n= 0;
int hpId;
+ __GLXscreen *pGlxScreen;
hpId = req->hpId;
- if (__glXHyperpipeFuncs &&
- __glXHyperpipeFuncs[screen].queryHyperpipeConfigFunc != NULL) {
- rdata = __glXHyperpipeFuncs[screen].queryHyperpipeConfigFunc(screen, hpId,&npipes, &n);
+ pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
+ if (pGlxScreen->hyperpipeFuncs) {
+ rdata = pGlxScreen->hyperpipeFuncs->queryHyperpipeConfigFunc(screen, hpId,&npipes, &n);
}
length = __GLX_PAD(n) >> 2;
@@ -2270,14 +2255,15 @@ int __glXDisp_HyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc)
int npipes=0, networkId;
int hpId=-1;
+ __GLXscreen *pGlxScreen;
+ pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
networkId = (int)req->networkId;
npipes = (int)req->npipes;
rdata = (void *)(req +1);
- if (__glXHyperpipeFuncs &&
- __glXHyperpipeFuncs[screen].hyperpipeConfigFunc != NULL) {
- __glXHyperpipeFuncs[screen].hyperpipeConfigFunc(screen,networkId,
+ if (pGlxScreen->hyperpipeFuncs) {
+ pGlxScreen->hyperpipeFuncs->hyperpipeConfigFunc(screen,networkId,
&hpId, &npipes,
(void *) rdata);
}
@@ -2366,7 +2352,7 @@ int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
return BadValue;
}
- ptr = __glXActiveScreens[screen]->GLXextensions;
+ ptr = glxGetScreen(screenInfo.screens[screen])->GLXextensions;
n = strlen(ptr) + 1;
length = __GLX_PAD(n) >> 2;
@@ -2402,6 +2388,7 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
size_t n, length;
const char *ptr;
char *buf;
+ __GLXscreen *pGlxScreen;
name = req->name;
screen = req->screen;
@@ -2412,15 +2399,17 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
client->errorValue = screen;
return BadValue;
}
+ pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
+
switch(name) {
case GLX_VENDOR:
- ptr = __glXActiveScreens[screen]->GLXvendor;
+ ptr = pGlxScreen->GLXvendor;
break;
case GLX_VERSION:
- ptr = __glXActiveScreens[screen]->GLXversion;
+ ptr = pGlxScreen->GLXversion;
break;
case GLX_EXTENSIONS:
- ptr = __glXActiveScreens[screen]->GLXextensions;
+ ptr = pGlxScreen->GLXextensions;
break;
default:
return BadValue;
diff --git a/GL/glx/glxcmdsswap.c b/GL/glx/glxcmdsswap.c
index 12bc03037..7f17c263b 100644
--- a/GL/glx/glxcmdsswap.c
+++ b/GL/glx/glxcmdsswap.c
@@ -77,8 +77,7 @@ int __glXDispSwap_CreateContext(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->screen);
__GLX_SWAP_INT(&req->shareList);
- return DoCreateContext( cl, req->context, req->shareList, req->visual,
- req->screen, req->isDirect );
+ return __glXDisp_CreateContext(cl, pc);
}
int __glXDispSwap_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
@@ -93,8 +92,7 @@ int __glXDispSwap_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->renderType);
__GLX_SWAP_INT(&req->shareList);
- return DoCreateContext( cl, req->context, req->shareList, req->fbconfig,
- req->screen, req->isDirect );
+ return __glXDisp_CreateNewContext(cl, pc);
}
int __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
@@ -110,8 +108,7 @@ int __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->renderType);
__GLX_SWAP_INT(&req->shareList);
- return DoCreateContext( cl, req->context, req->shareList, req->fbconfig,
- req->screen, req->isDirect );
+ return __glXDisp_CreateContextWithConfigSGIX(cl, pc);
}
int __glXDispSwap_DestroyContext(__GLXclientState *cl, GLbyte *pc)
@@ -135,8 +132,7 @@ int __glXDispSwap_MakeCurrent(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->context);
__GLX_SWAP_INT(&req->oldContextTag);
- return DoMakeCurrent( cl, req->drawable, req->drawable,
- req->context, req->oldContextTag );
+ return __glXDisp_MakeCurrent(cl, pc);
}
int __glXDispSwap_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
@@ -150,8 +146,7 @@ int __glXDispSwap_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->context);
__GLX_SWAP_INT(&req->oldContextTag);
- return DoMakeCurrent( cl, req->drawable, req->readdrawable,
- req->context, req->oldContextTag );
+ return __glXDisp_MakeContextCurrent(cl, pc);
}
int __glXDispSwap_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
@@ -165,8 +160,7 @@ int __glXDispSwap_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->context);
__GLX_SWAP_INT(&req->oldContextTag);
- return DoMakeCurrent( cl, req->drawable, req->readable,
- req->context, req->oldContextTag );
+ return __glXDisp_MakeCurrentReadSGI(cl, pc);
}
int __glXDispSwap_IsDirect(__GLXclientState *cl, GLbyte *pc)
@@ -233,7 +227,7 @@ int __glXDispSwap_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_INT(&req->screen);
- return DoGetVisualConfigs( cl, req->screen, GL_TRUE );
+ return __glXDisp_GetVisualConfigs(cl, pc);
}
int __glXDispSwap_GetFBConfigs(__GLXclientState *cl, GLbyte *pc)
@@ -242,7 +236,7 @@ int __glXDispSwap_GetFBConfigs(__GLXclientState *cl, GLbyte *pc)
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_INT(&req->screen);
- return DoGetFBConfigs( cl, req->screen, GL_TRUE );
+ return __glXDisp_GetFBConfigs(cl, pc);
}
int __glXDispSwap_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
@@ -251,7 +245,7 @@ int __glXDispSwap_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_INT(&req->screen);
- return DoGetFBConfigs( cl, req->screen, GL_TRUE );
+ return __glXDisp_GetFBConfigsSGIX(cl, pc);
}
int __glXDispSwap_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
@@ -265,14 +259,15 @@ int __glXDispSwap_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->pixmap);
__GLX_SWAP_INT(&req->glxpixmap);
- return DoCreateGLXPixmap( cl, req->visual, req->screen,
- req->pixmap, req->glxpixmap, NULL, 0 );
+ return __glXDisp_CreateGLXPixmap(cl, pc);
}
int __glXDispSwap_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
+ CARD32 *attribs;
__GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->screen);
@@ -280,11 +275,10 @@ int __glXDispSwap_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->pixmap);
__GLX_SWAP_INT(&req->glxpixmap);
__GLX_SWAP_INT(&req->numAttribs);
+ attribs = (CARD32*)(req + 1);
+ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
- return DoCreateGLXPixmap( cl, req->fbconfig, req->screen,
- req->pixmap, req->glxpixmap,
- (CARD32*)(req + 1),
- req->numAttribs );
+ return __glXDisp_CreatePixmap(cl, pc);
}
int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
@@ -299,8 +293,7 @@ int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc
__GLX_SWAP_INT(&req->pixmap);
__GLX_SWAP_INT(&req->glxpixmap);
- return DoCreateGLXPixmap( cl, req->fbconfig, req->screen,
- req->pixmap, req->glxpixmap, NULL, 0 );
+ return __glXDisp_CreateGLXPixmapWithConfigSGIX(cl, pc);
}
int __glXDispSwap_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
@@ -328,52 +321,123 @@ int __glXDispSwap_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
int __glXDispSwap_QueryContext(__GLXclientState *cl, GLbyte *pc)
{
xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
- (void) req;
+ __GLX_SWAP_INT(&req->context);
- return BadRequest;
+ return __glXDisp_QueryContext(cl, pc);
}
int __glXDispSwap_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ CARD32 *attribs;
+
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->pbuffer);
+ __GLX_SWAP_INT(&req->numAttribs);
+ attribs = (CARD32*)(req + 1);
+ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
+
+ return __glXDisp_CreatePbuffer(cl, pc);
+}
- (void) req;
+int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->pbuffer);
+ __GLX_SWAP_INT(&req->width);
+ __GLX_SWAP_INT(&req->height);
- return BadRequest;
+ return __glXDisp_CreateGLXPbufferSGIX(cl, pc);
}
int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) req;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&req->pbuffer);
+
+ return __glXDisp_DestroyPbuffer(cl, pc);
+}
+
+int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) req;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&req->pbuffer);
- return BadRequest;
+ return __glXDisp_DestroyGLXPbufferSGIX(cl, pc);
}
int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
{
xGLXChangeDrawableAttributesReq *req =
(xGLXChangeDrawableAttributesReq *) req;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ CARD32 *attribs;
+
+ __GLX_SWAP_INT(&req->drawable);
+ __GLX_SWAP_INT(&req->numAttribs);
+ attribs = (CARD32*)(req + 1);
+ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
+
+ return __glXDisp_ChangeDrawableAttributes(cl, pc);
+}
+
+int __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState *cl,
+ GLbyte *pc)
+{
+ xGLXChangeDrawableAttributesSGIXReq *req =
+ (xGLXChangeDrawableAttributesSGIXReq *) req;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ CARD32 *attribs;
+
+ __GLX_SWAP_INT(&req->drawable);
+ __GLX_SWAP_INT(&req->numAttribs);
+ attribs = (CARD32*)(req + 1);
+ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
- return BadRequest;
+ return __glXDisp_ChangeDrawableAttributesSGIX(cl, pc);
}
int __glXDispSwap_CreateWindow(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ CARD32 *attribs;
- (void) req;
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->window);
+ __GLX_SWAP_INT(&req->glxwindow);
+ __GLX_SWAP_INT(&req->numAttribs);
+ attribs = (CARD32*)(req + 1);
+ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
- return BadRequest;
+ return __glXDisp_CreateWindow(cl, pc);
}
int __glXDispSwap_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
- (void) req;
+ __GLX_SWAP_INT(&req->glxwindow);
- return BadRequest;
+ return __glXDisp_DestroyWindow(cl, pc);
}
int __glXDispSwap_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
@@ -643,7 +707,7 @@ void __glXSwapGetDrawableAttributesReply(ClientPtr client,
int __glXDispSwap_Render(__GLXclientState *cl, GLbyte *pc)
{
- return DoRender(cl, pc, True);
+ return __glXDisp_Render(cl, pc);
}
/*
@@ -651,7 +715,7 @@ int __glXDispSwap_Render(__GLXclientState *cl, GLbyte *pc)
*/
int __glXDispSwap_RenderLarge(__GLXclientState *cl, GLbyte *pc)
{
- return DoRenderLarge(cl, pc, True);
+ return __glXDisp_RenderLarge(cl, pc);
}
/************************************************************************/
diff --git a/GL/glx/glxcontext.h b/GL/glx/glxcontext.h
index eb10ee2a8..712264729 100644
--- a/GL/glx/glxcontext.h
+++ b/GL/glx/glxcontext.h
@@ -44,12 +44,12 @@
typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;
struct __GLXtextureFromPixmap {
- int (*bindTexImage) (__GLXcontext *baseContext,
- int buffer,
- __GLXpixmap *pixmap);
- int (*releaseTexImage) (__GLXcontext *baseContext,
- int buffer,
- __GLXpixmap *pixmap);
+ int (*bindTexImage) (__GLXcontext *baseContext,
+ int buffer,
+ __GLXdrawable *pixmap);
+ int (*releaseTexImage) (__GLXcontext *baseContext,
+ int buffer,
+ __GLXdrawable *pixmap);
};
@@ -152,12 +152,6 @@ struct __GLXcontext {
GLint selectBufSize; /* number of elements allocated */
/*
- ** Set only if current drawable is a glx pixmap.
- */
- __GLXpixmap *drawPixmap;
- __GLXpixmap *readPixmap;
-
- /*
** The drawable private this context is bound to
*/
__GLXdrawable *drawPriv;
diff --git a/GL/glx/glxdrawable.h b/GL/glx/glxdrawable.h
index b7ecad929..858bbb35b 100644
--- a/GL/glx/glxdrawable.h
+++ b/GL/glx/glxdrawable.h
@@ -46,22 +46,12 @@
#include <GL/internal/dri_interface.h>
#endif
-typedef struct {
-
- DrawablePtr pDraw;
- __GLcontextModes *modes;
- __GLXscreen *pGlxScreen;
- ScreenPtr pScreen;
- Bool idExists;
- int refcnt;
- GLenum target;
-#ifdef XF86DRI
- DamagePtr pDamage;
- __DRIcontext *pDRICtx;
- GLint texname;
- unsigned long offset;
-#endif
-} __GLXpixmap;
+/* We just need to avoid clashing with DRAWABLE_{WINDOW,PIXMAP} */
+enum {
+ GLX_DRAWABLE_WINDOW,
+ GLX_DRAWABLE_PIXMAP,
+ GLX_DRAWABLE_PBUFFER
+};
struct __GLXdrawable {
void (*destroy)(__GLXdrawable *private);
@@ -78,12 +68,10 @@ struct __GLXdrawable {
DrawablePtr pDraw;
XID drawId;
- __GLXpixmap *pGlxPixmap;
/*
- ** Either DRAWABLE_PIXMAP or DRAWABLE_WINDOW, copied from pDraw above.
- ** Needed by the resource freer because pDraw might already have been
- ** freed.
+ ** Either GLX_DRAWABLE_PIXMAP, GLX_DRAWABLE_WINDOW or
+ ** GLX_DRAWABLE_PBUFFER.
*/
int type;
@@ -105,6 +93,13 @@ struct __GLXdrawable {
** reference count
*/
int refCount;
+
+ GLenum target;
+
+ /*
+ ** Event mask
+ */
+ unsigned long eventMask;
};
#endif /* !__GLX_drawable_h__ */
diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c
index c1f3eb76b..2ded6aa81 100644
--- a/GL/glx/glxdri.c
+++ b/GL/glx/glxdri.c
@@ -59,77 +59,55 @@
#include "dispatch.h"
#include "extension_string.h"
+#define containerOf(ptr, type, member) \
+ (type *)( (char *)ptr - offsetof(type,member) )
-#define STRINGIFY(macro_or_string) STRINGIFY_ARG (macro_or_string)
-#define STRINGIFY_ARG(contents) #contents
-
-typedef struct __GLXDRIscreen __GLXDRIscreen;
-typedef struct __GLXDRIcontext __GLXDRIcontext;
+typedef struct __GLXDRIscreen __GLXDRIscreen;
+typedef struct __GLXDRIcontext __GLXDRIcontext;
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
struct __GLXDRIscreen {
__GLXscreen base;
+ __DRIscreen driScreen;
+ void *driver;
- __DRIscreen driScreen;
- void *driver;
+ xf86EnterVTProc *enterVT;
+ xf86LeaveVTProc *leaveVT;
- xf86EnterVTProc *enterVT;
- xf86LeaveVTProc *leaveVT;
+ __DRIcopySubBufferExtension *copySubBuffer;
+ __DRIswapControlExtension *swapControl;
+#ifdef __DRI_TEX_OFFSET
+ __DRItexOffsetExtension *texOffset;
DRITexOffsetStartProcPtr texOffsetStart;
DRITexOffsetFinishProcPtr texOffsetFinish;
- __GLXpixmap* texOffsetOverride[16];
+ __GLXDRIdrawable *texOffsetOverride[16];
GLuint lastTexOffsetOverride;
+#endif
unsigned char glx_enable_bits[__GLX_EXT_BYTES];
};
struct __GLXDRIcontext {
- __GLXcontext base;
-
- __DRIcontext driContext;
+ __GLXcontext base;
+ __DRIcontext driContext;
+ XID hwContextID;
};
struct __GLXDRIdrawable {
- __GLXdrawable base;
-
- __DRIdrawable *driDrawable;
+ __GLXdrawable base;
+ __DRIdrawable driDrawable;
+
+ /* Pulled in from old __GLXpixmap */
+#ifdef __DRI_TEX_OFFSET
+ GLint texname;
+ __GLXDRIcontext *ctx;
+ unsigned long offset;
+ DamagePtr pDamage;
+#endif
};
-/* History:
- * 20021121 - Initial version
- * 20021128 - Added __glXWindowExists() function
- * 20021207 - Added support for dynamic GLX extensions,
- * GLX_SGI_swap_control, GLX_SGI_video_sync,
- * GLX_OML_sync_control, and GLX_MESA_swap_control.
- * Never officially released. Do NOT test against
- * this version. Use 20030317 instead.
- * 20030317 - Added support GLX_SGIX_fbconfig,
- * GLX_MESA_swap_frame_usage, GLX_OML_swap_method,
- * GLX_{ARB,SGIS}_multisample, and
- * GLX_SGIX_visual_select_group.
- * 20030606 - Added support for GLX_SGI_make_current_read.
- * 20030813 - Made support for dynamic extensions multi-head aware.
- * 20030818 - Added support for GLX_MESA_allocate_memory in place of the
- * deprecated GLX_NV_vertex_array_range & GLX_MESA_agp_offset
- * interfaces.
- * 20031201 - Added support for the first round of DRI interface changes.
- * Do NOT test against this version! It has binary
- * compatibility bugs, use 20040317 instead.
- * 20040317 - Added the 'mode' field to __DRIcontextRec.
- * 20040415 - Added support for bindContext3 and unbindContext3.
- * 20040602 - Add __glXGetDrawableInfo. I though that was there
- * months ago. :(
- * 20050727 - Gut all the old interfaces. This breaks compatability with
- * any DRI driver built to any previous version.
- * 20060314 - Added support for GLX_MESA_copy_sub_buffer.
- */
-
-#define INTERNAL_VERSION 20050727
-
-static const char CREATE_NEW_SCREEN_FUNC[] =
- "__driCreateNewScreen_" STRINGIFY (INTERNAL_VERSION);
-
+static const char CREATE_NEW_SCREEN_FUNC[] = __DRI_CREATE_NEW_SCREEN_STRING;
static void
__glXDRIleaveServer(GLboolean rendering)
@@ -138,19 +116,19 @@ __glXDRIleaveServer(GLboolean rendering)
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
__GLXDRIscreen * const screen =
- (__GLXDRIscreen *) __glXgetActiveScreen(i);
+ (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
GLuint lastOverride = screen->lastTexOffsetOverride;
if (lastOverride) {
- __GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
+ __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
int j;
for (j = 0; j < lastOverride; j++) {
- __GLXpixmap *pGlxPix = texOffsetOverride[j];
+ __GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
if (pGlxPix && pGlxPix->texname) {
pGlxPix->offset =
- screen->texOffsetStart((PixmapPtr)pGlxPix->pDraw);
+ screen->texOffsetStart((PixmapPtr)pGlxPix->base.pDraw);
}
}
}
@@ -160,23 +138,22 @@ __glXDRIleaveServer(GLboolean rendering)
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
__GLXDRIscreen * const screen =
- (__GLXDRIscreen *) __glXgetActiveScreen(i);
+ (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
GLuint lastOverride = screen->lastTexOffsetOverride;
if (lastOverride) {
- __GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
+ __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
int j;
for (j = 0; j < lastOverride; j++) {
- __GLXpixmap *pGlxPix = texOffsetOverride[j];
+ __GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
if (pGlxPix && pGlxPix->texname) {
- screen->driScreen.setTexOffset(pGlxPix->pDRICtx,
- pGlxPix->texname,
- pGlxPix->offset,
- pGlxPix->pDraw->depth,
- ((PixmapPtr)pGlxPix->pDraw)->
- devKind);
+ screen->texOffset->setTexOffset(&pGlxPix->ctx->driContext,
+ pGlxPix->texname,
+ pGlxPix->offset,
+ pGlxPix->base.pDraw->depth,
+ ((PixmapPtr)pGlxPix->base.pDraw)->devKind);
}
}
}
@@ -189,8 +166,8 @@ __glXDRIenterServer(GLboolean rendering)
int i;
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
- __GLXDRIscreen * const screen =
- (__GLXDRIscreen *) __glXgetActiveScreen(i);
+ __GLXDRIscreen * const screen = (__GLXDRIscreen *)
+ glxGetScreen(screenInfo.screens[i]);
if (screen->lastTexOffsetOverride) {
CALL_Flush(GET_DISPATCH(), ());
@@ -201,29 +178,17 @@ __glXDRIenterServer(GLboolean rendering)
DRIWakeupHandler(NULL, 0, NULL);
}
-/**
- * \bug
- * We're jumping through hoops here to get the DRIdrawable which the DRI
- * driver tries to keep to it self... cf. FIXME in \c createDrawable.
- */
static void
-__glXDRIdrawableFoo(__GLXDRIdrawable *draw)
+__glXDRIdrawableDestroy(__GLXdrawable *drawable)
{
- __GLXDRIscreen * const screen =
- (__GLXDRIscreen *) __glXgetActiveScreen(draw->base.pDraw->pScreen->myNum);
+ __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
- draw->driDrawable = (*screen->driScreen.getDrawable)(NULL,
- draw->base.drawId,
- screen->driScreen.private);
-}
+ (*private->driDrawable.destroyDrawable)(&private->driDrawable);
-static void
-__glXDRIdrawableDestroy(__GLXdrawable *private)
-{
-#if 0
- (*glxPriv->driDrawable.destroyDrawable)(NULL,
- glxPriv->driDrawable.private);
-#endif
+ __glXenterServer(GL_FALSE);
+ DRIDestroyDrawable(drawable->pDraw->pScreen,
+ serverClient, drawable->pDraw);
+ __glXleaveServer(GL_FALSE);
xfree(private);
}
@@ -242,10 +207,7 @@ __glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
- __glXDRIdrawableFoo(private);
-
- (*private->driDrawable->swapBuffers)(NULL,
- private->driDrawable->private);
+ (*private->driDrawable.swapBuffers)(&private->driDrawable);
return TRUE;
}
@@ -255,10 +217,12 @@ static int
__glXDRIdrawableSwapInterval(__GLXdrawable *baseDrawable, int interval)
{
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable;
+ __GLXDRIscreen *screen = (__GLXDRIscreen *)
+ glxGetScreen(baseDrawable->pDraw->pScreen);
- __glXDRIdrawableFoo(draw);
+ if (screen->swapControl)
+ screen->swapControl->setSwapInterval(&draw->driDrawable, interval);
- draw->driDrawable->swap_interval = interval;
return 0;
}
@@ -268,22 +232,26 @@ __glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate,
int x, int y, int w, int h)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
+ __GLXDRIscreen *screen = (__GLXDRIscreen *)
+ glxGetScreen(basePrivate->pDraw->pScreen);
- __glXDRIdrawableFoo(private);
-
- (*private->driDrawable->copySubBuffer)(NULL,
- private->driDrawable->private,
- x, y, w, h);
+ if (screen->copySubBuffer)
+ screen->copySubBuffer->copySubBuffer(&private->driDrawable,
+ x, y, w, h);
}
static void
__glXDRIcontextDestroy(__GLXcontext *baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
+ Bool retval;
+
+ context->driContext.destroyContext(&context->driContext);
+
+ __glXenterServer(GL_FALSE);
+ retval = DRIDestroyContext(baseContext->pScreen, context->hwContextID);
+ __glXleaveServer(GL_FALSE);
- context->driContext.destroyContext(NULL,
- context->base.pScreen->myNum,
- context->driContext.private);
__glXContextDestroy(&context->base);
xfree(context);
}
@@ -292,24 +260,20 @@ static int
__glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
+ __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
+ __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
- return (*context->driContext.bindContext)(NULL,
- context->base.pScreen->myNum,
- baseContext->drawPriv->drawId,
- baseContext->readPriv->drawId,
- &context->driContext);
-}
+ return (*context->driContext.bindContext)(&context->driContext,
+ &draw->driDrawable,
+ &read->driDrawable);
+}
static int
__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
- return (*context->driContext.unbindContext)(NULL,
- context->base.pScreen->myNum,
- baseContext->drawPriv->drawId,
- baseContext->readPriv->drawId,
- &context->driContext);
+ return (*context->driContext.unbindContext)(&context->driContext);
}
static int
@@ -331,12 +295,12 @@ static int
__glXDRIcontextForceCurrent(__GLXcontext *baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
+ __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
+ __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
- return (*context->driContext.bindContext)(NULL,
- context->base.pScreen->myNum,
- baseContext->drawPriv->drawId,
- baseContext->readPriv->drawId,
- &context->driContext);
+ return (*context->driContext.bindContext)(&context->driContext,
+ &draw->driDrawable,
+ &read->driDrawable);
}
static void
@@ -370,15 +334,17 @@ glxFillAlphaChannel (PixmapPtr pixmap, int x, int y, int width, int height)
static int
__glXDRIbindTexImage(__GLXcontext *baseContext,
int buffer,
- __GLXpixmap *glxPixmap)
+ __GLXdrawable *glxPixmap)
{
RegionPtr pRegion = NULL;
PixmapPtr pixmap;
int bpp, override = 0, texname;
GLenum format, type;
- ScreenPtr pScreen = glxPixmap->pScreen;
+ ScreenPtr pScreen = glxPixmap->pDraw->pScreen;
+ __GLXDRIdrawable *driDraw =
+ containerOf(glxPixmap, __GLXDRIdrawable, base);
__GLXDRIscreen * const screen =
- (__GLXDRIscreen *) __glXgetActiveScreen(pScreen->myNum);
+ (__GLXDRIscreen *) glxGetScreen(pScreen);
CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ?
GL_TEXTURE_BINDING_2D :
@@ -390,12 +356,12 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
pixmap = (PixmapPtr) glxPixmap->pDraw;
- if (screen->texOffsetStart && screen->driScreen.setTexOffset) {
- __GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
+ if (screen->texOffsetStart && screen->texOffset) {
+ __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
int i, firstEmpty = 16;
for (i = 0; i < 16; i++) {
- if (texOffsetOverride[i] == glxPixmap)
+ if (texOffsetOverride[i] == driDraw)
goto alreadyin;
if (firstEmpty == 16 && !texOffsetOverride[i])
@@ -410,36 +376,37 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
if (firstEmpty >= screen->lastTexOffsetOverride)
screen->lastTexOffsetOverride = firstEmpty + 1;
- texOffsetOverride[firstEmpty] = glxPixmap;
+ texOffsetOverride[firstEmpty] = driDraw;
alreadyin:
override = 1;
- glxPixmap->pDRICtx = &((__GLXDRIcontext*)baseContext)->driContext;
+ driDraw->ctx = (__GLXDRIcontext*)baseContext;
- if (texname == glxPixmap->texname)
+ if (texname == driDraw->texname)
return Success;
- glxPixmap->texname = texname;
+ driDraw->texname = texname;
- screen->driScreen.setTexOffset(glxPixmap->pDRICtx, texname, 0,
- pixmap->drawable.depth, pixmap->devKind);
+ screen->texOffset->setTexOffset(&driDraw->ctx->driContext, texname, 0,
+ pixmap->drawable.depth,
+ pixmap->devKind);
}
nooverride:
- if (!glxPixmap->pDamage) {
+ if (!driDraw->pDamage) {
if (!override) {
- glxPixmap->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
- TRUE, pScreen, NULL);
- if (!glxPixmap->pDamage)
+ driDraw->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
+ TRUE, pScreen, NULL);
+ if (!driDraw->pDamage)
return BadAlloc;
- DamageRegister ((DrawablePtr) pixmap, glxPixmap->pDamage);
+ DamageRegister ((DrawablePtr) pixmap, driDraw->pDamage);
}
pRegion = NULL;
} else {
- pRegion = DamageRegion(glxPixmap->pDamage);
+ pRegion = DamageRegion(driDraw->pDamage);
if (REGION_NIL(pRegion))
return Success;
}
@@ -518,7 +485,7 @@ nooverride:
}
if (!override)
- DamageEmpty(glxPixmap->pDamage);
+ DamageEmpty(driDraw->pDamage);
return Success;
}
@@ -526,19 +493,21 @@ nooverride:
static int
__glXDRIreleaseTexImage(__GLXcontext *baseContext,
int buffer,
- __GLXpixmap *pixmap)
+ __GLXdrawable *pixmap)
{
- ScreenPtr pScreen = pixmap->pScreen;
+ ScreenPtr pScreen = pixmap->pDraw->pScreen;
+ __GLXDRIdrawable *driDraw =
+ containerOf(pixmap, __GLXDRIdrawable, base);
__GLXDRIscreen * const screen =
- (__GLXDRIscreen *) __glXgetActiveScreen(pScreen->myNum);
+ (__GLXDRIscreen *) glxGetScreen(pScreen);
GLuint lastOverride = screen->lastTexOffsetOverride;
if (lastOverride) {
- __GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
+ __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
int i;
for (i = 0; i < lastOverride; i++) {
- if (texOffsetOverride[i] == pixmap) {
+ if (texOffsetOverride[i] == driDraw) {
if (screen->texOffsetFinish)
screen->texOffsetFinish((PixmapPtr)pixmap->pDraw);
@@ -575,9 +544,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
- screen->driScreen.destroyScreen(NULL,
- screen->base.pScreen->myNum,
- screen->driScreen.private);
+ screen->driScreen.destroyScreen(&screen->driScreen);
dlclose(screen->driver);
@@ -593,13 +560,18 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
- void *sharePrivate;
+ VisualPtr visual;
+ int i;
+ GLboolean retval;
+ __DRIcontext *driShare;
+ drm_context_t hwContext;
+ ScreenPtr pScreen = baseScreen->pScreen;
shareContext = (__GLXDRIcontext *) baseShareContext;
if (shareContext)
- sharePrivate = shareContext->driContext.private;
+ driShare = &shareContext->driContext;
else
- sharePrivate = NULL;
+ driShare = NULL;
context = xalloc(sizeof *context);
if (context == NULL)
@@ -614,25 +586,43 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
context->base.pScreen = screen->base.pScreen;
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
+ /* Find the requested X visual */
+ visual = pScreen->visuals;
+ for (i = 0; i < pScreen->numVisuals; i++, visual++)
+ if (visual->vid == modes->visualID)
+ break;
+ if (i == pScreen->numVisuals)
+ return GL_FALSE;
+
+ context->hwContextID = FakeClientID(0);
+
+ __glXenterServer(GL_FALSE);
+ retval = DRICreateContext(baseScreen->pScreen, visual,
+ context->hwContextID, &hwContext);
+ __glXleaveServer(GL_FALSE);
context->driContext.private =
- screen->driScreen.createNewContext(NULL, modes,
+ screen->driScreen.createNewContext(&screen->driScreen,
+ modes,
0, /* render type */
- sharePrivate,
+ driShare,
+ hwContext,
&context->driContext);
- context->driContext.mode = modes;
-
return &context->base;
}
static __GLXdrawable *
__glXDRIscreenCreateDrawable(__GLXscreen *screen,
DrawablePtr pDraw,
+ int type,
XID drawId,
__GLcontextModes *modes)
{
+ __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
__GLXDRIdrawable *private;
+ GLboolean retval;
+ drm_drawable_t hwDrawable;
private = xalloc(sizeof *private);
if (private == NULL)
@@ -640,7 +630,8 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
memset(private, 0, sizeof *private);
- if (!__glXDrawableInit(&private->base, screen, pDraw, drawId, modes)) {
+ if (!__glXDrawableInit(&private->base, screen,
+ pDraw, type, drawId, modes)) {
xfree(private);
return NULL;
}
@@ -650,21 +641,19 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
-#if 0
- /* FIXME: It would only be natural that we called
- * driScreen->createNewDrawable here but the DRI drivers manage
- * them a little oddly. FIXME: describe this better.*/
+ __glXenterServer(GL_FALSE);
+ retval = DRICreateDrawable(screen->pScreen, serverClient,
+ pDraw, &hwDrawable);
+ __glXleaveServer(GL_FALSE);
/* The last argument is 'attrs', which is used with pbuffers which
* we currently don't support. */
- glxPriv->driDrawable.private =
- (screen->driScreen.createNewDrawable)(NULL, modes,
- drawId,
- &glxPriv->driDrawable,
- 0,
- NULL);
-#endif
+ private->driDrawable.private =
+ (driScreen->driScreen.createNewDrawable)(&driScreen->driScreen,
+ modes,
+ &private->driDrawable,
+ hwDrawable, 0, NULL);
return &private->base;
}
@@ -727,161 +716,28 @@ filter_modes(__GLcontextModes **server_modes,
}
-static void
-enable_glx_extension(void *psc, const char *ext_name)
-{
- __GLXDRIscreen * const screen = (__GLXDRIscreen *) psc;
-
- __glXEnableExtension(screen->glx_enable_bits, ext_name);
-}
-
-
-static __DRIfuncPtr getProcAddress(const char *proc_name)
-{
- if (strcmp(proc_name, "glxEnableExtension") == 0) {
- return (__DRIfuncPtr) enable_glx_extension;
- }
-
- return NULL;
-}
-
-static __DRIscreen *findScreen(__DRInativeDisplay *dpy, int scrn)
-{
- __GLXDRIscreen *screen = (__GLXDRIscreen *) __glXgetActiveScreen(scrn);
-
- return &screen->driScreen;
-}
-
-static GLboolean windowExists(__DRInativeDisplay *dpy, __DRIid draw)
-{
- DrawablePtr pDrawable = (DrawablePtr) LookupIDByType(draw, RT_WINDOW);
- int unused;
- drm_clip_rect_t *pRects;
-
- return pDrawable ? DRIGetDrawableInfo(pDrawable->pScreen, pDrawable,
- (unsigned*)&unused, (unsigned*)&unused,
- &unused, &unused, &unused, &unused,
- &unused, &pRects, &unused, &unused,
- &unused, &pRects)
- : GL_FALSE;
-}
-
-static GLboolean createContext(__DRInativeDisplay *dpy, int screen,
- int configID, void *contextID,
- drm_context_t *hw_context)
-{
- XID fakeID;
- VisualPtr visual;
- int i;
- ScreenPtr pScreen;
- GLboolean retval;
-
- pScreen = screenInfo.screens[screen];
-
- /* Find the requested X visual */
- visual = pScreen->visuals;
- for (i = 0; i < pScreen->numVisuals; i++, visual++)
- if (visual->vid == configID)
- break;
- if (i == pScreen->numVisuals)
- return GL_FALSE;
-
- fakeID = FakeClientID(0);
- *(XID *) contextID = fakeID;
-
- __glXDRIenterServer(GL_FALSE);
- retval = DRICreateContext(pScreen, visual, fakeID, hw_context);
- __glXDRIleaveServer(GL_FALSE);
- return retval;
-}
-
-static GLboolean destroyContext(__DRInativeDisplay *dpy, int screen,
- __DRIid context)
-{
- GLboolean retval;
-
- __glXDRIenterServer(GL_FALSE);
- retval = DRIDestroyContext(screenInfo.screens[screen], context);
- __glXDRIleaveServer(GL_FALSE);
- return retval;
-}
-
-static GLboolean
-createDrawable(__DRInativeDisplay *dpy, int screen,
- __DRIid drawable, drm_drawable_t *hHWDrawable)
-{
- DrawablePtr pDrawable;
- GLboolean retval;
-
- pDrawable = (DrawablePtr) LookupIDByClass(drawable, RC_DRAWABLE);
- if (!pDrawable)
- return GL_FALSE;
-
- __glXDRIenterServer(GL_FALSE);
- retval = DRICreateDrawable(screenInfo.screens[screen], __pGlxClient,
- pDrawable, hHWDrawable);
- __glXDRIleaveServer(GL_FALSE);
- return retval;
-}
-
-static GLboolean
-destroyDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable)
-{
- DrawablePtr pDrawable;
- GLboolean retval;
-
- pDrawable = (DrawablePtr) LookupIDByClass(drawable, RC_DRAWABLE);
- if (!pDrawable)
- return GL_FALSE;
-
- __glXDRIenterServer(GL_FALSE);
- retval = DRIDestroyDrawable(screenInfo.screens[screen], __pGlxClient,
- pDrawable);
- __glXDRIleaveServer(GL_FALSE);
- return retval;
-}
-
static GLboolean
-getDrawableInfo(__DRInativeDisplay *dpy, int screen,
- __DRIid drawable, unsigned int *index, unsigned int *stamp,
+getDrawableInfo(__DRIdrawable *driDrawable,
+ unsigned int *index, unsigned int *stamp,
int *x, int *y, int *width, int *height,
int *numClipRects, drm_clip_rect_t **ppClipRects,
int *backX, int *backY,
int *numBackClipRects, drm_clip_rect_t **ppBackClipRects)
{
- DrawablePtr pDrawable;
+ __GLXDRIdrawable *drawable = containerOf(driDrawable,
+ __GLXDRIdrawable, driDrawable);
+ ScreenPtr pScreen = drawable->base.pDraw->pScreen;
drm_clip_rect_t *pClipRects, *pBackClipRects;
GLboolean retval;
size_t size;
- pDrawable = (DrawablePtr) LookupIDByClass(drawable, RC_DRAWABLE);
- if (!pDrawable) {
- ErrorF("getDrawableInfo failed to look up window\n");
-
- *index = 0;
- *stamp = 0;
- *x = 0;
- *y = 0;
- *width = 0;
- *height = 0;
- *numClipRects = 0;
- *ppClipRects = NULL;
- *backX = 0;
- *backY = 0;
- *numBackClipRects = 0;
- *ppBackClipRects = NULL;
-
- return GL_FALSE;
- }
-
- __glXDRIenterServer(GL_FALSE);
- retval = DRIGetDrawableInfo(screenInfo.screens[screen],
- pDrawable, index, stamp,
+ __glXenterServer(GL_FALSE);
+ retval = DRIGetDrawableInfo(pScreen, drawable->base.pDraw, index, stamp,
x, y, width, height,
numClipRects, &pClipRects,
backX, backY,
numBackClipRects, &pBackClipRects);
- __glXDRIleaveServer(GL_FALSE);
+ __glXleaveServer(GL_FALSE);
if (*numClipRects > 0) {
size = sizeof (drm_clip_rect_t) * *numClipRects;
@@ -889,7 +745,6 @@ getDrawableInfo(__DRInativeDisplay *dpy, int screen,
/* Clip cliprects to screen dimensions (redirected windows) */
if (*ppClipRects != NULL) {
- ScreenPtr pScreen = screenInfo.screens[screen];
int i, j;
for (i = 0, j = 0; i < *numClipRects; i++) {
@@ -946,25 +801,33 @@ getUST(int64_t *ust)
}
}
+static void __glXReportDamage(__DRIdrawable *driDraw,
+ int x, int y,
+ drm_clip_rect_t *rects, int num_rects,
+ GLboolean front_buffer)
+{
+ __GLXDRIdrawable *drawable =
+ containerOf(driDraw, __GLXDRIdrawable, driDrawable);
+ DrawablePtr pDraw = drawable->base.pDraw;
+ RegionRec region;
+
+ REGION_INIT(pDraw->pScreen, &region, (BoxPtr) rects, num_rects);
+ REGION_TRANSLATE(pScreen, &region, pDraw->x, pDraw->y);
+ DamageDamageRegion(pDraw, &region);
+ REGION_UNINIT(pDraw->pScreen, &region);
+}
+
/* Table of functions that we export to the driver. */
static const __DRIinterfaceMethods interface_methods = {
- getProcAddress,
-
_gl_context_modes_create,
_gl_context_modes_destroy,
-
- findScreen,
- windowExists,
-
- createContext,
- destroyContext,
- createDrawable,
- destroyDrawable,
getDrawableInfo,
getUST,
NULL, /* glXGetMscRateOML, */
+
+ __glXReportDamage,
};
static const char dri_driver_path[] = DRI_DRIVER_PATH;
@@ -972,7 +835,8 @@ static const char dri_driver_path[] = DRI_DRIVER_PATH;
static Bool
glxDRIEnterVT (int index, int flags)
{
- __GLXDRIscreen *screen = (__GLXDRIscreen *) __glXgetActiveScreen(index);
+ __GLXDRIscreen *screen = (__GLXDRIscreen *)
+ glxGetScreen(screenInfo.screens[index]);
LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
@@ -987,7 +851,8 @@ glxDRIEnterVT (int index, int flags)
static void
glxDRILeaveVT (int index, int flags)
{
- __GLXDRIscreen *screen = (__GLXDRIscreen *) __glXgetActiveScreen(index);
+ __GLXDRIscreen *screen = (__GLXDRIscreen *)
+ glxGetScreen(screenInfo.screens[index]);
LogMessage(X_INFO, "AIGLX: Suspending AIGLX clients for VT switch\n");
@@ -996,6 +861,48 @@ glxDRILeaveVT (int index, int flags)
return (*screen->leaveVT) (index, flags);
}
+static void
+initializeExtensions(__GLXDRIscreen *screen)
+{
+ const __DRIextension **extensions;
+ int i;
+
+ extensions = screen->driScreen.getExtensions(&screen->driScreen);
+ for (i = 0; extensions[i]; i++) {
+#ifdef __DRI_COPY_SUB_BUFFER
+ if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
+ screen->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_MESA_copy_sub_buffer");
+
+ LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
+ }
+#endif
+
+#ifdef __DRI_SWAP_CONTROL
+ if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
+ screen->swapControl = (__DRIswapControlExtension *) extensions[i];
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGI_swap_control");
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_MESA_swap_control");
+
+ LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
+ }
+#endif
+
+#ifdef __DRI_TEX_OFFSET
+ if (strcmp(extensions[i]->name, __DRI_TEX_OFFSET) == 0) {
+ screen->texOffset = (__DRItexOffsetExtension *) extensions[i];
+ LogMessage(X_INFO, "AIGLX: enabled GLX_texture_from_pixmap with driver support\n");
+ }
+#endif
+ /* Ignore unknown extensions */
+ }
+}
+
+#define COPY_SUB_BUFFER_INTERNAL_VERSION 20060314
+
static __GLXscreen *
__glXDRIscreenProbe(ScreenPtr pScreen)
{
@@ -1044,8 +951,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
screen->base.pScreen = pScreen;
__glXInitExtensionEnableBits(screen->glx_enable_bits);
- screen->driScreen.screenConfigs = screen;
-
/* DRI protocol version. */
dri_version.major = XF86DRI_MAJOR_VERSION;
@@ -1170,9 +1075,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
driver_modes = NULL;
screen->driScreen.private =
- (*createNewScreen)(NULL, pScreen->myNum,
+ (*createNewScreen)(pScreen->myNum,
&screen->driScreen,
- screen->base.modes,
&ddx_version,
&dri_version,
&drm_version,
@@ -1191,6 +1095,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart,
&screen->texOffsetFinish);
+ initializeExtensions(screen);
+
__glXScreenInit(&screen->base, pScreen);
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
diff --git a/GL/glx/glxext.c b/GL/glx/glxext.c
index b35175ed2..4d6bfd7c6 100644
--- a/GL/glx/glxext.c
+++ b/GL/glx/glxext.c
@@ -45,8 +45,6 @@ __GLXcontext *__glXLastContext;
** X resources.
*/
RESTYPE __glXContextRes;
-RESTYPE __glXClientRes;
-RESTYPE __glXPixmapRes;
RESTYPE __glXDrawableRes;
RESTYPE __glXSwapBarrierRes;
@@ -55,11 +53,7 @@ RESTYPE __glXSwapBarrierRes;
*/
xGLXSingleReply __glXReply;
-/*
-** A set of state for each client. The 0th one is unused because client
-** indices start at 1, not 0.
-*/
-static __GLXclientState *__glXClients[MAXCLIENTS + 1];
+static int glxClientPrivateIndex;
/*
** Client that called into GLX dispatch.
@@ -77,29 +71,6 @@ static int __glXDispatch(ClientPtr);
static void ResetExtension(ExtensionEntry* extEntry)
{
__glXFlushContextCache();
- __glXResetScreens();
-}
-
-/*
-** Initialize the per-client context storage.
-*/
-static void ResetClientState(int clientIndex)
-{
- __GLXclientState *cl = __glXClients[clientIndex];
-
- if (cl->returnBuf) xfree(cl->returnBuf);
- if (cl->largeCmdBuf) xfree(cl->largeCmdBuf);
- if (cl->currentContexts) xfree(cl->currentContexts);
- memset(cl, 0, sizeof(__GLXclientState));
- /*
- ** By default, assume that the client supports
- ** GLX major version 1 minor version 0 protocol.
- */
- cl->GLClientmajorVersion = 1;
- cl->GLClientminorVersion = 0;
- if (cl->GLClientextensions)
- xfree(cl->GLClientextensions);
-
}
/*
@@ -130,66 +101,6 @@ static int ContextGone(__GLXcontext* cx, XID id)
}
/*
-** Free a client's state.
-*/
-static int ClientGone(int clientIndex, XID id)
-{
- __GLXcontext *cx;
- __GLXclientState *cl = __glXClients[clientIndex];
- int i;
-
- if (cl) {
- /*
- ** Free all the contexts that are current for this client.
- */
- for (i=0; i < cl->numCurrentContexts; i++) {
- cx = cl->currentContexts[i];
- if (cx) {
- __glXDeassociateContext(cx);
- cx->isCurrent = GL_FALSE;
- if (!cx->idExists) {
- __glXFreeContext(cx);
- }
- }
- }
- /*
- ** Re-initialize the client state structure. Don't free it because
- ** we'll probably get another client with this index and use the struct
- ** again. There is a maximum of MAXCLIENTS of these structures.
- */
- ResetClientState(clientIndex);
- }
-
- return True;
-}
-
-/*
-** Free a GLX Pixmap.
-*/
-static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id)
-{
- PixmapPtr pPixmap = (PixmapPtr) pGlxPixmap->pDraw;
-
- pGlxPixmap->idExists = False;
- if (!pGlxPixmap->refcnt) {
-#ifdef XF86DRI
- if (pGlxPixmap->pDamage) {
- DamageUnregister (pGlxPixmap->pDraw, pGlxPixmap->pDamage);
- DamageDestroy(pGlxPixmap->pDamage);
- }
-#endif
- /*
- ** The DestroyPixmap routine should decrement the refcount and free
- ** only if it's zero.
- */
- (*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap);
- xfree(pGlxPixmap);
- }
-
- return True;
-}
-
-/*
** Destroy routine that gets called when a drawable is freed. A drawable
** contains the ancillary buffers needed for rendering.
*/
@@ -198,24 +109,17 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
__GLXcontext *cx, *cx1;
/*
- ** Use glxPriv->type to figure out what kind of drawable this is. Don't
- ** use glxPriv->pDraw->type because by the time this routine is called,
- ** the pDraw might already have been freed.
+ ** When a drawable is destroyed, notify all context bound to
+ ** it, that there are no longer bound to anything.
*/
- if (glxPriv->type == DRAWABLE_WINDOW) {
- /*
- ** When a window is destroyed, notify all context bound to
- ** it, that there are no longer bound to anything.
- */
- for (cx = glxPriv->drawGlxc; cx; cx = cx1) {
- cx1 = cx->nextDrawPriv;
- cx->pendingState |= __GLX_PENDING_DESTROY;
- }
+ for (cx = glxPriv->drawGlxc; cx; cx = cx1) {
+ cx1 = cx->nextDrawPriv;
+ cx->pendingState |= __GLX_PENDING_DESTROY;
+ }
- for (cx = glxPriv->readGlxc; cx; cx = cx1) {
- cx1 = cx->nextReadPriv;
- cx->pendingState |= __GLX_PENDING_DESTROY;
- }
+ for (cx = glxPriv->readGlxc; cx; cx = cx1) {
+ cx1 = cx->nextReadPriv;
+ cx->pendingState |= __GLX_PENDING_DESTROY;
}
__glXUnrefDrawable(glxPriv);
@@ -260,9 +164,10 @@ extern RESTYPE __glXSwapBarrierRes;
static int SwapBarrierGone(int screen, XID drawable)
{
- if (__glXSwapBarrierFuncs &&
- __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc != NULL) {
- __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc(screen, drawable, 0);
+ __GLXscreen *pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
+
+ if (pGlxScreen->swapBarrierFuncs) {
+ pGlxScreen->swapBarrierFuncs->bindSwapBarrierFunc(screen, drawable, 0);
}
FreeResourceByType(drawable, __glXSwapBarrierRes, FALSE);
return True;
@@ -310,22 +215,86 @@ int __glXError(int error)
return __glXErrorBase + error;
}
+__GLXclientState *
+glxGetClient(ClientPtr pClient)
+{
+ return (__GLXclientState *) pClient->devPrivates[glxClientPrivateIndex].ptr;
+}
+
+static void
+glxClientCallback (CallbackListPtr *list,
+ pointer closure,
+ pointer data)
+{
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+ __GLXclientState *cl = glxGetClient(pClient);
+ __GLXcontext *cx;
+ int i;
+
+ switch (pClient->clientState) {
+ case ClientStateRunning:
+ /*
+ ** By default, assume that the client supports
+ ** GLX major version 1 minor version 0 protocol.
+ */
+ cl->GLClientmajorVersion = 1;
+ cl->GLClientminorVersion = 0;
+ cl->client = pClient;
+ break;
+
+ case ClientStateGone:
+ for (i = 0; i < cl->numCurrentContexts; i++) {
+ cx = cl->currentContexts[i];
+ if (cx) {
+ cx->isCurrent = GL_FALSE;
+ if (!cx->idExists)
+ __glXFreeContext(cx);
+ }
+ }
+
+ if (cl->returnBuf) xfree(cl->returnBuf);
+ if (cl->largeCmdBuf) xfree(cl->largeCmdBuf);
+ if (cl->currentContexts) xfree(cl->currentContexts);
+ if (cl->GLClientextensions) xfree(cl->GLClientextensions);
+ break;
+
+ default:
+ break;
+ }
+}
+
/************************************************************************/
+static __GLXprovider *__glXProviderStack;
+
+void GlxPushProvider(__GLXprovider *provider)
+{
+ provider->next = __glXProviderStack;
+ __glXProviderStack = provider;
+}
+
/*
** Initialize the GLX extension.
*/
void GlxExtensionInit(void)
{
ExtensionEntry *extEntry;
+ ScreenPtr pScreen;
int i;
+ __GLXprovider *p;
__glXContextRes = CreateNewResourceType((DeleteType)ContextGone);
- __glXClientRes = CreateNewResourceType((DeleteType)ClientGone);
- __glXPixmapRes = CreateNewResourceType((DeleteType)PixmapGone);
__glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
__glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone);
+ glxClientPrivateIndex = AllocateClientPrivateIndex ();
+ if (!AllocateClientPrivate (glxClientPrivateIndex,
+ sizeof (__GLXclientState)))
+ return;
+ if (!AddCallback (&ClientStateCallback, glxClientCallback, 0))
+ return;
+
/*
** Add extension to server extensions.
*/
@@ -344,17 +313,18 @@ void GlxExtensionInit(void)
__glXErrorBase = extEntry->errorBase;
- /*
- ** Initialize table of client state. There is never a client 0.
- */
- for (i = 1; i <= MAXCLIENTS; i++) {
- __glXClients[i] = 0;
- }
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
- /*
- ** Initialize screen specific data.
- */
- __glXInitScreens();
+ for (p = __glXProviderStack; p != NULL; p = p->next) {
+ if (p->screenProbe(pScreen) != NULL) {
+ LogMessage(X_INFO,
+ "GLX: Initialized %s GL provider for screen %d\n",
+ p->name, i);
+ break;
+ }
+ }
+ }
}
/************************************************************************/
@@ -422,11 +392,9 @@ void glxSuspendClients(void)
{
int i;
- for (i = 1; i <= MAXCLIENTS; i++) {
- if (__glXClients[i] == NULL || !__glXClients[i]->inUse)
- continue;
-
- IgnoreClient(__glXClients[i]->client);
+ for (i = 1; i < currentMaxClients; i++) {
+ if (glxGetClient(clients[i])->inUse)
+ IgnoreClient(clients[i]);
}
glxBlockClients = TRUE;
@@ -439,11 +407,9 @@ void glxResumeClients(void)
glxBlockClients = FALSE;
- for (i = 1; i <= MAXCLIENTS; i++) {
- if (__glXClients[i] == NULL || !__glXClients[i]->inUse)
- continue;
-
- AttendClient(__glXClients[i]->client);
+ for (i = 1; i < currentMaxClients; i++) {
+ if (glxGetClient(clients[i])->inUse)
+ AttendClient(clients[i]);
}
__glXleaveServer(GL_FALSE);
@@ -505,29 +471,9 @@ static int __glXDispatch(ClientPtr client)
int retval;
opcode = stuff->glxCode;
- cl = __glXClients[client->index];
- if (!cl) {
- cl = (__GLXclientState *) xalloc(sizeof(__GLXclientState));
- __glXClients[client->index] = cl;
- if (!cl) {
- return BadAlloc;
- }
- memset(cl, 0, sizeof(__GLXclientState));
- }
-
- if (!cl->inUse) {
- /*
- ** This is first request from this client. Associate a resource
- ** with the client so we will be notified when the client dies.
- */
- XID xid = FakeClientID(client->index);
- if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) {
- return BadAlloc;
- }
- ResetClientState(client->index);
- cl->inUse = GL_TRUE;
- cl->client = client;
- }
+ cl = glxGetClient(client);
+ /* Mark it in use so we suspend it on VT switch. */
+ cl->inUse = TRUE;
/*
** If we're expecting a glXRenderLarge request, this better be one.
diff --git a/GL/glx/glxext.h b/GL/glx/glxext.h
index 6774e4d4c..a81850cef 100644
--- a/GL/glx/glxext.h
+++ b/GL/glx/glxext.h
@@ -71,24 +71,6 @@ extern void __glXClearErrorOccured(void);
extern GLboolean __glXErrorOccured(void);
extern void __glXResetLargeCommandStatus(__GLXclientState*);
-extern int DoMakeCurrent( __GLXclientState *cl, GLXDrawable drawId,
- GLXDrawable readId, GLXContextID contextId, GLXContextTag tag );
-extern int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen,
- GLboolean do_swap);
-extern int DoGetFBConfigs(__GLXclientState *cl, unsigned screen,
- GLboolean do_swap);
-extern int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
- GLXContextID shareList, VisualID visual, GLuint screen, GLboolean isDirect);
-extern int DoCreateGLXPixmap(__GLXclientState *cl, XID fbconfigId,
- GLuint screenNum, XID pixmapId, XID glxpixmapId, CARD32 *attribs,
- CARD32 numAttribs);
-extern int DoDestroyPixmap(__GLXclientState *cl, XID glxpixmapId);
-
-extern int DoQueryContext(__GLXclientState *cl, GLXContextID gcId);
-
-extern int DoRender(__GLXclientState *cl, GLbyte *pc, int do_swap);
-extern int DoRenderLarge(__GLXclientState *cl, GLbyte *pc, int do_swap);
-
extern void GlxExtensionInit(void);
extern const char GLServerVersion[];
@@ -106,25 +88,5 @@ extern int GlxInitVisuals(
int preferredVis
);
-typedef struct {
- void * (* queryHyperpipeNetworkFunc)(int, int *, int *);
- void * (* queryHyperpipeConfigFunc)(int, int, int *, int *);
- int (* destroyHyperpipeConfigFunc)(int, int);
- void * (* hyperpipeConfigFunc)(int, int, int *, int *, void *);
-} __GLXHyperpipeExtensionFuncs;
-
-extern void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs);
-
-extern __GLXHyperpipeExtensionFuncs *__glXHyperpipeFuncs;
-
-typedef struct {
- int (* bindSwapBarrierFunc)(int, XID, int);
- int (* queryMaxSwapBarriersFunc)(int);
-} __GLXSwapBarrierExtensionFuncs;
-
-extern void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs);
-
-extern __GLXSwapBarrierExtensionFuncs *__glXSwapBarrierFuncs;
-
#endif /* _glxext_h_ */
diff --git a/GL/glx/glxglcore.c b/GL/glx/glxglcore.c
index 679d55c5d..fd4e57d59 100644
--- a/GL/glx/glxglcore.c
+++ b/GL/glx/glxglcore.c
@@ -118,7 +118,7 @@ __glXMesaDrawableSwapBuffers(__GLXdrawable *base)
static __GLXdrawable *
__glXMesaScreenCreateDrawable(__GLXscreen *screen,
- DrawablePtr pDraw,
+ DrawablePtr pDraw, int type,
XID drawId,
__GLcontextModes *modes)
{
@@ -131,7 +131,8 @@ __glXMesaScreenCreateDrawable(__GLXscreen *screen,
memset(glxPriv, 0, sizeof *glxPriv);
- if (!__glXDrawableInit(&glxPriv->base, screen, pDraw, drawId, modes)) {
+ if (!__glXDrawableInit(&glxPriv->base, screen,
+ pDraw, type, drawId, modes)) {
xfree(glxPriv);
return NULL;
}
diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c
index 43447a4e4..c6f060b3d 100644
--- a/GL/glx/glxscreens.c
+++ b/GL/glx/glxscreens.c
@@ -45,6 +45,8 @@
#include "glxutil.h"
#include "glxext.h"
+static int glxScreenPrivateIndex;
+
const char GLServerVersion[] = "1.4";
static const char GLServerExtensions[] =
"GL_ARB_depth_texture "
@@ -179,36 +181,25 @@ static char GLXServerExtensions[] =
"GLX_MESA_copy_sub_buffer "
;
-__GLXscreen **__glXActiveScreens;
-
-__GLXSwapBarrierExtensionFuncs *__glXSwapBarrierFuncs = NULL;
-static int __glXNumSwapBarrierFuncs = 0;
-__GLXHyperpipeExtensionFuncs *__glXHyperpipeFuncs = NULL;
-static int __glXNumHyperpipeFuncs = 0;
-
-__GLXscreen *__glXgetActiveScreen(int num) {
- return __glXActiveScreens[num];
-}
-
-
/*
** This hook gets called when a window moves or changes size.
*/
-static Bool PositionWindow(WindowPtr pWin, int x, int y)
+static Bool glxPositionWindow(WindowPtr pWin, int x, int y)
{
ScreenPtr pScreen;
__GLXcontext *glxc;
__GLXdrawable *glxPriv;
Bool ret;
+ __GLXscreen *pGlxScreen;
/*
** Call wrapped position window routine
*/
pScreen = pWin->drawable.pScreen;
- pScreen->PositionWindow =
- __glXActiveScreens[pScreen->myNum]->WrappedPositionWindow;
+ pGlxScreen = glxGetScreen(pScreen);
+ pScreen->PositionWindow = pGlxScreen->PositionWindow;
ret = (*pScreen->PositionWindow)(pWin, x, y);
- pScreen->PositionWindow = PositionWindow;
+ pScreen->PositionWindow = glxPositionWindow;
/*
** Tell all contexts rendering into this window that the window size
@@ -259,110 +250,71 @@ static Bool PositionWindow(WindowPtr pWin, int x, int y)
void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs)
{
- if (__glXNumHyperpipeFuncs < screen + 1) {
- __glXHyperpipeFuncs = xrealloc(__glXHyperpipeFuncs,
- (screen+1) * sizeof(__GLXHyperpipeExtensionFuncs));
- __glXNumHyperpipeFuncs = screen + 1;
- }
+ __GLXscreen *pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
- __glXHyperpipeFuncs[screen].queryHyperpipeNetworkFunc =
- *funcs->queryHyperpipeNetworkFunc;
- __glXHyperpipeFuncs[screen].queryHyperpipeConfigFunc =
- *funcs->queryHyperpipeConfigFunc;
- __glXHyperpipeFuncs[screen].destroyHyperpipeConfigFunc =
- *funcs->destroyHyperpipeConfigFunc;
- __glXHyperpipeFuncs[screen].hyperpipeConfigFunc =
- *funcs->hyperpipeConfigFunc;
+ pGlxScreen->hyperpipeFuncs = funcs;
}
void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs)
{
- if (__glXNumSwapBarrierFuncs < screen + 1) {
- __glXSwapBarrierFuncs = xrealloc(__glXSwapBarrierFuncs,
- (screen+1) * sizeof(__GLXSwapBarrierExtensionFuncs));
- __glXNumSwapBarrierFuncs = screen + 1;
- }
+ __GLXscreen *pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
- __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc =
- funcs->bindSwapBarrierFunc;
- __glXSwapBarrierFuncs[screen].queryMaxSwapBarriersFunc =
- funcs->queryMaxSwapBarriersFunc;
+ pGlxScreen->swapBarrierFuncs = funcs;
}
-static __GLXprovider *__glXProviderStack;
-
-void GlxPushProvider(__GLXprovider *provider)
+static Bool
+glxCloseScreen (int index, ScreenPtr pScreen)
{
- provider->next = __glXProviderStack;
- __glXProviderStack = provider;
-}
+ __GLXscreen *pGlxScreen = glxGetScreen(pScreen);
-void __glXScreenInit(__GLXscreen *screen, ScreenPtr pScreen)
-{
- screen->pScreen = pScreen;
- screen->GLextensions = xstrdup(GLServerExtensions);
- screen->GLXvendor = xstrdup(GLXServerVendorName);
- screen->GLXversion = xstrdup(GLXServerVersion);
- screen->GLXextensions = xstrdup(GLXServerExtensions);
+ pScreen->CloseScreen = pGlxScreen->CloseScreen;
+ pScreen->PositionWindow = pGlxScreen->PositionWindow;
- screen->WrappedPositionWindow = pScreen->PositionWindow;
- pScreen->PositionWindow = PositionWindow;
+ pGlxScreen->destroy(pGlxScreen);
- __glXScreenInitVisuals(screen);
+ return pScreen->CloseScreen(index, pScreen);
}
-void
-__glXScreenDestroy(__GLXscreen *screen)
+__GLXscreen *
+glxGetScreen(ScreenPtr pScreen)
{
- xfree(screen->GLXvendor);
- xfree(screen->GLXversion);
- xfree(screen->GLXextensions);
- xfree(screen->GLextensions);
+ return (__GLXscreen *) pScreen->devPrivates[glxScreenPrivateIndex].ptr;
}
-void __glXInitScreens(void)
+void __glXScreenInit(__GLXscreen *glxScreen, ScreenPtr pScreen)
{
- GLint i;
- ScreenPtr pScreen;
- __GLXprovider *p;
- size_t size;
+ static int glxGeneration;
- /*
- ** This alloc has to work or else the server might as well core dump.
- */
- size = screenInfo.numScreens * sizeof(__GLXscreen *);
- __glXActiveScreens = xalloc(size);
- memset(__glXActiveScreens, 0, size);
-
- for (i = 0; i < screenInfo.numScreens; i++) {
- pScreen = screenInfo.screens[i];
+ if (glxGeneration != serverGeneration)
+ {
+ glxScreenPrivateIndex = AllocateScreenPrivateIndex ();
+ if (glxScreenPrivateIndex == -1)
+ return;
- for (p = __glXProviderStack; p != NULL; p = p->next) {
- __glXActiveScreens[i] = p->screenProbe(pScreen);
- if (__glXActiveScreens[i] != NULL) {
- LogMessage(X_INFO,
- "GLX: Initialized %s GL provider for screen %d\n",
- p->name, i);
- break;
- }
- }
+ glxGeneration = serverGeneration;
}
-}
-void __glXResetScreens(void)
-{
- int i;
+ glxScreen->pScreen = pScreen;
+ glxScreen->GLextensions = xstrdup(GLServerExtensions);
+ glxScreen->GLXvendor = xstrdup(GLXServerVendorName);
+ glxScreen->GLXversion = xstrdup(GLXServerVersion);
+ glxScreen->GLXextensions = xstrdup(GLXServerExtensions);
+
+ glxScreen->PositionWindow = pScreen->PositionWindow;
+ pScreen->PositionWindow = glxPositionWindow;
+
+ glxScreen->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = glxCloseScreen;
- for (i = 0; i < screenInfo.numScreens; i++)
- if (__glXActiveScreens[i])
- __glXActiveScreens[i]->destroy(__glXActiveScreens[i]);
+ __glXScreenInitVisuals(glxScreen);
- xfree(__glXActiveScreens);
- xfree(__glXHyperpipeFuncs);
- xfree(__glXSwapBarrierFuncs);
- __glXNumHyperpipeFuncs = 0;
- __glXNumSwapBarrierFuncs = 0;
- __glXHyperpipeFuncs = NULL;
- __glXSwapBarrierFuncs = NULL;
- __glXActiveScreens = NULL;
+ pScreen->devPrivates[glxScreenPrivateIndex].ptr = (pointer) glxScreen;
+}
+
+void __glXScreenDestroy(__GLXscreen *screen)
+{
+ xfree(screen->GLXvendor);
+ xfree(screen->GLXversion);
+ xfree(screen->GLXextensions);
+ xfree(screen->GLextensions);
}
diff --git a/GL/glx/glxscreens.h b/GL/glx/glxscreens.h
index bba45572f..7b1bbcd58 100644
--- a/GL/glx/glxscreens.h
+++ b/GL/glx/glxscreens.h
@@ -42,6 +42,21 @@
#include "GL/internal/glcore.h"
+typedef struct {
+ void * (* queryHyperpipeNetworkFunc)(int, int *, int *);
+ void * (* queryHyperpipeConfigFunc)(int, int, int *, int *);
+ int (* destroyHyperpipeConfigFunc)(int, int);
+ void * (* hyperpipeConfigFunc)(int, int, int *, int *, void *);
+} __GLXHyperpipeExtensionFuncs;
+
+typedef struct {
+ int (* bindSwapBarrierFunc)(int, XID, int);
+ int (* queryMaxSwapBarriersFunc)(int);
+} __GLXSwapBarrierExtensionFuncs;
+
+void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs);
+void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs);
+
/*
** Screen dependent data. These methods are the interface between the DIX
** and DDX layers of the GLX server extension. The methods provide an
@@ -57,11 +72,15 @@ struct __GLXscreen {
__GLXdrawable *(*createDrawable)(__GLXscreen *context,
DrawablePtr pDraw,
+ int type,
XID drawId,
__GLcontextModes *modes);
int (*swapInterval) (__GLXdrawable *drawable,
int interval);
+ __GLXHyperpipeExtensionFuncs *hyperpipeFuncs;
+ __GLXSwapBarrierExtensionFuncs *swapBarrierFuncs;
+
ScreenPtr pScreen;
/**
@@ -79,18 +98,12 @@ struct __GLXscreen {
char *GLXversion;
char *GLXextensions;
- /*
- ** Things that are not statically set.
- */
- Bool (*WrappedPositionWindow)(WindowPtr pWin, int x, int y);
-
+ Bool (*PositionWindow)(WindowPtr pWin, int x, int y);
+ Bool (*CloseScreen)(int index, ScreenPtr pScreen);
};
void __glXScreenInit(__GLXscreen *screen, ScreenPtr pScreen);
void __glXScreenDestroy(__GLXscreen *screen);
-void __glXInitScreens(void);
-extern void __glXResetScreens(void);
-
#endif /* !__GLX_screens_h__ */
diff --git a/GL/glx/glxserver.h b/GL/glx/glxserver.h
index b6b55927e..45de8e794 100644
--- a/GL/glx/glxserver.h
+++ b/GL/glx/glxserver.h
@@ -90,9 +90,8 @@ typedef XID GLXDrawable;
typedef struct __GLXclientStateRec __GLXclientState;
-extern __GLXscreen **__glXActiveScreens;
-extern GLint __glXNumActiveScreens;
-extern __GLXscreen *__glXgetActiveScreen(int num);
+extern __GLXscreen *glxGetScreen(ScreenPtr pScreen);
+extern __GLXclientState *glxGetClient(ClientPtr pClient);
/************************************************************************/
diff --git a/GL/glx/glxutil.c b/GL/glx/glxutil.c
index 1f172929f..f531ed954 100644
--- a/GL/glx/glxutil.c
+++ b/GL/glx/glxutil.c
@@ -139,18 +139,15 @@ __glXUnrefDrawable(__GLXdrawable *glxPriv)
GLboolean
__glXDrawableInit(__GLXdrawable *drawable,
- __GLXscreen *screen, DrawablePtr pDraw, XID drawId,
- __GLcontextModes *modes)
+ __GLXscreen *screen, DrawablePtr pDraw, int type,
+ XID drawId, __GLcontextModes *modes)
{
- drawable->type = pDraw->type;
drawable->pDraw = pDraw;
+ drawable->type = type;
drawable->drawId = drawId;
drawable->refCount = 1;
drawable->modes = modes;
-
- /* if not a pixmap, lookup will fail, so pGlxPixmap will be NULL */
- drawable->pGlxPixmap = (__GLXpixmap *)
- LookupIDByType(drawId, __glXPixmapRes);
+ drawable->eventMask = 0;
return GL_TRUE;
}
diff --git a/GL/glx/glxutil.h b/GL/glx/glxutil.h
index 1937ef2cf..6534c3f94 100644
--- a/GL/glx/glxutil.h
+++ b/GL/glx/glxutil.h
@@ -50,7 +50,7 @@ extern void __glXUnrefDrawable(__GLXdrawable *glxPriv);
extern GLboolean __glXDrawableInit(__GLXdrawable *drawable,
__GLXscreen *screen,
- DrawablePtr pDraw, XID drawID,
+ DrawablePtr pDraw, int type, XID drawID,
__GLcontextModes *modes);
/* context helper routines */
diff --git a/GL/glx/glxvisuals.c b/GL/glx/glxvisuals.c
index 0e9bdedec..46b380b3d 100644
--- a/GL/glx/glxvisuals.c
+++ b/GL/glx/glxvisuals.c
@@ -55,6 +55,7 @@
void GlxWrapInitVisuals(miInitVisualsProcPtr *);
+extern Bool noGlxVisualInit;
#include "glcontextmodes.h"
struct ScreenVisualsRec {
@@ -452,14 +453,15 @@ Bool GlxInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
/*
* Setup the visuals supported by this particular screen.
*/
- init_visuals(nvisualp, visualp, defaultVisp,
- *ndepthp, *depthp, *rootDepthp);
+ if (!noGlxVisualInit) {
+ init_visuals(nvisualp, visualp, defaultVisp,
+ *ndepthp, *depthp, *rootDepthp);
+ }
return True;
}
-
/************************************************************************/
diff --git a/GL/glx/indirect_dispatch.h b/GL/glx/indirect_dispatch.h
index 24f4bed43..bb39638fd 100644
--- a/GL/glx/indirect_dispatch.h
+++ b/GL/glx/indirect_dispatch.h
@@ -207,6 +207,8 @@ extern HIDDEN void __glXDisp_TexCoord2iv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_TexCoord2iv(GLbyte * pc);
extern HIDDEN void __glXDisp_CompressedTexImage1DARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_CompressedTexImage1DARB(GLbyte * pc);
+extern HIDDEN void __glXDisp_Rotated(GLbyte * pc);
+extern HIDDEN void __glXDispSwap_Rotated(GLbyte * pc);
extern HIDDEN int __glXDisp_ReadPixels(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_ReadPixels(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_EdgeFlagv(GLbyte * pc);
@@ -293,8 +295,8 @@ extern HIDDEN void __glXDisp_ClearIndex(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ClearIndex(GLbyte * pc);
extern HIDDEN void __glXDisp_LoadMatrixd(GLbyte * pc);
extern HIDDEN void __glXDispSwap_LoadMatrixd(GLbyte * pc);
-extern HIDDEN void __glXDisp_RasterPos2dv(GLbyte * pc);
-extern HIDDEN void __glXDispSwap_RasterPos2dv(GLbyte * pc);
+extern HIDDEN void __glXDisp_PushMatrix(GLbyte * pc);
+extern HIDDEN void __glXDispSwap_PushMatrix(GLbyte * pc);
extern HIDDEN void __glXDisp_ConvolutionParameterfv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ConvolutionParameterfv(GLbyte * pc);
extern HIDDEN int __glXDisp_GetTexGendv(struct __GLXclientStateRec *, GLbyte *);
@@ -371,14 +373,16 @@ extern HIDDEN void __glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc);
extern HIDDEN void __glXDisp_VertexAttrib4fvARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc);
+extern HIDDEN int __glXDisp_CreateGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern HIDDEN int __glXDispSwap_CreateGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_MultiTexCoord1svARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_MultiTexCoord1svARB(GLbyte * pc);
extern HIDDEN void __glXDisp_EndQueryARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_EndQueryARB(GLbyte * pc);
extern HIDDEN void __glXDisp_DepthMask(GLbyte * pc);
extern HIDDEN void __glXDispSwap_DepthMask(GLbyte * pc);
-extern HIDDEN void __glXDisp_Rotated(GLbyte * pc);
-extern HIDDEN void __glXDispSwap_Rotated(GLbyte * pc);
+extern HIDDEN void __glXDisp_Color4iv(GLbyte * pc);
+extern HIDDEN void __glXDispSwap_Color4iv(GLbyte * pc);
extern HIDDEN int __glXDisp_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_StencilOp(GLbyte * pc);
@@ -619,8 +623,8 @@ extern HIDDEN int __glXDisp_PixelStorei(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_PixelStorei(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_VertexAttrib4usvARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc);
-extern HIDDEN void __glXDisp_Color4iv(GLbyte * pc);
-extern HIDDEN void __glXDispSwap_Color4iv(GLbyte * pc);
+extern HIDDEN int __glXDisp_DestroyGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern HIDDEN int __glXDispSwap_DestroyGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_EvalCoord2dv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_EvalCoord2dv(GLbyte * pc);
extern HIDDEN void __glXDisp_VertexAttrib3svARB(GLbyte * pc);
@@ -669,6 +673,8 @@ extern HIDDEN void __glXDisp_Lighti(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Lighti(GLbyte * pc);
extern HIDDEN int __glXDisp_GetFramebufferAttachmentParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetFramebufferAttachmentParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
+extern HIDDEN int __glXDisp_ChangeDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern HIDDEN int __glXDispSwap_ChangeDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_MultiTexCoord4dvARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc);
extern HIDDEN int __glXDisp_CreatePbuffer(struct __GLXclientStateRec *, GLbyte *);
@@ -751,8 +757,8 @@ extern HIDDEN void __glXDisp_PixelTransferf(GLbyte * pc);
extern HIDDEN void __glXDispSwap_PixelTransferf(GLbyte * pc);
extern HIDDEN void __glXDisp_CopyTexImage1D(GLbyte * pc);
extern HIDDEN void __glXDispSwap_CopyTexImage1D(GLbyte * pc);
-extern HIDDEN void __glXDisp_PushMatrix(GLbyte * pc);
-extern HIDDEN void __glXDispSwap_PushMatrix(GLbyte * pc);
+extern HIDDEN void __glXDisp_RasterPos2dv(GLbyte * pc);
+extern HIDDEN void __glXDispSwap_RasterPos2dv(GLbyte * pc);
extern HIDDEN void __glXDisp_Fogiv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Fogiv(GLbyte * pc);
extern HIDDEN void __glXDisp_TexCoord1dv(GLbyte * pc);
diff --git a/GL/glx/indirect_size_get.c b/GL/glx/indirect_size_get.c
index f29ae474e..928571440 100644
--- a/GL/glx/indirect_size_get.c
+++ b/GL/glx/indirect_size_get.c
@@ -697,6 +697,7 @@ __glGetBooleanv_size(GLenum e)
case GL_MATRIX_INDEX_ARRAY_SIZE_ARB:
case GL_MATRIX_INDEX_ARRAY_TYPE_ARB:
case GL_MATRIX_INDEX_ARRAY_STRIDE_ARB:
+ case GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT:
case GL_POINT_SPRITE_ARB:
/* case GL_POINT_SPRITE_NV:*/
case GL_POINT_SPRITE_R_MODE_NV:
@@ -704,8 +705,11 @@ __glGetBooleanv_size(GLenum e)
case GL_MAX_TEXTURE_COORDS_ARB:
case GL_MAX_TEXTURE_IMAGE_UNITS_ARB:
case GL_DEPTH_BOUNDS_TEST_EXT:
+ case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT:
case GL_STENCIL_TEST_TWO_SIDE_EXT:
case GL_ACTIVE_STENCIL_FACE_EXT:
+ case GL_TEXTURE_BINDING_1D_ARRAY_EXT:
+ case GL_TEXTURE_BINDING_2D_ARRAY_EXT:
case GL_RASTER_POSITION_UNCLIPPED_IBM:
return 1;
case GL_SMOOTH_POINT_SIZE_RANGE:
diff --git a/GL/glx/indirect_table.c b/GL/glx/indirect_table.c
index 9d0383c83..3da1f437c 100644
--- a/GL/glx/indirect_table.c
+++ b/GL/glx/indirect_table.c
@@ -1575,9 +1575,9 @@ static const void *VendorPriv_function_table[104][2] = {
/* [ 92] = 65540 */ {__glXDisp_GetFBConfigsSGIX, __glXDispSwap_GetFBConfigsSGIX},
/* [ 93] = 65541 */ {__glXDisp_CreateContextWithConfigSGIX, __glXDispSwap_CreateContextWithConfigSGIX},
/* [ 94] = 65542 */ {__glXDisp_CreateGLXPixmapWithConfigSGIX, __glXDispSwap_CreateGLXPixmapWithConfigSGIX},
- /* [ 95] = 65543 */ {NULL, NULL},
- /* [ 96] = 65544 */ {NULL, NULL},
- /* [ 97] = 65545 */ {NULL, NULL},
+ /* [ 95] = 65543 */ {__glXDisp_CreateGLXPbufferSGIX, __glXDispSwap_CreateGLXPbufferSGIX},
+ /* [ 96] = 65544 */ {__glXDisp_DestroyGLXPbufferSGIX, __glXDispSwap_DestroyGLXPbufferSGIX},
+ /* [ 97] = 65545 */ {__glXDisp_ChangeDrawableAttributesSGIX, __glXDispSwap_ChangeDrawableAttributesSGIX},
/* [ 98] = 65546 */ {__glXDisp_GetDrawableAttributesSGIX, __glXDispSwap_GetDrawableAttributesSGIX},
/* [ 99] = 65547 */ {NULL, NULL},
/* [ 100] = 65548 */ {NULL, NULL},