glx: s/Display */struct glx_display */ over internal API
We'd like to avoid __glXInitialize as much as possible since it involves taking a global lock. This means converting internal APIs to operate as much as possible in terms of something other than a Display *, since if that's all you have then you're forced to call __glXInitialize to get to the glx_display. The contortions in DRI2 displease me, but DRI2 displeases me, so. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10418>
This commit is contained in:
parent
21411368a3
commit
b02b26b87c
|
@ -84,6 +84,7 @@ static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay,
|
|||
&dri2ExtensionHooks,
|
||||
0, NULL)
|
||||
|
||||
|
||||
static Bool
|
||||
DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
|
||||
{
|
||||
|
@ -100,7 +101,8 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
|
|||
xDRI2BufferSwapComplete2 *awire = (xDRI2BufferSwapComplete2 *)wire;
|
||||
__GLXDRIdrawable *pdraw;
|
||||
|
||||
pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, awire->drawable);
|
||||
pdraw = dri2GetGlxDrawableFromXDrawableId(__glXInitialize(dpy),
|
||||
awire->drawable);
|
||||
if (pdraw == NULL)
|
||||
return False;
|
||||
|
||||
|
@ -130,7 +132,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(dpy, pdraw->drawable);
|
||||
glxDraw = GetGLXDrawable(pdraw->psc->display, pdraw->drawable);
|
||||
if (glxDraw != NULL) {
|
||||
if (awire->sbc < glxDraw->lastEventSbc)
|
||||
glxDraw->eventSbcWrap += 0x100000000;
|
||||
|
|
|
@ -605,7 +605,7 @@ static void
|
|||
dri2_wait_x(struct glx_context *gc)
|
||||
{
|
||||
struct dri2_drawable *priv = (struct dri2_drawable *)
|
||||
GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
|
||||
GetGLXDRIDrawable(gc->psc->display, 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->currentDpy, gc->currentDrawable);
|
||||
GetGLXDRIDrawable(gc->psc->display, 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(dpy, drawable);
|
||||
pdraw = dri2GetGlxDrawableFromXDrawableId(glx_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(dpy, drawable);
|
||||
dri2GetGlxDrawableFromXDrawableId(__glXInitialize(dpy), drawable);
|
||||
struct dri2_screen *psc;
|
||||
struct dri2_drawable *pdp = (struct dri2_drawable *) pdraw;
|
||||
|
||||
|
@ -1365,9 +1365,8 @@ dri2DestroyDisplay(__GLXDRIdisplay * dpy)
|
|||
}
|
||||
|
||||
_X_HIDDEN __GLXDRIdrawable *
|
||||
dri2GetGlxDrawableFromXDrawableId(Display *dpy, XID id)
|
||||
dri2GetGlxDrawableFromXDrawableId(struct glx_display *d, XID id)
|
||||
{
|
||||
struct glx_display *d = __glXInitialize(dpy);
|
||||
struct dri2_display *pdp = (struct dri2_display *) d->dri2Display;
|
||||
__GLXDRIdrawable *pdraw;
|
||||
|
||||
|
|
|
@ -458,7 +458,7 @@ static void
|
|||
dri3_wait_x(struct glx_context *gc)
|
||||
{
|
||||
struct dri3_drawable *priv = (struct dri3_drawable *)
|
||||
GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
|
||||
GetGLXDRIDrawable(gc->psc->display, 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->currentDpy, gc->currentDrawable);
|
||||
GetGLXDRIDrawable(gc->psc->display, gc->currentDrawable);
|
||||
|
||||
if (priv)
|
||||
loader_dri3_wait_gl(&priv->loader_drawable);
|
||||
|
|
|
@ -317,7 +317,8 @@ driInferDrawableConfig(struct glx_screen *psc, GLXDrawable draw)
|
|||
* this usually works except for bare Windows that haven't been made
|
||||
* current yet.
|
||||
*/
|
||||
if (__glXGetDrawableAttribute(psc->dpy, draw, GLX_FBCONFIG_ID, &fbconfig)) {
|
||||
if (__glXGetDrawableAttribute(psc->display, draw, GLX_FBCONFIG_ID,
|
||||
&fbconfig)) {
|
||||
return glx_config_find_fbconfig(psc->configs, fbconfig);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,10 +57,10 @@
|
|||
* version of the protocol or the GLX 1.3 version of the protocol.
|
||||
*/
|
||||
static void
|
||||
ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
||||
ChangeDrawableAttribute(struct glx_display *priv, GLXDrawable drawable,
|
||||
const CARD32 * attribs, size_t num_attribs)
|
||||
{
|
||||
struct glx_display *priv = __glXInitialize(dpy);
|
||||
Display *dpy = priv->dpy;
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
__GLXDRIdrawable *pdraw;
|
||||
int i;
|
||||
|
@ -110,7 +110,7 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
|||
SyncHandle();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||
pdraw = GetGLXDRIDrawable(priv, drawable);
|
||||
|
||||
if (!pdraw)
|
||||
return;
|
||||
|
@ -205,11 +205,11 @@ CreateDRIDrawable(Display *dpy, struct glx_config *config,
|
|||
}
|
||||
|
||||
static void
|
||||
DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable)
|
||||
DestroyDRIDrawable(struct glx_display *priv, GLXDrawable drawable,
|
||||
int destroy_xdrawable)
|
||||
{
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
struct glx_display *const priv = __glXInitialize(dpy);
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(priv, drawable);
|
||||
XID xid;
|
||||
|
||||
if (priv != NULL && pdraw != NULL) {
|
||||
|
@ -238,10 +238,10 @@ DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable)
|
|||
* capture the reply rather than always calling Xmalloc.
|
||||
*/
|
||||
int
|
||||
__glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
||||
__glXGetDrawableAttribute(struct glx_display *priv, GLXDrawable drawable,
|
||||
int attribute, unsigned int *value)
|
||||
{
|
||||
struct glx_display *priv;
|
||||
Display *dpy = priv->dpy;
|
||||
xGLXGetDrawableAttributesReply reply;
|
||||
CARD32 *data;
|
||||
CARD8 opcode;
|
||||
|
@ -267,10 +267,6 @@ __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
|||
return 0;
|
||||
}
|
||||
|
||||
priv = __glXInitialize(dpy);
|
||||
if (priv == NULL)
|
||||
return 0;
|
||||
|
||||
*value = 0;
|
||||
|
||||
opcode = __glXSetupForCommand(dpy);
|
||||
|
@ -278,7 +274,7 @@ __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
|||
return 0;
|
||||
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||
pdraw = GetGLXDRIDrawable(priv, drawable);
|
||||
|
||||
if (attribute == GLX_BACK_BUFFER_AGE_EXT) {
|
||||
struct glx_context *gc = __glXGetCurrentContext();
|
||||
|
@ -419,9 +415,10 @@ protocolDestroyDrawable(Display *dpy, GLXDrawable drawable, CARD32 glxCode)
|
|||
* Create a non-pbuffer GLX drawable.
|
||||
*/
|
||||
static GLXDrawable
|
||||
CreateDrawable(Display *dpy, struct glx_config *config,
|
||||
CreateDrawable(struct glx_display *priv, struct glx_config *config,
|
||||
Drawable drawable, const int *attrib_list, CARD8 glxCode)
|
||||
{
|
||||
Display *dpy = priv->dpy;
|
||||
xGLXCreateWindowReq *req;
|
||||
struct glx_drawable *glxDraw;
|
||||
CARD32 *data;
|
||||
|
@ -464,7 +461,7 @@ CreateDrawable(Display *dpy, struct glx_config *config,
|
|||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
if (InitGLXDrawable(dpy, glxDraw, drawable, xid)) {
|
||||
if (InitGLXDrawable(priv, glxDraw, drawable, xid)) {
|
||||
free(glxDraw);
|
||||
return None;
|
||||
}
|
||||
|
@ -488,14 +485,16 @@ CreateDrawable(Display *dpy, 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(dpy, drawable);
|
||||
DestroyDRIDrawable(dpy, drawable, GL_FALSE);
|
||||
DestroyGLXDrawable(priv, drawable);
|
||||
DestroyDRIDrawable(priv, drawable, GL_FALSE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -655,7 +654,7 @@ DestroyPbuffer(Display * dpy, GLXDrawable drawable)
|
|||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
DestroyDRIDrawable(dpy, drawable, GL_TRUE);
|
||||
DestroyDRIDrawable(priv, drawable, GL_TRUE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -806,7 +805,7 @@ glXQueryDrawable(Display * dpy, GLXDrawable drawable,
|
|||
}
|
||||
}
|
||||
#else
|
||||
__glXGetDrawableAttribute(dpy, drawable, attribute, value);
|
||||
__glXGetDrawableAttribute(__glXInitialize(dpy), drawable, attribute, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -819,7 +818,7 @@ _GLX_PUBLIC void
|
|||
glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable,
|
||||
int attribute, unsigned int *value)
|
||||
{
|
||||
__glXGetDrawableAttribute(dpy, drawable, attribute, value);
|
||||
__glXGetDrawableAttribute(__glXInitialize(dpy), drawable, attribute, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -851,7 +850,7 @@ glXSelectEvent(Display * dpy, GLXDrawable drawable, unsigned long mask)
|
|||
attribs[0] = (CARD32) GLX_EVENT_MASK;
|
||||
attribs[1] = (CARD32) mask;
|
||||
|
||||
ChangeDrawableAttribute(dpy, drawable, attribs, 1);
|
||||
ChangeDrawableAttribute(__glXInitialize(dpy), drawable, attribs, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -882,15 +881,10 @@ 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;
|
||||
|
||||
|
||||
/* 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);
|
||||
__glXGetDrawableAttribute(__glXInitialize(dpy), drawable,
|
||||
GLX_EVENT_MASK_SGIX, &value);
|
||||
*mask = value;
|
||||
#endif
|
||||
}
|
||||
|
@ -908,7 +902,7 @@ glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap,
|
|||
|
||||
return pixmap;
|
||||
#else
|
||||
return CreateDrawable(dpy, (struct glx_config *) config,
|
||||
return CreateDrawable(__glXInitialize(dpy), (struct glx_config *) config,
|
||||
(Drawable) pixmap, attrib_list, X_GLXCreatePixmap);
|
||||
#endif
|
||||
}
|
||||
|
@ -942,7 +936,7 @@ glXCreateWindow(Display * dpy, GLXFBConfig config, Window win,
|
|||
|
||||
return win;
|
||||
#else
|
||||
return CreateDrawable(dpy, (struct glx_config *) config,
|
||||
return CreateDrawable(__glXInitialize(dpy), (struct glx_config *) config,
|
||||
(Drawable) win, attrib_list, X_GLXCreateWindow);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -622,7 +622,7 @@ glx_screen_cleanup(struct glx_screen *psc);
|
|||
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
extern __GLXDRIdrawable *
|
||||
dri2GetGlxDrawableFromXDrawableId(Display *dpy, XID id);
|
||||
dri2GetGlxDrawableFromXDrawableId(struct glx_display *priv, XID id);
|
||||
#endif
|
||||
|
||||
extern GLubyte *__glXFlushRenderBuffer(struct glx_context *, GLubyte *);
|
||||
|
@ -782,7 +782,7 @@ extern void
|
|||
GarbageCollectDRIDrawables(struct glx_screen *psc);
|
||||
|
||||
extern __GLXDRIdrawable *
|
||||
GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable);
|
||||
GetGLXDRIDrawable(struct glx_display *priv, GLXDrawable drawable);
|
||||
#endif
|
||||
|
||||
extern struct glx_screen *GetGLXScreenConfigs(Display * dpy, int scrn);
|
||||
|
@ -807,10 +807,10 @@ extern Bool validate_renderType_against_config(const struct glx_config *config,
|
|||
int renderType);
|
||||
|
||||
|
||||
extern struct glx_drawable *GetGLXDrawable(Display *dpy, GLXDrawable drawable);
|
||||
extern int InitGLXDrawable(Display *dpy, struct glx_drawable *glxDraw,
|
||||
extern struct glx_drawable *GetGLXDrawable(struct glx_display *priv, GLXDrawable drawable);
|
||||
extern int InitGLXDrawable(struct glx_display *priv, struct glx_drawable *glxDraw,
|
||||
XID xDrawable, GLXDrawable drawable);
|
||||
extern void DestroyGLXDrawable(Display *dpy, GLXDrawable drawable);
|
||||
extern void DestroyGLXDrawable(struct glx_display *priv, GLXDrawable drawable);
|
||||
|
||||
extern struct glx_context dummyContext;
|
||||
|
||||
|
@ -829,8 +829,9 @@ indirect_create_context_attribs(struct glx_screen *base,
|
|||
unsigned *error);
|
||||
|
||||
|
||||
extern int __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
||||
int attribute, unsigned int *value);
|
||||
extern int
|
||||
__glXGetDrawableAttribute(struct glx_display *priv, GLXDrawable drawable,
|
||||
int attribute, unsigned int *value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -64,16 +64,15 @@ static const char __glXGLXClientVersion[] = "1.4";
|
|||
/**
|
||||
* Get the __DRIdrawable for the drawable associated with a GLXContext
|
||||
*
|
||||
* \param dpy The display associated with \c drawable.
|
||||
* \param priv The glx_display for the current context
|
||||
* \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(Display * dpy, GLXDrawable drawable)
|
||||
GetGLXDRIDrawable(struct glx_display *priv, GLXDrawable drawable)
|
||||
{
|
||||
struct glx_display *priv = __glXInitialize(dpy);
|
||||
__GLXDRIdrawable *pdraw;
|
||||
|
||||
if (priv == NULL)
|
||||
|
@ -88,9 +87,8 @@ GetGLXDRIDrawable(Display * dpy, GLXDrawable drawable)
|
|||
#endif
|
||||
|
||||
_X_HIDDEN struct glx_drawable *
|
||||
GetGLXDrawable(Display *dpy, GLXDrawable drawable)
|
||||
GetGLXDrawable(struct glx_display *priv, GLXDrawable drawable)
|
||||
{
|
||||
struct glx_display *priv = __glXInitialize(dpy);
|
||||
struct glx_drawable *glxDraw;
|
||||
|
||||
if (priv == NULL)
|
||||
|
@ -103,14 +101,9 @@ GetGLXDrawable(Display *dpy, GLXDrawable drawable)
|
|||
}
|
||||
|
||||
_X_HIDDEN int
|
||||
InitGLXDrawable(Display *dpy, struct glx_drawable *glxDraw, XID xDrawable,
|
||||
GLXDrawable drawable)
|
||||
InitGLXDrawable(struct glx_display *priv, 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;
|
||||
|
@ -120,15 +113,11 @@ InitGLXDrawable(Display *dpy, struct glx_drawable *glxDraw, XID xDrawable,
|
|||
}
|
||||
|
||||
_X_HIDDEN void
|
||||
DestroyGLXDrawable(Display *dpy, GLXDrawable drawable)
|
||||
DestroyGLXDrawable(struct glx_display *priv, GLXDrawable drawable)
|
||||
{
|
||||
struct glx_display *priv = __glXInitialize(dpy);
|
||||
struct glx_drawable *glxDraw;
|
||||
|
||||
if (!priv)
|
||||
return;
|
||||
|
||||
glxDraw = GetGLXDrawable(dpy, drawable);
|
||||
glxDraw = GetGLXDrawable(priv, drawable);
|
||||
__glxHashDelete(priv->glXDrawHash, drawable);
|
||||
free(glxDraw);
|
||||
}
|
||||
|
@ -706,13 +695,10 @@ 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) {
|
||||
|
@ -735,7 +721,7 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap)
|
|||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
if (InitGLXDrawable(dpy, glxDraw, pixmap, req->glxpixmap)) {
|
||||
if (InitGLXDrawable(priv, glxDraw, pixmap, req->glxpixmap)) {
|
||||
free(glxDraw);
|
||||
return None;
|
||||
}
|
||||
|
@ -796,6 +782,10 @@ 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) {
|
||||
|
@ -811,12 +801,11 @@ glXDestroyGLXPixmap(Display * dpy, GLXPixmap glxpixmap)
|
|||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
DestroyGLXDrawable(dpy, glxpixmap);
|
||||
DestroyGLXDrawable(priv, glxpixmap);
|
||||
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
{
|
||||
struct glx_display *const priv = __glXInitialize(dpy);
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, glxpixmap);
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(priv, glxpixmap);
|
||||
|
||||
if (priv != NULL && pdraw != NULL) {
|
||||
(*pdraw->destroyDrawable) (pdraw);
|
||||
|
@ -847,7 +836,8 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
|
|||
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
{
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||
struct glx_display *priv = __glXInitialize(dpy);
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(priv, drawable);
|
||||
|
||||
if (pdraw != NULL) {
|
||||
Bool flush = gc != &dummyContext && drawable == gc->currentDrawable;
|
||||
|
@ -1754,7 +1744,7 @@ glXSwapIntervalSGI(int interval)
|
|||
if (gc->isDirect && psc && psc->driScreen &&
|
||||
psc->driScreen->setSwapInterval) {
|
||||
__GLXDRIdrawable *pdraw =
|
||||
GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
|
||||
GetGLXDRIDrawable(psc->display, gc->currentDrawable);
|
||||
/* Simply ignore the command if the GLX drawable has been destroyed but
|
||||
* the context is still bound.
|
||||
*/
|
||||
|
@ -1805,7 +1795,7 @@ glXSwapIntervalMESA(unsigned int interval)
|
|||
struct glx_screen *psc = gc->psc;
|
||||
if (psc && psc->driScreen && psc->driScreen->setSwapInterval) {
|
||||
__GLXDRIdrawable *pdraw =
|
||||
GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
|
||||
GetGLXDRIDrawable(psc->display, gc->currentDrawable);
|
||||
|
||||
/* Simply ignore the command if the GLX drawable has been destroyed but
|
||||
* the context is still bound.
|
||||
|
@ -1832,7 +1822,7 @@ glXGetSwapIntervalMESA(void)
|
|||
struct glx_screen *psc = gc->psc;
|
||||
if (psc && psc->driScreen && psc->driScreen->getSwapInterval) {
|
||||
__GLXDRIdrawable *pdraw =
|
||||
GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
|
||||
GetGLXDRIDrawable(psc->display, gc->currentDrawable);
|
||||
if (pdraw)
|
||||
return psc->driScreen->getSwapInterval(pdraw);
|
||||
}
|
||||
|
@ -1850,7 +1840,8 @@ _X_HIDDEN void
|
|||
glXSwapIntervalEXT(Display *dpy, GLXDrawable drawable, int interval)
|
||||
{
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||
struct glx_display *priv = __glXInitialize(dpy);
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(priv, drawable);
|
||||
|
||||
/*
|
||||
* Strictly, this should throw an error if drawable is not a Window or
|
||||
|
@ -1894,7 +1885,7 @@ glXGetVideoSyncSGI(unsigned int *count)
|
|||
if (!gc->currentDrawable)
|
||||
return GLX_BAD_CONTEXT;
|
||||
|
||||
pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
|
||||
pdraw = GetGLXDRIDrawable(psc->display, 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
|
||||
|
@ -1934,7 +1925,7 @@ glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
|
|||
if (!gc->currentDrawable)
|
||||
return GLX_BAD_CONTEXT;
|
||||
|
||||
pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
|
||||
pdraw = GetGLXDRIDrawable(psc->display, gc->currentDrawable);
|
||||
|
||||
if (psc && psc->driScreen && psc->driScreen->waitForMSC) {
|
||||
ret = psc->driScreen->waitForMSC(pdraw, 0, divisor, remainder, &ust, &msc,
|
||||
|
@ -2084,7 +2075,7 @@ glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable,
|
|||
return False;
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||
pdraw = GetGLXDRIDrawable(priv, drawable);
|
||||
psc = pdraw ? pdraw->psc : NULL;
|
||||
if (pdraw && psc->driScreen->getDrawableMSC) {
|
||||
ret = psc->driScreen->getDrawableMSC(psc, pdraw, ust, msc, sbc);
|
||||
|
@ -2174,7 +2165,8 @@ glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
|
|||
int32_t * numerator, int32_t * denominator)
|
||||
{
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) && !defined(GLX_USE_WINDOWSGL)
|
||||
__GLXDRIdrawable *draw = GetGLXDRIDrawable(dpy, drawable);
|
||||
struct glx_display *priv = __glXInitialize(dpy);
|
||||
__GLXDRIdrawable *draw = GetGLXDRIDrawable(priv, drawable);
|
||||
|
||||
if (draw == NULL)
|
||||
return False;
|
||||
|
@ -2196,7 +2188,7 @@ glXSwapBuffersMscOML(Display *dpy, GLXDrawable drawable,
|
|||
{
|
||||
struct glx_context *gc = __glXGetCurrentContext();
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->psc->display, drawable);
|
||||
struct glx_screen *psc = pdraw ? pdraw->psc : NULL;
|
||||
#endif
|
||||
|
||||
|
@ -2237,7 +2229,8 @@ glXWaitForMscOML(Display *dpy, GLXDrawable drawable, int64_t target_msc,
|
|||
int64_t *msc, int64_t *sbc)
|
||||
{
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||
struct glx_display *priv = __glXInitialize(dpy);
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(priv, drawable);
|
||||
struct glx_screen *psc = pdraw ? pdraw->psc : NULL;
|
||||
int ret;
|
||||
#endif
|
||||
|
@ -2268,7 +2261,8 @@ glXWaitForSbcOML(Display *dpy, GLXDrawable drawable, int64_t target_sbc,
|
|||
int64_t *ust, int64_t *msc, int64_t *sbc)
|
||||
{
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||
struct glx_display *priv = __glXInitialize(dpy);
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(priv, drawable);
|
||||
struct glx_screen *psc = pdraw ? pdraw->psc : NULL;
|
||||
int ret;
|
||||
#endif
|
||||
|
@ -2358,7 +2352,8 @@ glXCopySubBufferMESA(Display * dpy, GLXDrawable drawable,
|
|||
CARD8 opcode;
|
||||
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||
struct glx_display *priv = __glXInitialize(dpy);
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(priv, drawable);
|
||||
if (pdraw != NULL) {
|
||||
struct glx_screen *psc = pdraw->psc;
|
||||
if (psc->driScreen->copySubBuffer != NULL) {
|
||||
|
@ -2425,7 +2420,7 @@ glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer,
|
|||
unsigned int i = 0;
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->psc->display, drawable);
|
||||
if (pdraw != NULL) {
|
||||
struct glx_screen *psc = pdraw->psc;
|
||||
if (psc->driScreen->bindTexImage != NULL)
|
||||
|
@ -2483,7 +2478,7 @@ glXReleaseTexImageEXT(Display * dpy, GLXDrawable drawable, int buffer)
|
|||
CARD8 opcode;
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->psc->display, drawable);
|
||||
if (pdraw != NULL) {
|
||||
struct glx_screen *psc = pdraw->psc;
|
||||
if (psc->driScreen->releaseTexImage != NULL)
|
||||
|
|
|
@ -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(dpy, awire->drawable);
|
||||
struct glx_drawable *glxDraw = GetGLXDrawable(glx_dpy, awire->drawable);
|
||||
|
||||
if (!glxDraw)
|
||||
return False;
|
||||
|
|
Loading…
Reference in New Issue