The X headers define MODULEVENDORSTRING like so:
#ifndef MODULEVENDORSTRING
#define MODULEVENDORSTRING "X.Org Foundation"
#endif
This allows module vendors such as NVIDIA to override the vendor string at build
time, rather than hard-coding "NVIDIA Corporation" in the sources.
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Kyle Brenneman <kbrenneman@nvidia.com>
Fixes#48.
This makes the built-in x86_64 TSD stubs use RIP-relative addressing so
that the linker doesn't have to generate relocations of text sections,
which breaks PIC.
Fixes#53
__glDispatchCheckMultithreaded will now check if the thread's current dispatch
table is NULL, and if it is, it will plug in the no-op table.
This is a workaround for some broken applications which try to call OpenGL
functions without a current context. As long as the thread calls a GLX function
first, any OpenGL calls it makes later will call a no-op stub instead of just
crashing.
Added calls to __glXThreadInitialize to some of the functions in
__GLXapiExports, so that GLX extension functions will still call
__glXThreadInitialize.
Removed several header files that were copied from Mesa but aren't used in
libglvnd.
Removed everything under src/arch, also copied from Mesa but unused.
Two header files (libglxabi.h and GLdispatchABI.h) are public -- intended to be
used by vendor libraries, while the other headers are all internal to libglvnd.
Move the public header files to a new directory, include/glvnd.
Add a makefile so that the public headers are installed by make install.
KDE calls glXGetClientString with a NULL dpy argument, which crashes in the call
to XScreenCount(dpy). Work around it by explicitly checking for this and
returning some static strings.
Note that one oddity is that querying the GLX_VERSION with a NULL dpy will
return the maximum version supported by libglvnd, but specifying a display will
return the maximum supported by any vendor on the display (up to libglvnd's
supported maximum).
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
In AddVendorPointerMapping and AddVendorXIDMapping, if there is an existing
mapping, then add an assert that the new vendor library matches the old one.
Handles have to map to at most one vendor, so if we get two different vendors
then there's a bug either in libGLX or in the vendor libraries.
Renamed a bunch of structures and functions to reflect the fact that libGLX
maintains mappings of most objects directly to vendors now, not objects to
screens.
Remove the Display pointer from __GLXscreenPointerMappingHash. It's no longer
needed for anything in libGLX.so. Dispatch functions can find a vendor library
given only the GLXContext handle itself, so functions like glXGetContextIDEXT
don't need the display either.
libGLX now uses a separate hashtable for mapping GLXContext and GLXFBConfig
handles to vendor libraries.
Updated the ABI documentation to define requirements for GLXContext and
GLXFBConfig values, to ensure that there aren't ever any duplicate handles
between vendor libraries.
libGLX now only keeps track of the vendor library for each drawable, not the
screen number.
__glXVendorFromDrawable will now always return -1 for the screen. The screen
parameter will be removed in a later change.
When dispatching a function based on a GLXDrawable, generate an X error if the
drawable is invalid.
Added a helper function CommonDispatchDrawable to handle initialization,
looking up a vendor for a drawable, and reporting an error if it can't find
a vendor.
Removed __glXGetDrawableStaticDispatch, and replaced it with
CommonDispatchDrawable.
Removed the unused function __glXScreenFromDrawable.
Change the current context hash to use a recursive mutex instead of an rwlock.
In __glXLookupDisplay, don't take the lock until after InitDisplayInfoEntry
returns, so that it doesn't try to make any X calls while holding the lock.
If an X error occurs while holding a non-recursive lock, then the error handler
may call exit, which would in turn call __glXFini. That can cause a deadlock if
__glXFini tries to take the same lock.
In CommonMakeCurrent, if the new context is NULL and the drawables are not
None, then it should always generate a BadMatch error. But, if the old context
was NULL, then it would return before checking for the BadMatch error.
In MergeVersionStrings, deal with a zero return value from glvnd_asprintf. Zero
is technically a successful return value from glvnd_asprintf, even though none
of the format strings could produce it.
Remove a bit of dead code from AtomicDecrementClampAtZero. The only way for the
if(newVal < 0) branch to be taken is if (oldVal <= 0), which it can't be at
that point.
Added a Makefile to build libGLESv1_CM.so. It's copied and adapted from the one
for libOpenGL.so.
The GLESv1 library currently exports all of the core functions in gl.xml for
GLES version 1.0.
Added a Makefile to build libGLESv2.so. It's copied and adapted from the one
for libOpenGL.so.
The GLESv2 library currently exports all of the core functions in gl.xml for
GLES versions 2.0 through 3.2, inclusive.
In genCommon.py, change getLibOpenGLNamesFromRoots so that it accepts a target
parameter. Defined separate targets for each library, including libGLdispatch.
gen_libOpenGL_exports.py now takes a target parameter just like
gen_gldispatch_mapi.py does.
This is in preparation for adding function lists for the libGLES libraries.
Rewrote the x86 TSD stubs to follow the same pattern and use the same common
functions as the x86-64 stubs.
Aside from being shorter and simpler with less code duplicaiton, this will
allow entrypoint patching to work in the x86 build.
Fixed some errors in the entrypoint patching in the unit tests. The
libGLX_dummy.so library was patching in PC-relative addresses for the MOV
instructions, but those instructions expect absolute addresses.
Change the unit test makefile to use check_LTLIBRARIES instead of
lib_LTLIBRARIES so that the dummy vendor libraries aren't included in a
"make install".
Add a -rpath option to libGLX_dummy and libGLX_patchentry flags to force
libtool to actually create the .so files for them. Otherwise, it just creates
static libraries.
Add a documentation comment to entry_get_public, and change the name of the
parameter to indicate that it takes an array index instead of a dispatch table
slot.
gen_gldispatch_mapi.py now takes an extra parameter to specify which library
it's building, so that it can generate the correct function list for that
library. For libOpenGL.so, it will only generate the functions that it's going
to export.
Updated the makefiles for libOpenGL.so, libGL.so, and libGLdispatch.so to
generate the correct set of entrypoints for each library.
Moved the code to figure out the libOpenGL.so function names to genCommon.py.