Commit graph

27 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
Dylan Baker b308a876d3 autotools: Include meson.build and meson_options.txt in dist 2019-12-05 12:01:36 -08:00
Kyle Brenneman 8709003ffd GLdispatch: Add a version script for the TSD build.
Add a separate version script export_list_tsd.ver for the TSD build of
libGLdispatch, since the two builds don't have the same set of symbols.
2018-05-24 08:42:52 -06:00
Kyle Brenneman 4914b61fa4 GLdispatch: Use --version-script instead -export-symbols.
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.
2018-04-11 15:14:10 -06:00
Kyle Brenneman 0177ade402 configure: Check if linking against libdl is necessary.
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.
2018-03-26 14:41:01 -06:00
Kyle Brenneman fa2add82a0 Move vnd-glapi/mapi/* to vnd-glapi.
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.
2016-04-19 12:48:47 -06:00
Kyle Brenneman 87ce484d49 Move trace.[ch] into the src/utils directory.
Move trace.c and trace.h into the src/utils directory instead of a
subdirectory.
2016-04-06 11:00:32 -06:00
Kyle Brenneman d79a1484ac Fix some autoconf warnings.
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.
2016-04-06 10:57:23 -06:00
Kyle Brenneman e2d44985d8 Add support for reporting application errors.
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.
2016-03-29 10:18:02 -06:00
Kyle Brenneman ca26fee143 Merge pull request #72 from evelikov/remove-elf-filtering 2016-03-21 14:44:47 -06:00
Emil Velikov f3d64458cb Remove auxiliary ELF symbol filtering
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>
2016-03-02 11:31:51 +00:00
Kyle Brenneman dcc1c9ca33 Remove the makefile for glvnd_pthread.
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>
2016-02-25 12:54:29 -07:00
Kyle Brenneman ec97db7746 Install the public header files.
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.
2016-01-13 16:04:40 -07:00
Nicolas Chauvet 48255183c5 Add few missing files and directory for make dist 2015-11-10 22:37:02 +01:00
Kyle Brenneman fd5c500b4c libGLdispatch: Don't export the OpenGL entrypoints.
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.
2015-10-30 14:58:37 -06:00
Kyle Brenneman 6540671659 libOpenGL: Fix the linker flags for libOpenGL.
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.
2015-07-31 11:29:33 -06:00
Brian Nguyen fdf67a7dcd Define driver ABI for patching libglvnd entrypoints
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.
2014-01-23 20:16:33 -08:00
Brian Nguyen ac9d409294 Export pthreads functions from libGLdispatch, rather than libGLX
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.
2014-01-23 20:16:33 -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
Aaron Plattner 61360bc961 [build] distribute files needed to build
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>
2013-09-27 03:12:29 -07:00
Aaron Plattner c552b7173c [build] make mapi a subdirectory of vnd-glapi
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>
2013-09-27 03:11:51 -07:00
Aaron Plattner debae590e7 [build] fix srcdir != builddir mistakes
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>
2013-09-26 16:17:11 -07:00
Aaron Plattner 4ecfeb2a99 [build] reorder SUBDIRS to only recurse once
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>
2013-09-26 16:17:11 -07:00
Brian Nguyen 48cbe20f60 [GLdispatch] First pass at implementing the GLdispatch API
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.
2013-08-26 11:03:42 -07:00
Brian Nguyen 873faf57b0 [GLdispatch] Build mapi
- 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.
2013-08-26 11:03:42 -07:00
Brian Nguyen 810c434324 [GLdispatch] Write pseudo-code implementations of API
This adds comments and (incomplete) code to describe the general
strategy which will be taken to implement the GLdispatch API. This
is still a WIP.
2013-08-26 11:03:42 -07:00
Brian Nguyen 8b3953b2f7 Add GLdispatch DSO
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.
2013-08-26 11:03:42 -07:00