Commit graph

45 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
Dylan Baker 3a7aed009c tests: Add symbol check tests
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.
2019-12-04 10:02:00 -08:00
Kyle Brenneman 50a0db2457 GLX: Define the GLX dispatch stubs at compile time.
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.
2019-11-22 13:16:44 -07:00
Kyle Brenneman 4269cdcff4 Move glvnd_genentry into the GLX directory.
The glvnd_genentry code isn't used outside of GLX.
2019-11-22 08:38:16 -07:00
Kyle Brenneman e49caa311f Use the pkg-config variables for X11 and Xext.
In the makefiles, use the CFLAGS and LIBS variables set by the
PKG_CHECK_MODULES macros for X11 and Xext.
2019-09-12 10:15:33 -06:00
Kyle Brenneman 0dfaea2bcb Add pkg-config files for EGL, GL, GLES, and GLX.
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.
2019-09-03 09:22:52 -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 1cd6a43122 Factor out some common extension string functions.
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.
2016-10-13 13:22:13 -06:00
Kyle Brenneman 8167e35e53 GLX: Use winsys_dispatch to keep track of GLX dispatch stubs.
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.
2016-05-17 10:32:40 -06:00
Kyle Brenneman d41548599e Merge pull request #84 from kbrenneman/fix-automake-warnings
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.
2016-05-11 11:16:57 -06:00
Kyle Brenneman a635c722a5 GLX: Remove __glXDispatchNoopPtr.
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
2016-05-04 11:43:24 -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 cc0892bb1c GLX: Add app_error_check.c to libGLX.
Added app_error_check.c to libGLX, and initialize it from __glxInit.
2016-04-05 12:58:17 -06:00
Kyle Brenneman 547daaf228 GLX: Use GLX_EXT_libglvnd instead of x11glvnd.
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.
2016-03-24 12:46:41 -06:00
Kyle Brenneman 4c7a1b18e6 GLX: Add functions for the GLX_EXT_libglvnd extension.
Add some functions to handle requests for looking up vendor names and screen
numbers using the GLX_EXT_libglvnd extension.
2016-03-24 12:44:25 -06:00
Kyle Brenneman af2aeb0b42 Merge pull request #71 from evelikov/use-glproto
build: use system glproto headers
2016-03-21 14:47:05 -06:00
Emil Velikov 35ef968cab build: use system glproto headers
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>
2016-02-29 14:46:32 +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
Luca Boccassi efad8926d8 Remove autogenerated sources and .pyc on clean 2016-02-09 16:48:03 +00: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 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
Kyle Brenneman f7a918130d Moved glvnd_asprintf to src/util/utils_misc.c.
Moved the function glvnd_asprintf to a new file, src/util/utils_misc.c, so that
it can be used from other components besides libGLX.
2015-07-10 15:41:48 -06:00
Kyle Brenneman 71c4ec80b4 libGLX: Initialize __glXPthreadFuncs in libGLX instead of libGLdispatch.
libGLX will now initialize its __glXPthreadFuncs table on its own instead of
getting the table from libGLdispatch.
2015-06-15 15:42:26 -06:00
Kyle Brenneman 9382a4b4ad libGLX: Generate entrypoints for GLX extensions.
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.
2015-05-27 09:11:19 -06:00
Kyle Brenneman 2fc973366b More fixes for glXGetClientString.
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.
2015-04-13 16:28:33 -06:00
Kyle Brenneman 62a880495d Update the GLX makefile so that you can run configure and make from any directory. 2015-03-11 15:54:59 -06: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
Brian Nguyen 7a25ae5456 Simplify vendor-library ABI for libglx
- 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>
2013-11-26 18:38:07 -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 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 3eb00015de Add x11glvnd X11 extension
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).
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
Brian Nguyen 557711cde5 [GLX] Add libglxgldispatch.[ch]
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.
2013-08-26 11:03:42 -07:00
Brian Nguyen 01a58da204 [GLX] Implement the no-op GLX dispatch table
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.
2013-08-26 11:03:42 -07:00
Brian Nguyen cbe7587997 [GLX] Implement caching proc addresses in glXGetProcAddress()
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.
2013-08-26 11:03:41 -07:00
Brian Nguyen f0aa610a3d [GLX] Include libglxmapping.c and libglxnoop.h in build
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.
2013-08-26 11:03:41 -07:00
Brian Nguyen fff1fcc0c0 [GLX] Hook up glvnd_pthread
This sets up GLX to use the glvnd_pthread wrapper library, and
implements real locking around the glXGetClientString() implementation.
2013-08-26 11:03:41 -07:00
Brian Nguyen 8dad6e57f8 Implement glvnd_pthread
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.
2013-08-26 11:03:41 -07:00
Brian Nguyen 4ee8d21ae6 Implement tracing
This implements a small tracing convenience library for debugging
purposess.
2013-08-26 11:03:41 -07:00
Brian Nguyen a72dfae91a [GLX] First pass at implementing libGLX.so
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.
2013-08-26 11:03:41 -07:00