summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Brenneman <kbrenneman@nvidia.com>2016-03-07 14:52:08 -0700
committerKyle Brenneman <kbrenneman@nvidia.com>2016-03-24 12:44:25 -0600
commit3f2f59cb0ec2f86ad228b336da46f6ffcf3f9376 (patch)
treed1c07e81822dab898b208ed8151a50537e8adc7e
parent3c6d7d753c221210fb77ffaac5483c81f0b31bae (diff)
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.
-rw-r--r--src/GLX/libglx.c6
-rw-r--r--src/GLX/libglxmapping.c7
-rw-r--r--src/GLX/libglxmapping.h4
3 files changed, 9 insertions, 8 deletions
diff --git a/src/GLX/libglx.c b/src/GLX/libglx.c
index 4344231..d87e052 100644
--- a/src/GLX/libglx.c
+++ b/src/GLX/libglx.c
@@ -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;
}
}
diff --git a/src/GLX/libglxmapping.c b/src/GLX/libglxmapping.c
index c47bc30..b3242af 100644
--- a/src/GLX/libglxmapping.c
+++ b/src/GLX/libglxmapping.c
@@ -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);
diff --git a/src/GLX/libglxmapping.h b/src/GLX/libglxmapping.h
index e4bcb1c..00b5575 100644
--- a/src/GLX/libglxmapping.h
+++ b/src/GLX/libglxmapping.h
@@ -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