diff --git a/src/glx/dri2.c b/src/glx/dri2.c index b57e677c7bd..f00b96525aa 100644 --- a/src/glx/dri2.c +++ b/src/glx/dri2.c @@ -84,7 +84,6 @@ static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay, &dri2ExtensionHooks, 0, NULL) - static Bool DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) { @@ -101,8 +100,7 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) xDRI2BufferSwapComplete2 *awire = (xDRI2BufferSwapComplete2 *)wire; __GLXDRIdrawable *pdraw; - pdraw = dri2GetGlxDrawableFromXDrawableId(__glXInitialize(dpy), - awire->drawable); + pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, awire->drawable); if (pdraw == NULL) return False; @@ -132,7 +130,7 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo; aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo; - glxDraw = GetGLXDrawable(pdraw->psc->display, pdraw->drawable); + glxDraw = GetGLXDrawable(dpy, pdraw->drawable); if (glxDraw != NULL) { if (awire->sbc < glxDraw->lastEventSbc) glxDraw->eventSbcWrap += 0x100000000; diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 4a6e16c57ff..e681042bdc5 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -605,7 +605,7 @@ static void dri2_wait_x(struct glx_context *gc) { struct dri2_drawable *priv = (struct dri2_drawable *) - GetGLXDRIDrawable(gc->psc->display, gc->currentDrawable); + GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable); if (priv == NULL || !priv->have_fake_front) return; @@ -617,7 +617,7 @@ static void dri2_wait_gl(struct glx_context *gc) { struct dri2_drawable *priv = (struct dri2_drawable *) - GetGLXDRIDrawable(gc->psc->display, gc->currentDrawable); + GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable); if (priv == NULL || !priv->have_fake_front) return; @@ -713,7 +713,7 @@ unsigned dri2GetSwapEventType(Display* dpy, XID drawable) { struct glx_display *glx_dpy = __glXInitialize(dpy); __GLXDRIdrawable *pdraw; - pdraw = dri2GetGlxDrawableFromXDrawableId(glx_dpy, drawable); + pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, drawable); if (!pdraw || !(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK)) return 0; return glx_dpy->codes.first_event + GLX_BufferSwapComplete; @@ -966,7 +966,7 @@ _X_HIDDEN void dri2InvalidateBuffers(Display *dpy, XID drawable) { __GLXDRIdrawable *pdraw = - dri2GetGlxDrawableFromXDrawableId(__glXInitialize(dpy), drawable); + dri2GetGlxDrawableFromXDrawableId(dpy, drawable); struct dri2_screen *psc; struct dri2_drawable *pdp = (struct dri2_drawable *) pdraw; @@ -1365,8 +1365,9 @@ dri2DestroyDisplay(__GLXDRIdisplay * dpy) } _X_HIDDEN __GLXDRIdrawable * -dri2GetGlxDrawableFromXDrawableId(struct glx_display *d, XID id) +dri2GetGlxDrawableFromXDrawableId(Display *dpy, XID id) { + struct glx_display *d = __glXInitialize(dpy); struct dri2_display *pdp = (struct dri2_display *) d->dri2Display; __GLXDRIdrawable *pdraw; diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index dd4758a546f..cd00ff6b88c 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -458,7 +458,7 @@ static void dri3_wait_x(struct glx_context *gc) { struct dri3_drawable *priv = (struct dri3_drawable *) - GetGLXDRIDrawable(gc->psc->display, gc->currentDrawable); + GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable); if (priv) loader_dri3_wait_x(&priv->loader_drawable); @@ -468,7 +468,7 @@ static void dri3_wait_gl(struct glx_context *gc) { struct dri3_drawable *priv = (struct dri3_drawable *) - GetGLXDRIDrawable(gc->psc->display, gc->currentDrawable); + GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable); if (priv) loader_dri3_wait_gl(&priv->loader_drawable); diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 41940420692..8fe8802bed7 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -317,8 +317,7 @@ driInferDrawableConfig(struct glx_screen *psc, GLXDrawable draw) * this usually works except for bare Windows that haven't been made * current yet. */ - if (__glXGetDrawableAttribute(psc->display, draw, GLX_FBCONFIG_ID, - &fbconfig)) { + if (__glXGetDrawableAttribute(psc->dpy, draw, GLX_FBCONFIG_ID, &fbconfig)) { return glx_config_find_fbconfig(psc->configs, fbconfig); } diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c index 1a633d07d8c..c145ee92405 100644 --- a/src/glx/glx_pbuffer.c +++ b/src/glx/glx_pbuffer.c @@ -57,10 +57,10 @@ * version of the protocol or the GLX 1.3 version of the protocol. */ static void -ChangeDrawableAttribute(struct glx_display *priv, GLXDrawable drawable, +ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable, const CARD32 * attribs, size_t num_attribs) { - Display *dpy = priv->dpy; + struct glx_display *priv = __glXInitialize(dpy); #ifdef GLX_DIRECT_RENDERING __GLXDRIdrawable *pdraw; int i; @@ -110,7 +110,7 @@ ChangeDrawableAttribute(struct glx_display *priv, GLXDrawable drawable, SyncHandle(); #ifdef GLX_DIRECT_RENDERING - pdraw = GetGLXDRIDrawable(priv, drawable); + pdraw = GetGLXDRIDrawable(dpy, drawable); if (!pdraw) return; @@ -205,11 +205,11 @@ CreateDRIDrawable(Display *dpy, struct glx_config *config, } static void -DestroyDRIDrawable(struct glx_display *priv, GLXDrawable drawable, - int destroy_xdrawable) +DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable) { #ifdef GLX_DIRECT_RENDERING - __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(priv, drawable); + struct glx_display *const priv = __glXInitialize(dpy); + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable); XID xid; if (priv != NULL && pdraw != NULL) { @@ -238,10 +238,10 @@ DestroyDRIDrawable(struct glx_display *priv, GLXDrawable drawable, * capture the reply rather than always calling Xmalloc. */ int -__glXGetDrawableAttribute(struct glx_display *priv, GLXDrawable drawable, +__glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable, int attribute, unsigned int *value) { - Display *dpy = priv->dpy; + struct glx_display *priv; xGLXGetDrawableAttributesReply reply; CARD32 *data; CARD8 opcode; @@ -267,6 +267,10 @@ __glXGetDrawableAttribute(struct glx_display *priv, GLXDrawable drawable, return 0; } + priv = __glXInitialize(dpy); + if (priv == NULL) + return 0; + *value = 0; opcode = __glXSetupForCommand(dpy); @@ -274,7 +278,7 @@ __glXGetDrawableAttribute(struct glx_display *priv, GLXDrawable drawable, return 0; #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - pdraw = GetGLXDRIDrawable(priv, drawable); + pdraw = GetGLXDRIDrawable(dpy, drawable); if (attribute == GLX_BACK_BUFFER_AGE_EXT) { struct glx_context *gc = __glXGetCurrentContext(); @@ -415,10 +419,9 @@ protocolDestroyDrawable(Display *dpy, GLXDrawable drawable, CARD32 glxCode) * Create a non-pbuffer GLX drawable. */ static GLXDrawable -CreateDrawable(struct glx_display *priv, struct glx_config *config, +CreateDrawable(Display *dpy, struct glx_config *config, Drawable drawable, const int *attrib_list, CARD8 glxCode) { - Display *dpy = priv->dpy; xGLXCreateWindowReq *req; struct glx_drawable *glxDraw; CARD32 *data; @@ -461,7 +464,7 @@ CreateDrawable(struct glx_display *priv, struct glx_config *config, UnlockDisplay(dpy); SyncHandle(); - if (InitGLXDrawable(priv, glxDraw, drawable, xid)) { + if (InitGLXDrawable(dpy, glxDraw, drawable, xid)) { free(glxDraw); return None; } @@ -485,16 +488,14 @@ CreateDrawable(struct glx_display *priv, struct glx_config *config, static void DestroyDrawable(Display * dpy, GLXDrawable drawable, CARD32 glxCode) { - struct glx_display *priv = __glXInitialize(dpy); - if ((dpy == NULL) || (drawable == 0)) { return; } protocolDestroyDrawable(dpy, drawable, glxCode); - DestroyGLXDrawable(priv, drawable); - DestroyDRIDrawable(priv, drawable, GL_FALSE); + DestroyGLXDrawable(dpy, drawable); + DestroyDRIDrawable(dpy, drawable, GL_FALSE); return; } @@ -654,7 +655,7 @@ DestroyPbuffer(Display * dpy, GLXDrawable drawable) UnlockDisplay(dpy); SyncHandle(); - DestroyDRIDrawable(priv, drawable, GL_TRUE); + DestroyDRIDrawable(dpy, drawable, GL_TRUE); return; } @@ -805,7 +806,7 @@ glXQueryDrawable(Display * dpy, GLXDrawable drawable, } } #else - __glXGetDrawableAttribute(__glXInitialize(dpy), drawable, attribute, value); + __glXGetDrawableAttribute(dpy, drawable, attribute, value); #endif } @@ -818,7 +819,7 @@ _GLX_PUBLIC void glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable, int attribute, unsigned int *value) { - __glXGetDrawableAttribute(__glXInitialize(dpy), drawable, attribute, value); + __glXGetDrawableAttribute(dpy, drawable, attribute, value); } #endif @@ -850,7 +851,7 @@ glXSelectEvent(Display * dpy, GLXDrawable drawable, unsigned long mask) attribs[0] = (CARD32) GLX_EVENT_MASK; attribs[1] = (CARD32) mask; - ChangeDrawableAttribute(__glXInitialize(dpy), drawable, attribs, 1); + ChangeDrawableAttribute(dpy, drawable, attribs, 1); #endif } @@ -881,10 +882,15 @@ glXGetSelectedEvent(Display * dpy, GLXDrawable drawable, unsigned long *mask) __glXSendError(dpy, GLXBadDrawable, drawable, X_GLXGetDrawableAttributes, true); #else - /* handle unsigned int / unsigned long mismatch */ unsigned int value = 0; - __glXGetDrawableAttribute(__glXInitialize(dpy), drawable, - GLX_EVENT_MASK_SGIX, &value); + + + /* The non-sense with value is required because on LP64 platforms + * sizeof(unsigned int) != sizeof(unsigned long). On little-endian + * we could just type-cast the pointer, but why? + */ + + __glXGetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value); *mask = value; #endif } @@ -902,7 +908,7 @@ glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap, return pixmap; #else - return CreateDrawable(__glXInitialize(dpy), (struct glx_config *) config, + return CreateDrawable(dpy, (struct glx_config *) config, (Drawable) pixmap, attrib_list, X_GLXCreatePixmap); #endif } @@ -936,7 +942,7 @@ glXCreateWindow(Display * dpy, GLXFBConfig config, Window win, return win; #else - return CreateDrawable(__glXInitialize(dpy), (struct glx_config *) config, + return CreateDrawable(dpy, (struct glx_config *) config, (Drawable) win, attrib_list, X_GLXCreateWindow); #endif } diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index e544f02c324..e335571b918 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -620,7 +620,7 @@ glx_screen_cleanup(struct glx_screen *psc); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) extern __GLXDRIdrawable * -dri2GetGlxDrawableFromXDrawableId(struct glx_display *priv, XID id); +dri2GetGlxDrawableFromXDrawableId(Display *dpy, XID id); #endif extern GLubyte *__glXFlushRenderBuffer(struct glx_context *, GLubyte *); @@ -771,7 +771,7 @@ extern void GarbageCollectDRIDrawables(struct glx_screen *psc); extern __GLXDRIdrawable * -GetGLXDRIDrawable(struct glx_display *priv, GLXDrawable drawable); +GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable); #endif extern struct glx_screen *GetGLXScreenConfigs(Display * dpy, int scrn); @@ -796,10 +796,10 @@ extern Bool validate_renderType_against_config(const struct glx_config *config, int renderType); -extern struct glx_drawable *GetGLXDrawable(struct glx_display *priv, GLXDrawable drawable); -extern int InitGLXDrawable(struct glx_display *priv, struct glx_drawable *glxDraw, +extern struct glx_drawable *GetGLXDrawable(Display *dpy, GLXDrawable drawable); +extern int InitGLXDrawable(Display *dpy, struct glx_drawable *glxDraw, XID xDrawable, GLXDrawable drawable); -extern void DestroyGLXDrawable(struct glx_display *priv, GLXDrawable drawable); +extern void DestroyGLXDrawable(Display *dpy, GLXDrawable drawable); extern struct glx_context dummyContext; @@ -818,9 +818,8 @@ indirect_create_context_attribs(struct glx_screen *base, unsigned *error); -extern int -__glXGetDrawableAttribute(struct glx_display *priv, GLXDrawable drawable, - int attribute, unsigned int *value); +extern int __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable, + int attribute, unsigned int *value); #ifdef __cplusplus } diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 2ccd4d26c08..ecf94eeb04c 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -64,15 +64,16 @@ static const char __glXGLXClientVersion[] = "1.4"; /** * Get the __DRIdrawable for the drawable associated with a GLXContext * - * \param priv The glx_display for the current context + * \param dpy The display associated with \c drawable. * \param drawable GLXDrawable whose __DRIdrawable part is to be retrieved. * \param scrn_num If non-NULL, the drawables screen is stored there * \returns A pointer to the context's __DRIdrawable on success, or NULL if * the drawable is not associated with a direct-rendering context. */ _X_HIDDEN __GLXDRIdrawable * -GetGLXDRIDrawable(struct glx_display *priv, GLXDrawable drawable) +GetGLXDRIDrawable(Display * dpy, GLXDrawable drawable) { + struct glx_display *priv = __glXInitialize(dpy); __GLXDRIdrawable *pdraw; if (priv == NULL) @@ -87,8 +88,9 @@ GetGLXDRIDrawable(struct glx_display *priv, GLXDrawable drawable) #endif _X_HIDDEN struct glx_drawable * -GetGLXDrawable(struct glx_display *priv, GLXDrawable drawable) +GetGLXDrawable(Display *dpy, GLXDrawable drawable) { + struct glx_display *priv = __glXInitialize(dpy); struct glx_drawable *glxDraw; if (priv == NULL) @@ -101,9 +103,14 @@ GetGLXDrawable(struct glx_display *priv, GLXDrawable drawable) } _X_HIDDEN int -InitGLXDrawable(struct glx_display *priv, struct glx_drawable *glxDraw, - XID xDrawable, GLXDrawable drawable) +InitGLXDrawable(Display *dpy, struct glx_drawable *glxDraw, XID xDrawable, + GLXDrawable drawable) { + struct glx_display *priv = __glXInitialize(dpy); + + if (!priv) + return -1; + glxDraw->xDrawable = xDrawable; glxDraw->drawable = drawable; glxDraw->lastEventSbc = 0; @@ -113,11 +120,15 @@ InitGLXDrawable(struct glx_display *priv, struct glx_drawable *glxDraw, } _X_HIDDEN void -DestroyGLXDrawable(struct glx_display *priv, GLXDrawable drawable) +DestroyGLXDrawable(Display *dpy, GLXDrawable drawable) { + struct glx_display *priv = __glXInitialize(dpy); struct glx_drawable *glxDraw; - glxDraw = GetGLXDrawable(priv, drawable); + if (!priv) + return; + + glxDraw = GetGLXDrawable(dpy, drawable); __glxHashDelete(priv->glXDrawHash, drawable); free(glxDraw); } @@ -695,10 +706,13 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap) struct glx_drawable *glxDraw; GLXPixmap xid; CARD8 opcode; + +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) struct glx_display *const priv = __glXInitialize(dpy); if (priv == NULL) return None; +#endif opcode = __glXSetupForCommand(dpy); if (!opcode) { @@ -721,7 +735,7 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap) UnlockDisplay(dpy); SyncHandle(); - if (InitGLXDrawable(priv, glxDraw, pixmap, req->glxpixmap)) { + if (InitGLXDrawable(dpy, glxDraw, pixmap, req->glxpixmap)) { free(glxDraw); return None; } @@ -782,10 +796,6 @@ glXDestroyGLXPixmap(Display * dpy, GLXPixmap glxpixmap) #else xGLXDestroyGLXPixmapReq *req; CARD8 opcode; - struct glx_display *const priv = __glXInitialize(dpy); - - if (!priv) - return; opcode = __glXSetupForCommand(dpy); if (!opcode) { @@ -801,11 +811,12 @@ glXDestroyGLXPixmap(Display * dpy, GLXPixmap glxpixmap) UnlockDisplay(dpy); SyncHandle(); - DestroyGLXDrawable(priv, glxpixmap); + DestroyGLXDrawable(dpy, glxpixmap); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) { - __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(priv, glxpixmap); + struct glx_display *const priv = __glXInitialize(dpy); + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, glxpixmap); if (priv != NULL && pdraw != NULL) { (*pdraw->destroyDrawable) (pdraw); @@ -836,8 +847,7 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable) #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) { - struct glx_display *priv = __glXInitialize(dpy); - __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(priv, drawable); + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable); if (pdraw != NULL) { Bool flush = gc != &dummyContext && drawable == gc->currentDrawable; @@ -1744,7 +1754,7 @@ glXSwapIntervalSGI(int interval) if (gc->isDirect && psc && psc->driScreen && psc->driScreen->setSwapInterval) { __GLXDRIdrawable *pdraw = - GetGLXDRIDrawable(psc->display, gc->currentDrawable); + GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable); /* Simply ignore the command if the GLX drawable has been destroyed but * the context is still bound. */ @@ -1795,7 +1805,7 @@ glXSwapIntervalMESA(unsigned int interval) struct glx_screen *psc = gc->psc; if (psc && psc->driScreen && psc->driScreen->setSwapInterval) { __GLXDRIdrawable *pdraw = - GetGLXDRIDrawable(psc->display, gc->currentDrawable); + GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable); /* Simply ignore the command if the GLX drawable has been destroyed but * the context is still bound. @@ -1822,7 +1832,7 @@ glXGetSwapIntervalMESA(void) struct glx_screen *psc = gc->psc; if (psc && psc->driScreen && psc->driScreen->getSwapInterval) { __GLXDRIdrawable *pdraw = - GetGLXDRIDrawable(psc->display, gc->currentDrawable); + GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable); if (pdraw) return psc->driScreen->getSwapInterval(pdraw); } @@ -1840,8 +1850,7 @@ _X_HIDDEN void glXSwapIntervalEXT(Display *dpy, GLXDrawable drawable, int interval) { #ifdef GLX_DIRECT_RENDERING - struct glx_display *priv = __glXInitialize(dpy); - __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(priv, drawable); + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable); /* * Strictly, this should throw an error if drawable is not a Window or @@ -1885,7 +1894,7 @@ glXGetVideoSyncSGI(unsigned int *count) if (!gc->currentDrawable) return GLX_BAD_CONTEXT; - pdraw = GetGLXDRIDrawable(psc->display, gc->currentDrawable); + pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable); /* FIXME: Looking at the GLX_SGI_video_sync spec in the extension registry, * FIXME: there should be a GLX encoding for this call. I can find no @@ -1925,7 +1934,7 @@ glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) if (!gc->currentDrawable) return GLX_BAD_CONTEXT; - pdraw = GetGLXDRIDrawable(psc->display, gc->currentDrawable); + pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable); if (psc && psc->driScreen && psc->driScreen->waitForMSC) { ret = psc->driScreen->waitForMSC(pdraw, 0, divisor, remainder, &ust, &msc, @@ -2075,7 +2084,7 @@ glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable, return False; #ifdef GLX_DIRECT_RENDERING - pdraw = GetGLXDRIDrawable(priv, drawable); + pdraw = GetGLXDRIDrawable(dpy, drawable); psc = pdraw ? pdraw->psc : NULL; if (pdraw && psc->driScreen->getDrawableMSC) { ret = psc->driScreen->getDrawableMSC(psc, pdraw, ust, msc, sbc); @@ -2165,8 +2174,7 @@ glXGetMscRateOML(Display * dpy, GLXDrawable drawable, int32_t * numerator, int32_t * denominator) { #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) && !defined(GLX_USE_WINDOWSGL) - struct glx_display *priv = __glXInitialize(dpy); - __GLXDRIdrawable *draw = GetGLXDRIDrawable(priv, drawable); + __GLXDRIdrawable *draw = GetGLXDRIDrawable(dpy, drawable); if (draw == NULL) return False; @@ -2188,7 +2196,7 @@ glXSwapBuffersMscOML(Display *dpy, GLXDrawable drawable, { struct glx_context *gc = __glXGetCurrentContext(); #ifdef GLX_DIRECT_RENDERING - __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->psc->display, drawable); + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable); struct glx_screen *psc = pdraw ? pdraw->psc : NULL; #endif @@ -2229,8 +2237,7 @@ glXWaitForMscOML(Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t *msc, int64_t *sbc) { #ifdef GLX_DIRECT_RENDERING - struct glx_display *priv = __glXInitialize(dpy); - __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(priv, drawable); + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable); struct glx_screen *psc = pdraw ? pdraw->psc : NULL; int ret; #endif @@ -2261,8 +2268,7 @@ glXWaitForSbcOML(Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc) { #ifdef GLX_DIRECT_RENDERING - struct glx_display *priv = __glXInitialize(dpy); - __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(priv, drawable); + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable); struct glx_screen *psc = pdraw ? pdraw->psc : NULL; int ret; #endif @@ -2352,8 +2358,7 @@ glXCopySubBufferMESA(Display * dpy, GLXDrawable drawable, CARD8 opcode; #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - struct glx_display *priv = __glXInitialize(dpy); - __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(priv, drawable); + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable); if (pdraw != NULL) { struct glx_screen *psc = pdraw->psc; if (psc->driScreen->copySubBuffer != NULL) { @@ -2420,7 +2425,7 @@ glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer, unsigned int i = 0; #ifdef GLX_DIRECT_RENDERING - __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->psc->display, drawable); + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable); if (pdraw != NULL) { struct glx_screen *psc = pdraw->psc; if (psc->driScreen->bindTexImage != NULL) @@ -2478,7 +2483,7 @@ glXReleaseTexImageEXT(Display * dpy, GLXDrawable drawable, int buffer) CARD8 opcode; #ifdef GLX_DIRECT_RENDERING - __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->psc->display, drawable); + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable); if (pdraw != NULL) { struct glx_screen *psc = pdraw->psc; if (psc->driScreen->releaseTexImage != NULL) diff --git a/src/glx/glxext.c b/src/glx/glxext.c index 440c36c03a0..91d021e710e 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -145,7 +145,7 @@ XEXT_GENERATE_ERROR_STRING(__glXErrorString, __glXExtensionName, static Bool __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire) { - struct glx_display *glx_dpy = __glXInitialize(dpy); + struct glx_display *glx_dpy = __glXInitialize(dpy); if (glx_dpy == NULL) return False; @@ -173,7 +173,7 @@ __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire) { GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event; xGLXBufferSwapComplete2 *awire = (xGLXBufferSwapComplete2 *)wire; - struct glx_drawable *glxDraw = GetGLXDrawable(glx_dpy, awire->drawable); + struct glx_drawable *glxDraw = GetGLXDrawable(dpy, awire->drawable); if (!glxDraw) return False;