An added advantage to this is that it makes it really easy to build with
Python 3, the same way other Autotools projects support it:
$ export PYTHON=/usr/bin/python3
$ ./configure
Remove FindProcIndex, __eglSetDispatchIndex, and
__eglDispatchFindDispatchFunction from egldispatchstubs.c.
The dispatch indices are allocated and assigned during initialization, so none
of those functions are ever called.
Don't point nonst_HEADERS or EXTRA_DIST at entire directories. That causes
"make dist" to include files that it shouldn't, such as configured makefiles
and .pyc files.
Also added a few generated header files to noinst_HEADERS.
The -export-symbols option in libtool creates a version script on Linux, but
on FreeBSD it instead uses the -retain-symbols-file option, which doesn't do
anything with the dynamic symbol table.
Instead, manually pass the --version-script option to the linker.
The third parameter to mincore(2) can be a pointer to char or unsigned char,
depending on what system it's building on. To build in either case, just cast
that argument to a (void *).
Add an AC_CHECK_FUNC call to check whether dlopen is available without any
additional libraries. Some systems provide dlopen as part of libc, in which
case we can't (and don't need to) link against libdl.so.
Generating a symbol list for the entrypoint libraries used to be necessary when
we generated the same set of dispatch stubs in each library.
Since then, we only generate the stubs that each library is going to export, so
we don't need a separate export list anymore.
Don't generate g_glapi_mapi_gl_tmp.h in the libGL makefile. That's not needed
anymore, because all of the GLDispatch stuff is built separately under
src/GLdispatch/vnd-glapi.
Likewise, remove the STATIC_DISPATCH_ONLY define from the compiler flags.
When dlsym is handed an address in a shared object that doesn't match a symbol
in that shared object (such as a C++ vtable) it returns success but sets
dli_sname to null.
Handle this case rather than crashing.
Older versions of glxproto.h contained a typo where "Attribs" was misspelled.
The typo was fixed in the xorgproto version of glxproto.h, breaking the API.
Fixes#149.
If libglvnd is installed onto a system that already has non-libglvnd versions
of any of the OpenGL libraries installed, then ldconfig can get confused about
which files to create symlinks to. At worst, you could end up with a mix of the
libglvnd libraries and leftover non-libglvnd libraries.
To avoid that, bump the version numbers in these filenames:
- libGL.so.1.0.0 -> libGL.so.1.7.0
- libGLESv1_CM.so.1.0.0 -> libGLESv1_CM.so.1.2.0
- libGLESv2.so.2.0.0 -> libGLESv2.so.2.1.0
- libEGL.so.1.0.0 -> libEGL.so.1.1.0
Fixes https://github.com/NVIDIA/libglvnd/issues/147
In u_execmem.c, use entry_stub_size and MAPI_TABLE_NUM_DYNAMIC to determine how
much executable memory to allocate, instead of just hard-coding 256KB.
The stubs on some architectures are larger than 64 bytes, so 256KB isn't always
going to be large enough, and it's wasteful on architectures with stubs that
are smaller than 64 bytes.
Remove the #ifdefs and the Win32 and malloc-based code from u_execmem.c. It's
not needed or used anymore, and even if it was, the allocation code is in
src/utils/utils_misc.c now.
Added a dispatch handler for glXCreateContextAttribsARB. It'll look for a
GLX_SCREEN attribute first if the caller provides one, and then the GLXFBConfig
handle if the caller doesn't.
These aren't used by the build system, so there's no reason to include them in
the repository.
Leave the LICENSE file, to indicate the license as it appeared in the snapshot
from https://github.com/DaveGamble/cJSON/
This option is not recognized by clang, so it produces an error when configured
with
CC=clang ./configure
error: unknown warning option '-Wno-misleading-indentation'; did you mean '-Wno-missing-declarations'? [-Werror,-Wunknown-warning-option]
This flag is only needed for cJSON.c. Deobfuscate that file just enough to
eliminate the misleading indentation warnings, then remove the warning flag from
Makefile.am.
This produces a warning when built with clang:
../../home/aaron/git/libglvnd/src/util/glvnd_genentry.c:46:26: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
#if defined(__GNUC__) && USE_ASM
^
../../home/aaron/git/libglvnd/src/util/glvnd_genentry.c:40:18: note: expanded from macro 'USE_ASM'
#define USE_ASM (defined(USE_X86_ASM) || \
Instead, use the defined(...) conditions to conditionally define USE_ASM to 1 or
0 explicitly.
The Power8 spec allows for implementations to implement the 128-bit
lq/stq instructions in ways that perform much slower than the
equivalent pairs of ld/std instructions; So, convert lq/stq
to their equivalent ld/std pairs.
From section 3.3.4 in the PowerISA v.30B spec:
The lq and stq instructions exist primarily to permit software to access
quadwords in storage "atomically"; see Section 1.4 of Book II. Because GPRs
are 64 bits long, the Fixed-Point Facility on many designs is optimized for
storage accesses of at most eight bytes. On such designs, the quadword
atomicity required for lq and stq makes these instructions complex to
implement, with the result that the instructions may perform less well on these
designs than the corresponding two Load Doubleword or Store Doubleword
instructions.
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
The missing comma caused the "GL_ES_VERSION_3_1" and "GL_ES_VERSION_3_2" to
concatenate into non-existing feature name. Symbols from gles 3.1 and 3.2 were
then missing in the generated files.
Made the names for macros and common variables more consistent.
Added a GLDISPATCH_PAGE_SIZE macro to specify the page size that it uses to
align the dispatch stubs. This value can be overridden at configure time, so a
later change could allow the configure script to figure out the page size on
architectures where it could vary.
This is all formatting changes, so there should be no functional difference.
libGL.so now looks up the GLX core functions using a simple table, so that it
doesn't have the overhead of looking them up by name every time it's loaded.
Removed the (mutex != NULL) checks from __glXGLLoadGLXFunction, since it's no
longer called without a mutex.
Removed __glXWrapperInit, since it doesn't do anything anymore. Also removed the header file libgl.h, which only contained the declaration for __glXWrapperInit.
EGL: Allow vendor libraries to identify platforms for eglGetDisplay.
Add a new optional function __EGLapiImports::findNativeDisplayPlatform. Vendor
libraries can provide that function to identify the platform for the native
display passed to eglGetDisplay.
Reviewed-by: Emil Velikov emil.velikov@collabora.com
Change the cache clear instructions for generated PPC64LE code so that it uses
an input variable instead of an output variable.
With an output variable, it doesn't use the correct address for the dcbst and
icbi instructions, possibly causing it to crash.
Since the inseption of EGL/GBM the unofficial way to force
the platform was via EGL_PLATFORM="drm".
Strictly speaking one could remove the gbm one, but it should have no
side effects. Plus it's more consistent with other platforms.
In either case, one should not be using eglGetDisplay but the Platform
version of the API.
Signed-off-by: Emil Velikov <emil.velikov@gmail.com>
Rename the file entry_x86_64_common.c to entry_simple_asm.c, since it's used
for more than just x86 systems.
In addition, it's now used for aarch64 as well.
Fill in PPC64LE STUB_TEMPLATE, changing type from unsigned char[] to
uint32_t[]. Set DISPATCH_FUNC_OFFSET accordingly for PPC64LE.
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
Fill in STUB_ASM_CODE macro and ENTRY_TEMPLATE[] array, changing type of the
latter to uint32_t[].
Define TEMPLATE_OFFSET_TLS_ADDR and TEMPLATE_OFFSET_SLOT relative to end of
ENTRY_TEMPLATE[] array.
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
Added the files and makefile changes needed for adding support for ppc64le
dispatch stubs.
The actual assembly code still needs to be written, along with any other
arch-specific requirements for self-modifying code.
The new entry_ppc64le_*.c files are mostly based on the x86-64 files.
It still needs:
- Assembly code for OpenGL dispatch stubs in entry_ppc64le_tls.c,
entry_ppc64le_tsd.c, or both.
- Assembly code for GLX dispatch stubs in glvnd_genentry.c.
- Assembly code for the entrypoint patching tests in patchentrypoints.c.
The ".syntax divided" directive causes build errors some compilers.
The error is because the compiler apparently generates unified syntax by
default and expects inline assembly to use unified syntax, and so just
generates a single ".syntax unified" directive at the top. The ".syntax
divided" directive then causes problems, because the compiler still generates
unified syntax for the rest of the C code in the file.
As far as I can tell, newer versions of gcc will expect inline assembly to use
divided syntax, and they generate the necessary .syntax directives to cope with
switching to unified syntax in inline assembly.
This is a minor tweak to the x86-64 GLX entrypoint generation. On an x32 build,
it'll use the same stubs as for x86-64, but when it patches in the address to
the vendor library's dispatch function it has to expand the address to 64 bits.
The GLX dispatch stubs for x86-64 work by loading the address of the vendor
library's dispatch function as a 64-bit immediate value for a movabs
instruction. It loads the address into the RAX register, which is safe to
overwrite in either ABI, so the same code works for both.
Added three new configure options to disable building the EGL, GLX, GLES
libraries.
In the tests makefile, move the list of test scripts to separate unconditional
variables, and add those to EXTRA_DIST. Just conditionally adding variables to
TESTS isn't enough to include the test scripts in the dist package.
Remove the __GLdispatchProcEntry struct and list, and remove the generation
counter for the dispatch tables and stubs.
Generated stubs are just added to the end of the table, so instead of a
generation counter, it's sufficient to just keep track of the number of entries
that we've populated in each table.
FixupDispatchTable now just populates any new table entries, starting after
whatever the last populated index was. It also now fetches the function names
from GLAPI instead of using its own list.
Removed CreateGLAPITable. FixupDispatchTable will allocate the table if
necessary. Since it doesn't need to treat static and dynamic stubs differently,
initializing a new empty table is no different than updating an existing table.
Also added a check for a calloc failure in __glDispatchCreateTable and
FixupDispatchTable, which will now propogate that error up to the caller.
Removed _glapi_init_table_from_callback, and the script that generates it.
Instead, libGLdispatch.so just iterates over the stub list to find the name for
each function.
Also removed the struct definition for _glapi_table, since it's only used in
_glapi_init_table_from_callback. Everything else just treats it as an array
of pointers.
Changed the public_stubs array so that it includes the full name of each
function, including the "gl" prefix, so that it can pass that name to the
vendor's getProcAddress callback.
Changed stub_find_by_slot to use an array lookup instead of a linear search.
The mapi_stub struct now just keeps a pointer to the name of the stub, for both
static and dynamic stubs.
Removed the public_string_pool variable. Instead, the public_stubs array
has the function names inline.
Rewrite the x86 TSD dispatch stubs so that they go through the GOT and PLT
tables to look up _glapi_Current and _glapi_get_current, instead of using
absolute addresses for them.
Fixes https://github.com/NVIDIA/libglvnd/issues/108
Fix the generated code for the x86 TLS dispatch stubs.
Update the x86 TLS stubs to use the same common code as the rest of the x86 and
x86-64 entrypoints.
Fixes https://github.com/NVIDIA/libglvnd/issues/18
In eglGetDisplay, try to identify an X11 display based on a known function
pointer.
This is based on a patch by ajax@redhat.com:
https://github.com/NVIDIA/libglvnd/pull/102
The problem with using dlsym to look for wl_display_interface is that
variables by that name are emitted into other client libraries besides
libwayland-client. libSDL2 has this property, at least. Instead of that,
use dladdr() to look up the name of the symbol pointed to, and accept
any symbol with the right name as being wayland enough.
Signed-off-by: Adam Jackson <ajax@redhat.com>
v2: Minor formatting change.
In __eglFini, check for a fork, but don't call __glDispatchCheckMultithreaded.
If a vendor has patched the OpenGL entrypoints, then
__glDispatchCheckMultithreaded will try to call the vendor's thread attach
callback, but the vendor library may have already been unloaded.
Fixes https://github.com/NVIDIA/libglvnd/issues/103
Added a new function to libGLdispatch, __glDispatchForceUnpatch, which forces
it to unpatch the OpenGL entrypoints before libEGL or libGLX can unload the
vendor library that patched them.
If a vendor patches the OpenGL entrypoints, libGLdispatch doesn't unpatch them
when that vendor's context is no longer current, because that adds too much
overhead to repeated MakeCurrent+LoseCurrent calls. But, that also means that
the patch callbacks end up being dangling pointers after the vendor library is
unloaded.
This mainly shows up at process termination when a process loads both libEGL
and libGLX, because __glxFini and __eglFini will both call the vendor's
threadAttach callback.
Fixes https://github.com/NVIDIA/libglvnd/issues/103
Change the assembly template arrays for ARMv7 to use arrays of 16-bit integers
instead of 8-bit.
This removes the need to byte swap them on little-endian systems.
When libGLX.so selects a vendor libray for an X screen, it will look for an
environment variable __GLX_FORCE_VENDOR_LIBRARY_<N>, where <N> is the screen
number.
This is mainly for testing and debugging. It allows unit tests to force
different vendors on different screens, and it allows tests to avoid preloading
the dummy vendor library.
Moved the UnionExtensionStrings and IntersectionExtensionStrings functions from
EGL to utils_misc.c.
Changed libGLX to use the common UnionExtensionStrings and IsTokenInString
functions instead of its own versions of them.
Moved ParseClientVersionString to libglx.c near where it's used, and deleted
libglxstring.c and libglxstring.h.
In __eglGetEGLDispatchAddress, initialize the addr variable to NULL. Otherwise,
it could end up being uninitialized if there are no vendor libraries loaded.
Fixes https://github.com/NVIDIA/libglvnd/issues/96
In egldispatchstubs.c, __eglDispatchFetchByDevice will report an
EGL_BAD_DEVICE_EXT error for an invalid device instead of EGL_BAD_DISPLAY.
In LoadVendorsFromConfigDir, fix a typo in the path separator handling.
Changed the default vendor config paths to be based on the directory options
for configure. libEGL will now look under the sysconfigdir and datadir paths,
in a "glvnd/egl_vendor.d" subdirectory.
Added the "datadir" variable to the pkg-config file, so that other packages can
find the expected location of the JSON files.
Trying to cast between __eglMustCastToProperFunctionPointerType and other
function pointer types causes strict aliasing warnings on some compilers.
Instead, just use a simple (void *) type for retrieving function pointers from
a vendor library, like libGLX does.
Fix the message types in the _eglReportError and _eglReportCritical macros.
In eglDebugMessageControlKHR, check if the attribute list is valid even if the
callback is NULL.
In eglDebugMessageControlKHR, set the callback pointer whether or not the
attribute list is NULL.
In eglLabelObjectKHR, if the vendor library returns an error for an object type
other than EGL_OBJECT_THREAD_KHR, then return that error to the caller.
Fix the error handling and return value in eglBindAPI if the API isn't one of
GL or GLES.
Add a missing error callback in eglMakeCurrent.
In glXMakeCurrent, make sure to add the new display to libGLX's tracking, so
that it gets a callback if the display is closed.
This fixes a dangling pointer to the display in the __GLXThreadState struct if
the application closes the display while it's still current.
libEGL will now check the client extension strings of each vendor when the
vendor is loaded, and record whether a vendor supports
EGL_EXT_device_base/EGL_EXT_device_enumeration, and the device, Wayland, and
X11 platform extensions.
eglGetDisplay will now check for whether any vendor supports Wayland before it
tries to guess whether the native display pointer is a Wayland display.
When enumerating the device handles for each vendor, libEGL will check for
either EGL_EXT_device_base or EGL_EXT_device_enumeration, instead of just
EGL_EXT_device_base.
eglGetDisplay will now check for EGL_PLATFORM_DEVICE_EXT and
EGL_PLATFORM_WAYLAND_KHR.
For EGL_PLATFORM_DEVICE_EXT, it will just check if the native display is a
valid EGLDeviceEXT handle.
For EGL_PLATFORM_WAYLAND_KHR, it will check the actual pointer, using similar
logic to Mesa.
libEGL will now forward calls to eglBindAPI to the vendor libraries.
Defined as part of the interface that libEGL only supports OpenGL and GLES.
This should simplify the task of porting a driver to EGL, since the eglBindAPI
behavior is closer to a non-glvnd driver.
In __glXAPITeardown, use pthread_mutex_trylock to take the context hash mutex,
and just skip freeing the context data if the mutex isn't available.
In some cases, such as a multi-threaded program that hits an X11 I/O error,
another thread could be blocked in a glXMakeCurrent call, and so trying to take
the context list mutex would deadlock.
In addition, fix the current context bookkeeping in fork recovery. After a
fork, the contexts should still exist, but none of them will be current
anymore.
In __glDispatchFini, remove the assert that the current context list is empty.
Even though libGLX/libEGL will clear out the current context for the current
thread, another thread may still have a current context.
Implemented the EGL_KHR_debug extension in libEGL.
Updated the error reporting throughout libEGL to call the debug callback.
This requires that all vendor libraries also support EGL_KHR_debug. The reason
is that the debug callback has to be called every time an EGL error is
generated, and vendor libraries are still responsible for keeping track of EGL
errors on their own.
libEGL should be able to cope with a vendor library that doens't support
EGL_KHR_debug, but if that vendor library is used, then the extension won't
work correctly.
The implementation is mostly based off of libGLX.
Unlike GLX, libEGL will load all vendor libraries up front. This is necessary
for dealing with eglGetPlatformDisplay, as well as many client extensions.
Dispatching EGL functions is generally simpler than GLX. All display extension
functions by definition can be dispatched based on an EGLDisplay handle, so
it doesn't need to provide lookup functions for contexts or surfaces, and
vendor libraries don't have to add any EGL objects to tracking.
Only OpenGL and OpenGL ES and a handful of client extensions are supported so
far.
In __glDispatchLoseCurrent, don't try to restore the default entrypoints.
Instead, __glDispatchMakeCurrent will check if it's using a different vendor
library, and if so, it will unpatch and repatch the entrypoints then. If it's
using the same vendor library (which will usually be the case), then it can
leave them patched and skip the patch overhead.
Some applications will call glXMakeCurrent to release and bind the same context
every frame, sometimes multiples times. Each patch and unpatch sequnce can chew
up 1-2 milliseconds. That's enough to significantly reduce the framerate of
some applications.
Reviewed-by: James Jones <jajones@nvidia.com>
Added a license+copyright comment to winsys_dispatch.[ch].
Renamed __GLVNDwinsysDispatchIndexHash to __GLVNDwinsysDispatchIndexEntry,
since it's not a hashtable anymore.
In __glXLookupVendorByName, only call __glvndWinsysDispatchGetCount once
instead of on every loop iteration.
Removed the locks for the GLX dispatch index list and the generated GLX
dispatch stubs. Instead, the vendor hashtable's lock is used for all three.
There's enough overlap between when the three locks are taken that using
separte locks has very little benefit and increases the risk of deadlocks.
Added functions to create and manage a per-vendor dispatch table for
window-system functions.
These will replace the __GLXdispatchFuncHash hashtable in GLX.
Some minor cleanup of __glXFetchDispatchEntry.
Handle the various failure cases more directly: If we can't find a name, or if
the vendor library doesn't support a function, then return early.
If we can't allocate a cache entry for the function, then return the dispatch
stub anyway. It can try to store the stub again next time.
In cacheProcAddress, check if the function is already in the hashtable before
trying to add it. It's possible that another thread might have already called
glXGetProcAddress for the same function.
In addition, allocate each cache entry with a single malloc instead of a malloc
and a strdup.
The dispatch functions in libGLX are now added to the GLX dispatch list just
like vendor-provided dispatch functions would be.
The function name cache in glXGetProcAddress is no longer required for
correctness, because it can look up a locally-defined dispatch stub in the same
list as the vendor-provided stubs.
In addition to simplifying glXGetProcAddress, this allows vendor libraries to
look up all GLX functions by index. In particular, this would allow a vendor
to look up glXDestroyContext, which would let it recover properly if it fails
to add a new context to the context-to-vendor mapping.
Remove the __GLXdispatchIndexHash table, and use the list in winsys_dispatch.c
to keep track of the function indices, names, and dispatch stubs.
If libGLX generates a GLX dispatch stub, then it will now assign an index to it
when it generates the stub, not when it fills in the stub. That lets it treat
generated stubs the same way regardless of whether they've been filled in or
not.
When assigning an index, it will now call the setDispatchIndex callback for
every vendor library, not just the vendor that provided the dispatch stub.
When loading a vendor library, it will call the new vendor's setDispatchIndex
callback for every existing GLX dispatch function.
Added a new file, winsys_dispatch.c, with functions for keeping track of the
indices, names, and dispatch stubs for window-system functions.
This will replace the __GLXdispatchIndexHash hashtable in GLX.
It's independant of the window system, so it should be usable for EGL as well.
Fix the warnings that autogen.sh spits out.
Added libtool convenience libraries for the source files in src/util instead of
including them directly in other makefiles. This avoids a bunch of
subdir-objects warnings.
Added libtool convenience libraries for each of the glapi builds.
Flattened the vnd-glapi directory. In theory, just setting the subdir-objects
flag should be enough, but that causes failures where "make distcheck" doesn't
build all of the source files.
Removed the header file and the script to generate the __glXDispatchNoopPtr
table.
Also removed the dependency on Perl from configure.ac, since the rest of the
scripts are in Python.
Reviewed-by: aplattner@nvidia.com
Removed the functions __glXGetCurrentDispatch and __glXGetStaticDispatch.
Everything that used either one now looks up the __GLXvendorInfo pointer
instead.
Also removed __glXGetGLDispatch, since it's not used anywhere.
Reviewed-by: aplattner@nvidia.com
In MergeExtensionStrings currentString was read after it was realloc'ed
to make space for the extra extensions.
This patch makes the function read the realloc'ed memory instead. To
allow that to work 'buf' has to be null terminated on after every
extra extension is written.
Moved everything under src/GLdispatch/vnd-glapi/mapi/ to
src/GLdispatch/vnd-glapi.
Removed the subdir-objects flag.
Using subdir-objects causes errors when you do a make followed by a
"make distcheck", because for some reason the distcheck doesn't build all of
the source files.
Add GL_OES_point_size_array to the set of features and extensions that are
exported from libGLESv1_CM.so.
According to the OpenGL ES 1.1 spec, all required extensions are supposed to be
statically exported from the library. GL_OES_point_size_array is the only
required extension that defines any functions.
Move the various vnd-glapi builds into individual .la files in the vnd-glapi
makefile, instead of defining them in the OpenGL, GL, GLESv1, and GLESv2
makefiles.
Fixed a few order and variable name warnings.
Defined convenience libraries for the source files under src/util, to avoid the
subdir-objects warning from them.
If glXDestroyContext is called with NULL for the GLXContext, then it will now
report an error using glvndAppErrorCheckReportError but it won't generate a
GLXBadContext error.
Some existing drivers (NVIDIA, Mesa, and possibly others) will just silently
return in that case, and some applications depend on that behavior.
By the time __glXFini is called, the destructors in the vendor libraries may
have already been called, so it's not safe to call any functions in the vendor
library.
__glXFini will now check for a fork and go through fork recovery, but it won't
call __glDispatchCheckMultithreaded. If there was a current context, then
__glDispatchCheckMultithreaded might call the vendor's thread attach callback.
The libglvnd libraries will now check for a new environment variable,
__GLVND_APP_ERROR_CHECKING. If it's set to a non-zero value, then libglvnd will
check for and report some application errors.
Many non-libglvnd implementations of libGL.so have been fairly tolerant of
certain application bugs. Libglvnd has to be similarly tolerant to support
existing apps that the developers can't or won't fix.
The new __GLVND_APP_ERROR_CHECKING provides a way to check for some of those
errors, so that hopefully there will be fewer broken apps in the future.
In addition to the setting itself, this updates the no-op stubs in
libGLdispatch to report an error when the app tries to call an OpenGL function
without a current context. Later changes will likely add other error checks.
Delete the x11glvnd directory.
Commented out the two tests that depend on it, testx11glvndproto and
testglxnscreens. Eventually, they should be rewritten to use the
GLX_EXT_libglvnd extension instead.
Reworked libGLX.so to use the GLX_EXT_libglvnd extension instead of x11glvnd.
In __glXLookupVendorByScreen, use __glXQueryServerString to look up the vendor
name string, and then split it up with strtok_r.
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.
libGLX will now use XAddExtension and XESetCloseDisplay to register a callback
when a display is closed.
Removed XGLVRegisterCloseDisplayCallback and
XGLVUnregisterCloseDisplayCallbacks from the x11glvnd client library.
This is in preparation for removing the x11glvnd extension.
Rename __GLdispatchAPIState to __GLdispatchThreadState, to make it clearer that
the structure contains thread-specific data.
Updated some out-of-date comments.