Remove the "If only executable code is distributed..." paragraph from
the license text. Everything now uses a normal MIT license.
The only code from Khronos that's included in libglvnd is the EGL/GL
header and XML files, which do not contain that paragraph.
Fixes https://gitlab.freedesktop.org/glvnd/libglvnd/-/issues/221
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.
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.
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.
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.
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.
The code was disabled due to a glibc bug 16272. which as of this point
remains open.
As n alternative solution is already in place and fix for the mentioned
issue is unlikely to land in order distributions, it does not make it a
viable solution that we can use (in the near future).
Drop the code for now, to prevent anyone building a completely broken
library.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Moved glvnd_pthread.h and glvnd_pthread.c into src/utils, and removed the
separate makefile for them. The other makefiles now just grab the source file
directly instead.
Reviewed-by: Andy Ritger <aritger@nvidia.com>
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.
Added an export list for libGLdispatch.so, so that it doesn't export the OpenGL
entrypoints.
The OpenGL entrypoints should only be exposed through libGL.so or libOpenGL.so,
not through libGLdispatch.so.
Fixed a couple lines in the libOpenGL makefile where it was using the wrong
variable name.
Added an explicit -version-info flag for libGLdispatch and libGLX.
Added the --no-undefined linker flag for libOpenGL, libGL, libGLdispatch, and
libGLX on systems where it's available.
This defines several callbacks to be used by vendor libraries for
rewriting top-level entrypoints defined in libglvnd:
- initiatePatch(): libglvnd calls into this function at make current
time to determine whether entrypoint patching is possible with the
given stub type and code size. The vendor library will notify
libglvnd whether offsets are needed based on a generation number.
- getOffsetHook(): libglvnd calls into the vendor library with this hook
for each loaded interface library so the vendor can lookup the stub
locations for rewriting.
- finalizePatch(): libglvnd calls into this function after the vendor
library has updated its stub locations to complete the patch.
GLdispatch previously relied on locking primitives retrieved from
libGLX, but it may be loaded and used by other interface libraries (e.g.
libOpenGL) prior to being loaded by libGLX. Instead, statically link
the glvnd_pthread wrapper library in libGLdispatch and import the
wrapper functions into libGLX when it first initializes libGLdispatch.
Unfortunately, glibc has a bug where dlopening a shared library with
DT_FILTER or DT_AUXILIARY ELF headers can cause the application to
segfault (see https://sourceware.org/bugzilla/show_bug.cgi?id=16272).
Hence, for now, we can't rely on ELF symbol filtering to implement the
libGL compatibility library for libGLdispatch and libGLX. This change
re-implements libGL such that this is no longer necessary, by building
in the glapi static dispatch stubs and implementing thin wrapper
functions around GLX entrypoints.
- Rename getCachedProcAddress() to __glXGetCachedProcAddress() and give
this public visibility. This is used by the libGL wrapper library to
retrieve GLX entrypoints at load time.
- Link libGLX with the -Bsymbolic flag so __glXGetCachedProcAddress()
avoids referencing functions in the libGL wrapper library when libGL
and libGLX are both loaded.
- Replace the hand-coded no-op definitions in libglxnoopdefs.h with
a spec file, glx_funcs.spec, and a simple Perl script, gen_stubs.pl,
which parses the file and generates no-op functions as well as
pass-through functions that are used by libGL.
- Restructure GLdispatch/vnd-glapi/mapi/entry.c such that the pure C
fallback code is in its own header, entry_pure_c.h. In each of the
entry_*.h headers, separate code not related to implementing the
static dispatch stubs into an "#if !defined(STATIC_DISPATCH_ONLY)"
block.
- Give u_current (which is #defined as _glapi_Current or
_glapi_tls_Current depending on the thread storage model used) public
visibility so it can be referenced from outside of libGLdispatch.so.
- When building libGL, include GLdispatch/vnd-glapi/mapi/entry.c in the
sources, and define STATIC_DISPATCH_ONLY so that only the static
entrypoints are compiled. Remove the -Wl,--auxiliary flags from
Makefile.am.
Bonus: fix "make distcheck" by adding GLdispatchABI.h to noinst_HEADERS.
Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
Everything needed to actually build the driver needs to be included in something
that makes it end up in the distribution tarball. For headers, use
noinst_HEADERS. For everything else, use EXTRA_DIST.
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
Currently, the GLdispatch makefile recurses into the mapi/vnd-glapi
subdirectory, which then uses files out of its parent directory. This makes it
difficult to include the mapi directory in the dist tarball because just
including it in EXTRA_DIST makes it pick up the generated Makefile in addition
to the checked-in source files.
Instead, exchange the two directories so that mapi is a subdirectory of
vnd-glapi and the former is included wholesale with EXTRA_DIST.
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
When configure is run from a directory other than the source directory, various
files fail to compile because the include paths use $(builddir) or
$(top_builddir) when the source is actually in $(srcdir) or $(top_srcdir).
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Currently, both GLX and GLdispatch recurse into src/util/trace. This causes
problems for parallel make, and breaks distclean because the first recursion
into src/util/trace deletes the Makefile, causing the second recursion to fail.
Instead, recurse directly into util from src/Makefile.am, putting it ahead of
both GLX and GLdispatch in SUBDIRS. This means that you can't just go into
src/GLX and type make, but it fixes parallel builds and distclean.
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Introduce two lists for tracking dynamic dispatch stubs: newProcList and
extProcList. newProcList contains stubs which were generated by a
getProcAddress call but not assigned a prototype from a vendor, and
extProcList contains stubs which have been assigned a prototype but may
still need the vendor's implementation to be plugged into the dispatch
tables.
Also introduce a generation number which is an attribute of both
dispatch stubs and dispatch tables, and a global variable,
latestGeneration. Each time __glDispatchGetProcAddress() generates a new
dispatch stub, latestGeneration is incremented and assigned to the new
dispatch stub. Dispatch tables with a generation number less than
latestGeneration need to be fixed up with functions from the extProcList
whose generation number is greater than the dispatch table's number.
After the fixup is complete, the dispatch table's generation is updated
to latestGeneration.
This also requires we track current dispatch tables globally; this will
be done in a subsequent change.
Link against glapi to get the required symbols we need.
- Replace hard-coded mapi and mesa paths in mapi makefiles with the
autoconf variables MAPI_PREFIX and MAPI_MESA_PREFIX
- In mapi_abi.py, create a new vnd-glapi printer which provides a
statically-linked glapi (implemented using mapi) with public symbols
for consumption by libGLdispatch.
- Create a vnd-glapi subfolder and makefile for building glapi in this
mode, copied from shared-glapi. The Makefile.am (not SConscript) has
been modified to build glapi_mapi_tmp.h using the vnd-glapi printer.
- Fix top-level makefile to call into the mapi/vnd-glapi subdirectory,
and configure.ac to generate the makefile at bootstrap time.
Move the GLdispatch header file to its own directory in src/GLdispatch,
and build a real DSO that GLX will depend on. In GLdispatch.c, add stub
functions which will later be fleshed out.