Commit graph

14 commits

Author SHA1 Message Date
Kyle Brenneman a7bb6f4d19 Remove extra paragraph from license text.
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
2021-09-30 09:21:34 -06:00
Kyle Brenneman 3465c7c203 GLdispatch: Remove entry_init_public().
entry_init_public() is empty on all platforms, so just remove it.
2019-11-22 15:58:11 -07:00
Kyle Brenneman 3c27c9811e GLdispatch: Remove runtime assembly code generation.
Removed the rest of the assembly code generation from libGLdispatch. Since we
don't need to generate dispatch stubs at runtime for extension functions
anymore, the code generation is now only used to restore the dispatch stubs
after a vendor library patches them.

Now, instead of reconstructing each dispatch stub, libGLdispatch will just
allocate a copy of all of the entrypoints before patching them, and then it
uses memcpy to restore them.
2019-11-22 15:58:11 -07:00
Kyle Brenneman d850cdde46 GL: Use a table to look up core GLX functions. (#127)
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.
2017-06-20 12:53:54 -06:00
Kyle Brenneman 9796473c98 libGL: Add entrypoint stubs for GLX extension functions.
Added a new script to generate the GLX entrypoints in libGL. The new script
uses Khronos's glx.xml file for a function list.

Checked in a copy of Khronos's glx.xml, from revision 32184.
2015-10-30 14:57:29 -06:00
Kyle Brenneman 7dce9384fa libGLdispatch: Fix multiple calls to __glDispatchInit/Fini.
In libGLdispatch, initialize the pthreads table in a constructor function so
that we can use the dispatch mutex in __glDispatchInit.

In __glDispatchFini, check whether clientRefcount has dropped to zero before
tearing everything down.

libGL and libOpenGL will now call __glDispatchFini when they're unloaded, since
they also call __glDispatchInit.
2015-08-11 16:48:45 -06:00
Kyle Brenneman 7eedc37e4f libGLdispatch: Cleanup the internal patching interface.
Added a __GLdispatchStubPatchCallbacks struct to hold the callback functions
that libGLdispatch uses to patch entrypoints in each DSO.
2015-06-23 11:47:52 -06:00
Kyle Brenneman a0618089e1 libGLdispatch: Remove the pthreads table from __glDispatchInit.
Change __glDispatchInit to take no arguments, instead of having it optionlly
fill in a GLVNDPthreadFuncs structure.
2015-06-15 15:42:27 -06:00
Kyle Brenneman 085fb651aa Remove pthreadFuncs from libgl.c and libopengl.c.
Anything that references the pthreadFuncs table is now #ifdef'd out in libGL
and libOpenGL, so it's safe to remove again.
2015-06-11 13:41:29 -06:00
Kyle Brenneman fe5ebf9d70 Add the pthreadFuncs variable to libGL and libOpenGL.
The pthreadFuncs variable is actually referenced from the files that go into
libGL and libOpenGL, even though none of the functions that reference it are
used. That can lead to unresolved symbol errors.
2015-04-29 14:31:29 -06:00
Kyle Brenneman 0d990b6143 Build fixes, mostly for old systems and compilers.
- Add a config check for ((constructor)) and ((destructor)) funciton
  attributes.
- Add missing GL/glxmd.h header.
- For sufficiently old gcc versions, revert to inline asm
  implementations of Atomic{Increment,Swap,CompareAndSwap}()
- Add a local implementation of asprintf.
- entry_x86_tsd.h: Add missing cast to (char *) in entry_get_public
- glvnd_pthread.[ch]: Only use pthread_rwlock_t if it's available, and fall
  back to pthread_mutex_t otherwise.
- trace.c: Add missing _GNU_SOURCE define
- uthash.h: Fix a -Wcast-qual warning
- x11glvndclient.c: Fix a -Wcast-qual warning by using a writable
  array for storing the XGLV_EXTENSION_NAME

Based on a patch by Brian Nguyen.
2015-03-27 11:46:27 -06:00
Brian Nguyen 7ff53ca956 [libGL, libOpenGL] Register stub callbacks with GLdispatch
This allows vendor libraries to re-write dispatch stubs in these wrapper
libraries.
2014-01-23 20:16:33 -08:00
Brian Nguyen f8eff6cd99 Rename entry_patch_public() to entry_init_public()
This re-naming should help avoid confusion with the terminology used
to describe vendor library re-writing of entrypoints, also known as
"patching".  This function is called once at initialization time for
certain (e.g. x86_tls) TLS models.
2014-01-23 20:16:32 -08:00
Brian Nguyen 09126a72d5 Re-implement libGL such that ELF symbol filtering is optional
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>
2013-12-04 10:08:15 -08:00
Renamed from src/GL/GL.c (Browse further)