Commit 8ece1971 authored by Adam Jackson's avatar Adam Jackson 🎧
Browse files

GLdispatch: Export __glDispatchSetCurrentThreadState

This seems to be the shortest path to getting Delay working. It's kind
of playing with fire, hence the warning, but it does seem to work if
you're careful.

Another option that I considered was to use dlmopen() to put libEGL into
its own link map (and thus own TLS scope). That doesn't work because of
dlmopen bugs, and wouldn't be portable outside of glibc and Solaris.

Another another option I consider was to add a new GLDISPATCH_API_BLAH
enum and teach the frontend libraries to handle it. This got ugly
quickly, in part because I think that ends up wanting additional API
between the frontend and vendor library without having a good way to
signal from the frontend that that API is available. So if we're adding
API anyway, simply exporting one function we already have seems quite a
bit simpler.
parent acc65445
Pipeline #193556 passed with stages
in 1 minute and 47 seconds
......@@ -109,7 +109,6 @@ static int firstUnusedVendorID = 1;
*/
static glvnd_key_t threadContextKey;
static void SetCurrentThreadState(__GLdispatchThreadState *threadState);
static void ThreadDestroyed(void *data);
static int RegisterStubCallbacks(const __GLdispatchStubPatchCallbacks *callbacks);
......@@ -606,7 +605,7 @@ PUBLIC GLboolean __glDispatchMakeCurrent(__GLdispatchThreadState *threadState,
/*
* Set the current state in TLS.
*/
SetCurrentThreadState(threadState);
__glDispatchSetCurrentThreadState(threadState);
_glapi_set_current(dispatch->table);
return GL_TRUE;
......@@ -635,7 +634,7 @@ static void LoseCurrentInternal(__GLdispatchThreadState *curThreadState,
UnlockDispatch();
if (!threadDestroyed) {
SetCurrentThreadState(NULL);
__glDispatchSetCurrentThreadState(NULL);
_glapi_set_current(NULL);
}
}
......@@ -678,7 +677,7 @@ __GLdispatchThreadState *__glDispatchGetCurrentThreadState(void)
return (__GLdispatchThreadState *) __glvndPthreadFuncs.getspecific(threadContextKey);
}
void SetCurrentThreadState(__GLdispatchThreadState *threadState)
void __glDispatchSetCurrentThreadState(__GLdispatchThreadState *threadState)
{
__glvndPthreadFuncs.setspecific(threadContextKey, threadState);
}
......@@ -706,7 +705,7 @@ void __glDispatchReset(void)
UnlockDispatch();
/* Clear GLAPI TLS entries. */
SetCurrentThreadState(NULL);
__glDispatchSetCurrentThreadState(NULL);
_glapi_set_current(NULL);
}
......
......@@ -314,6 +314,11 @@ PUBLIC void __glDispatchLoseCurrent(void);
*/
PUBLIC __GLdispatchThreadState *__glDispatchGetCurrentThreadState(void);
/*!
* This API should not be used by anyone. You have been warned.
*/
PUBLIC void __glDispatchSetCurrentThreadState(__GLdispatchThreadState *threadState);
/**
* Checks to see if multiple threads are being used. This should be called
* periodically from places like glXMakeCurrent.
......
......@@ -16,6 +16,7 @@
__glDispatchNewVendorID;
__glDispatchRegisterStubCallbacks;
__glDispatchReset;
__glDispatchSetCurrentThreadState;
__glDispatchUnregisterStubCallbacks;
__glDispatchForceUnpatch;
local: *;
......
......@@ -15,6 +15,7 @@
__glDispatchNewVendorID;
__glDispatchRegisterStubCallbacks;
__glDispatchReset;
__glDispatchSetCurrentThreadState;
__glDispatchUnregisterStubCallbacks;
__glDispatchForceUnpatch;
local: *;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment