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
These use the symbol-check.py script from mesa, and should help to
ensure that glvnd doesn't start exposing/hiding new symbols. It's also
useful to double check that meson and autotools are doing the same
thing.
Rewrote the generated dispatch stubs for GLX so that they're all defined at
compile time, instead of generating them at runtime.
Insted of patching the address of the vendor-provided functions into the
assembly stubs, it will now keep a separate array of function pointers. The
assembly stubs will look up the approprite entry in that array and jump to it.
As a result, the assembly code is entirely static, so we don't need to deal
with generating or modifying executable code at runtime.
This preserves the names from Mesa's gl, glesv1_cm, glesv2, and egl pkgconfig
data, and for compatibility with that, gl.pc gives you libGL.
Also added glx.pc and opengl.pc for libglvnd's libGLX and libOpenGL libraries.
If newer applications want to explicitly depend on libGLX and the appropriate
rendering API they can ask for the new pkgconfig names.
Note that the version numbers in each file are the API versions that each
library exposes, not the libglvnd package version.
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 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.
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.
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
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.
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.
As pointed out with commit d5bc0866a8 "Check for glproto in
configure.ac" we want to rely on the upstream/distribution provided
package. Thus lets remove the in-tree copy.
Also make sure we use the headers (add the missing CFLAGS).
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.
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.
libGLX will now generate entrypoints for GLX extension functions if it can't
find a dispatch function from a vendor library.
The generated entrypoints will simply jump to a dispatch function. With the
extra layer of indirection, glXGetProcAddress can return a valid function
pointer for GLX extensions before it loads any vendor libraries.
Issue #34.
glXGetClientString will now allocate a buffer for the string and will merge
the strings from multiple vendor libraries.
For GLX_VENDOR, it will return each vendor library's string, separated by
commas.
For GLX_VERSION, it will report the highest version number of any vendor
library, up to the GLX version that libglvnd itself supports (currently 1.4).
For GLX_EXTENSIONS, it will return the union of all extensions advertised by
all vendor libraries.
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>
- Pull GL dispatch callback typedefs into GLdispatchABI.h. This is
a common header which will be shared between the libGLX and libEGL
ABIs.
- Add extern "C" blocks to libglxabi.h and GLdispatchABI.h so these
headers may be used with vendor libraries that are built C++.
- Remove support for auxiliary dispatch table management
(libglxgldispatch.[ch] and __GLdispatchExports). This can be added
back in later on if it proves useful.
- In libglxmappings.c, replace static initialization of glxExportsTable
with one-time runtime initialization of the table.
- In libglxmappings.c, use __glDispatchCreateTable() directly to create
the initial dispatch table.
- In libglxnoopdefs.h, remove unnecessary includes of libglxabipriv.h
and libglxnoop.h.
- Add screen mapping functions to the GLX exports table. Some extension
functions not implemented by libglvnd, e.g. glXCreateContextAttribsARB()
from GLX_ARB_create_context, may need to update the mappings from
context or drawable to screen that are managed by libglvnd in order to
work properly. Additionally, dispatch functions implemented by vendor
libraries for GLX extension functions may want to query these mappings
in order to properly dispatch the call.
- Remove the getDispatchProto() vendor callback. This is not needed by
libglvnd since libglvnd does not support mapping more than one
entrypoint to a single dispatch stub. See GLdispatch.c for the
rationale behind this decision.
- Remove redundant typedefs to prevent build errors.
- Delete the vendorData parameter from the getProcAddress() vendor
callback, which isn't useful if there is no support for more than one
libglvnd dispatch table per context. Add the isClientAPI parameter,
which can be used to distinguish between getProcAddress() requests for
GLX functions versus getProcAddress() requests for client API
functions.
- Remove the "screen" argument from Remove.*Mapping() functions. This
is unnecessary, as the hash key used to lookup the mapping object in
libglvnd's hashtables doesn't depend on the screen (which is the hash
value). It's problematic since in some cases we don't actually know
the value of the screen mapped to by a key.
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>
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>
This will be used to handle the corner case when a drawable XID is
passed into the API library which belongs to an X window or otherwise
has never been seen before by the process, by providing a way to lookup
which screen the corresponding drawable belongs. This still is racey
since we can't guarantee a different process won't free the XID and
cause it to be recycled as a handle for a different resource after the
lookup, but better than not being able to figure out the mapping at all.
This extension also solves the less-difficult problem of mapping a
screen to a vendor name (though it may make more sense to at some point
directly map drawables to a vendor to better support render-offload
scenarios).
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.
This implements thin wrappers around libGLdispatch which allow vendors
to manage their own dispatch tables. See documentation in the interface
header file libglxabi.h for more details.
Set the __glXDispatchNoopPtr statically to the __glXDispatchNoop
dispatch table, defined in libglxnoop.c.
Define no-op GLX 1.4 templates in libglxnoopdefs.h, which is included by
libglxnoop.c. We do this instead of defining the no-op functions
directly because these functions will also be needed by the libGL filter
library. To facilitate code sharing, these templates use GLXNOOP and
NOOP_FUNC() macros to respectively define the function qualifiers and
prefix (e.g. "glX") of each no-op function.
This also doubles as a way to store addresses of locally-exported GLX
functions; we use a pthread_once() callback to initialize the table
with these addresses.
libglxmapping.c implements functions needed for libGLX to map function
calls to vendors for dispatching.
libglxnoop.h contains a pointer to a no-op dispatch table.
These will be re-implemented in a later change.
This is a wrapper library around libpthread which implements
single-threaded fallbacks in case the API library is loaded in an
application which does not link against pthreads.
Add a makefile to build libGLX.
Update dispatch functions for each of the GLX 1.4 entrypoints
as well as stubs for glXGetProcAddress() and glXMake{Context,}Current()
to use the new vendor library ABI.