GLX: Move the display pointer to __GLXdisplayInfo.

Move the display pointer from __GLXdisplayInfoHash to __GLXdisplayInfo, so that
we don't have to pass around both the Display and __GLXdisplayInfo pointers to
a function that needs both of them.
This commit is contained in:
Kyle Brenneman 2016-03-07 14:52:08 -07:00
parent 3c6d7d753c
commit 3f2f59cb0e
3 changed files with 9 additions and 8 deletions

View file

@ -549,12 +549,12 @@ PUBLIC Bool glXIsDirect(Display *dpy, GLXContext context)
}
}
void __glXDisplayClosed(Display *dpy, __GLXdisplayInfo *dpyInfo)
void __glXDisplayClosed(__GLXdisplayInfo *dpyInfo)
{
__GLXAPIState *apiState;
apiState = __glXGetCurrentAPIState();
if (apiState != NULL && apiState->currentDisplay == dpy) {
if (apiState != NULL && apiState->currentDisplay == dpyInfo->dpy) {
// Clear out the current context, but don't call into the vendor
// library or do anything that might require a valid display.
__glDispatchLoseCurrent();
@ -569,7 +569,7 @@ void __glXDisplayClosed(Display *dpy, __GLXdisplayInfo *dpyInfo)
/*
* Stub out any references to this display in any other API states.
*/
if (apiState->currentDisplay == dpy) {
if (apiState->currentDisplay == dpyInfo->dpy) {
apiState->currentDisplay = NULL;
}
}

View file

@ -110,7 +110,6 @@ typedef struct __GLXvendorNameHashRec {
static DEFINE_INITIALIZED_LKDHASH(__GLXvendorNameHash, __glXVendorNameHash);
typedef struct __GLXdisplayInfoHashRec {
Display *dpy;
__GLXdisplayInfo info;
UT_hash_handle hh;
} __GLXdisplayInfoHash;
@ -676,7 +675,7 @@ static __GLXdisplayInfoHash *InitDisplayInfoEntry(Display *dpy)
}
memset(pEntry, 0, size);
pEntry->dpy = dpy;
pEntry->info.dpy = dpy;
pEntry->info.vendors = (__GLXvendorInfo **) (pEntry + 1);
LKDHASH_INIT(pEntry->info.xidVendorHash);
@ -730,7 +729,7 @@ static int OnDisplayClosed(Display *dpy, XExtCodes *codes)
HASH_FIND_PTR(_LH(__glXDisplayInfoHash), &dpy, pEntry);
if (pEntry != NULL) {
__glXDisplayClosed(dpy, &pEntry->info);
__glXDisplayClosed(&pEntry->info);
HASH_DEL(_LH(__glXDisplayInfoHash), pEntry);
}
LKDHASH_UNLOCK(__glXDisplayInfoHash);
@ -778,7 +777,7 @@ __GLXdisplayInfo *__glXLookupDisplay(Display *dpy)
}
XESetCloseDisplay(dpy, extCodes->extension, OnDisplayClosed);
HASH_ADD_PTR(_LH(__glXDisplayInfoHash), dpy, pEntry);
HASH_ADD_PTR(_LH(__glXDisplayInfoHash), info.dpy, pEntry);
} else {
// Another thread already created the hashtable entry.
CleanupDisplayInfoEntry(NULL, pEntry);

View file

@ -59,6 +59,8 @@ typedef struct __GLXvendorXIDMappingHashRec __GLXvendorXIDMappingHash;
* Structure containing per-display information.
*/
typedef struct __GLXdisplayInfoRec {
Display *dpy;
char *clientStrings[GLX_CLIENT_STRING_LAST_ATTRIB];
/**
@ -134,7 +136,7 @@ __GLXdisplayInfo *__glXLookupDisplay(Display *dpy);
* This is called to perform any context-related cleanup when a display is
* closed.
*/
void __glXDisplayClosed(Display *dpy, __GLXdisplayInfo *dpyInfo);
void __glXDisplayClosed(__GLXdisplayInfo *dpyInfo);
/*
* Close the vendor library and perform any relevant teardown. This should