Commit Graph

853 Commits

Author SHA1 Message Date
Kyle Brenneman 9bde8ba6b1 GLdispatch: Change entry_get_patch_addresses to take an index.
entry_get_patch_addresses now takes an index instead of a function pointer.
2019-11-22 10:18:55 -07:00
Kyle Brenneman 7832167379 GLdispatch: Simplify the dispatch stub bookkeeping.
Changed the interface in stub.h to work with function indexes instead of
mapi_stub pointers. The mapi_stub structure is now an internal detail in
stub.c.

The mapi_stub struct now only contains a name and a slot.

Removed the dynamic_stubs array. Instead, it just keeps an array of the
function names for each dynamic stub. It now looks up the function pointers
with entry_get_public, and the slot number is always equal to the index, so the
name is the only thing it needs to keep track of.
2019-11-22 10:18:55 -07:00
Kyle Brenneman 59b622a771 GLdispatch: Remove writeEntry variables in entry_generate_default_code.
Remove the writeEntry variables in the various entry_generate_default_code
functions, since it doesn't have separate writable and executable mappings.
2019-11-22 10:18:55 -07:00
Kyle Brenneman 86a9ed579b GLdispatch: Define dynamic dispatch stubs at compile time.
Instead of allocating pages of memory for the dynamic dispatch stubs, define
them at build time like the static stubs.

The dynamic stubs are identical to the static ones, so we can use the same code
to define both the static and dynamic stubs at compile time.

Removed entry_generate(). entry_generate_default_code is now only used to
restore entrypoints after patching.

Aside from simplifying things by not having a separate allocation for the
dynamic stubs, this should also allow the dispatch stubs to function properly
in both processes after a call to fork.
2019-11-22 10:18:55 -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 1613facce8 Merge branch 'github/fork/kbrenneman/fix-tests-no-assembly' into 'master'
Fix for unit tests with no assembly support

Closes #154

See merge request glvnd/libglvnd!180
2019-11-14 15:47:40 +00:00
Kyle Brenneman 207b0bf858 Add GitLab CI coverage for C stubs.
Now that the unit tests can handle builds without assembly support, add builds
with C dispatch stubs to .gitlab-ci.yml.
2019-11-14 08:38:54 -07:00
Kyle Brenneman 84d4d6628b tests: Remove testpatchentrypoints
The testgldispatch tests cover the entrypoint patching code, so the
testpatchentrypoints test is redundant.
2019-11-14 08:34:50 -07:00
Kyle Brenneman 17ecd2f156 tests: Make the glXMakeCurrent tests work without assembly support.
Change glMakeCurrentTestResults to a GLX function instead of a GL function, so
that it can be dispatched using a vendor-provided stub instead of having to
generate one.

Remove the testglxmclate test, and the --late option in testglxmakecurrent,
since that only makes sense when MakeCurrentTestResults was a GL function.
2019-11-14 08:34:49 -07:00
Kyle Brenneman bc674f798c tests: Use __GLX_FORCE_VENDOR_LIBRARY_0 for all of the GLX tests.
Set the environment variable __GLX_FORCE_VENDOR_LIBRARY_0 for all of the GLX
tests instead of __GLX_VENDOR_LIBRARY_NAME.

Individual tests can force libGLX to load a vendor library early by calling
glXGetClientString or similar.
2019-11-14 08:34:49 -07:00
Kyle Brenneman 4261cb96f6 tests: Rework testglxgetprocaddress.
It now calls glXGetClientString up front to load the dummy vendor library. The
GLX entrypoint generation path has its own test now, so this test can now work
on builds without assembly support.

It now uses glXQueryServerString to test calling a core GLX function. That's a
better test because it returns a predictable value, so we can make sure that it
actually gets dispatched to the vendor library, instead of just checking that
it doesn't crash.

For testing looking up an OpenGL function, it'll call glXGetProcAddress and
directly call __glDispatchGetProcAddress, and make sure that it gets the same
pointer from both. It doesn't try to call the function, since OpenGL
dispatching has its own tests.
2019-11-14 08:34:48 -07:00
Kyle Brenneman d1ce26f9a4 tests: Add a new test for GLX entrypoint generation.
Added a separate test program testglxgetprocaddress_genentry to test the GLX
entrypoint generation by itself instead of lumping that in with
testglxgetprocaddress.
2019-11-14 08:34:48 -07:00
Kyle Brenneman 8bb82da3fe tests: Add some threading tests for libGLdispatch.
Added a new test, testgldispatchthread, which tests some of the thread-handling
stuff in libGLdispatch.
2019-11-14 08:34:47 -07:00
Kyle Brenneman 33e1fffbca tests: Check for assembly support in testgldispatch.
In testgldispatch, if it's testing generating or patching entrypoints, then
check if assembly support is enabled, and skip the test if it's not.
2019-11-14 08:34:47 -07:00
Kyle Brenneman fc2ab74c84 Add a USE_DISPATCH_ASM macro to config.h.
Define a new USE_DISPATCH_ASM macro in config.h if assembly dispatch stubs are
enabled. Update the GLX entrypoint generation to use that macro instead of
checking all of the USE_*_ASM macros.

This is less likely to break if we add assembly support for another
architecture. In addition, it'll make it easier to skip any unit tests
that depend on being able to generate new dispatch stubs.
2019-11-14 08:34:46 -07:00
Kyle Brenneman 2a8e4011d6 Merge branch 'add-gitlab-ci' into 'master'
Add GitLab CI configuration

See merge request glvnd/libglvnd!198
2019-11-14 15:14:46 +00:00
Kyle Brenneman b581ecfa9b Merge branch 'gl3ext.h' into 'master'
Provide an empty GLES3/gl3ext.h header

Closes #195

See merge request glvnd/libglvnd!200
2019-11-07 14:39:59 +00:00
Matt Turner f466835326 Provide an empty GLES3/gl3ext.h header
The one in Mesa is empty but appears to come from some Khronos
repository, but gl3ext.h has never existed in the OpenGL-Registry
repository on github. Provide it for backwards compatibility.

Closes: https://gitlab.freedesktop.org/glvnd/libglvnd/issues/195
2019-11-06 17:41:08 -08:00
Kyle Brenneman 931791bf0b Add GitLab CI configuration.
Add a .gitlab-ci.yml file to run libglvnd's unit tests.

The "build-distcheck" target will simply run "make distcheck". That should also
cover running the unit tests for the x86-64 TLS build.

The "build-i386", "build-i386-tsd", and "build-x86-64-tsd" targets will build
and test the x86 TLS and TSD builds and the x86-64 TSD build.

The pure C stubs aren't covered yet, but they'll be easy to add once the unit
tests are fixed for them.

ARM and PPC builds also aren't covered yet.
2019-10-28 16:01:45 -06:00
Kyle Brenneman 58f1c0db95 Merge branch 'copy-mesa-gl-h' into 'master'
Update GL/gl.h to match Mesa.

Closes #194

See merge request glvnd/libglvnd!195
2019-10-28 19:55:32 +00:00
Lepton Wu 1dea90a97c GLdispatch: Improve the x86 TLS stubs performance.
This save one call frame and a similar change for mesa shows that
glGetString performance increased from 118M/s to 128M/s on my desktop.
2019-10-25 19:13:11 -07:00
Lepton Wu 6e310f7256 GLdispatch: Improve the x86 tsd stubs performance.
This skips touching %ebx most times and the same change for mesa shows that
glGetString performance increased from 114M/s to 120M/s on my desktop.
2019-10-24 14:57:46 -07:00
Kyle Brenneman 5dfdc5a6dc Update GL/gl.h to match Mesa.
Updated GL/gl.h to match the copy from Mesa at commit
a0829cf23b307ca44ab8c4505974fb7c8d71a35a.
2019-10-22 16:48:29 -06:00
Kyle Brenneman a1a73db6b4 Merge branch 'egl-registry-sync' into 'master'
egl: Sync with Khronos

Update egl.h and egl.xml to upstream commit de3a5e867d906a04a5c37ee0d89e7f01d3598eb9.

Closes #193

See merge request glvnd/libglvnd!192
2019-10-18 15:17:32 +00:00
Adam Jackson 51233cc52c egl: Sync with Khronos
commit de3a5e867d906a04a5c37ee0d89e7f01d3598eb9
    Author: Ken Russell <kbrussel@alum.mit.edu>
    Date:   Sat Oct 12 05:44:43 2019 -0700

        Reserve enums 0x34A0..0x34AF for ANGLE project. (#93)

Closes: https://gitlab.freedesktop.org/glvnd/libglvnd/issues/193
2019-10-17 11:53:50 -04:00
Kyle Brenneman 6fc91b93ee Merge branch 'gles-enable-fix' into 'master'
Add a configure option to disable glesv1 or glesv2

See merge request glvnd/libglvnd!191
2019-10-08 16:34:16 +00:00
Laurent Carlier 3a1fb32c3b Add a configure option to disable glesv1 or glesv2
Because mesa can be built without glesv1 so it breaks autodetection.

Fixes: https://bugs.archlinux.org/task/64032 ('mesa-demos doesn't build, unable to find GLES/gl.h')
2019-10-08 16:34:16 +00:00
Kyle Brenneman 879a453d35 Merge branch 'headers-fix-typo' into 'master'
include: install GL headers when GL is enabled

See merge request glvnd/libglvnd!190
2019-09-30 21:35:25 +00:00
Eric Engestrom 6f52473dac include: install GL headers when GL is enabled
A typo made it depend on EGL instead.

Fixes: ab9b5fcc3b ("Install the GL/GLES/GLX/EGL header files.")
2019-09-30 16:08:37 +01:00
Kyle Brenneman 062a42ea55 Bump the version number to 1.2.0. 2019-09-25 09:48:46 -06:00
Kyle Brenneman 8dc483cafe
Merge pull request #185 from kbrenneman/recognize-arm8vl
configure: Recognize the host_cpu value "armv8l"
2019-09-25 09:39:28 -06:00
Kyle Brenneman 8debb10fe9
Merge pull request #189 from kbrenneman/configure-page-size
configure: Allow specifying the page size.

Fixes https://github.com/NVIDIA/libglvnd/issues/132
2019-09-23 09:15:03 -06:00
Kyle Brenneman be09e1e31f
Merge pull request #188 from smcv/document-search-paths
Document EGL vendor ICD search paths
2019-09-20 10:57:42 -06:00
Simon McVittie 58e0fda487 Document EGL vendor ICD search paths
The behaviour of a relative `library_path` is deliberately left
unspecified here. As an implementation detail, it's currently
passed directly to `dlopen()`, so in practice it will be interpreted as
relative to the process's current working directory, but that doesn't
seem practically useful. Vulkan treats relative paths as being relative
to the JSON file in which they were found, which seems more likely to
be a helpful behaviour.

Otherwise this documents the current behaviour, without any of the
possible changes suggested on #187. If any of those changes are made,
then this document should be updated at the same time.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-09-19 18:06:57 +01:00
Kyle Brenneman 8c4b386d5e configure: Allow specifying the page size.
The configure script now checks the environment variable GLDISPATCH_PAGE_SIZE.
If it's set, then it overrides the GLDISPATCH_PAGE_SIZE macro used in
libGLdispatch to align the assembly dispatch stubs.

This is mainly useful on ppc64le and aarch64 builds, where the page size can
vary.
2019-09-17 16:16:17 -06:00
Kyle Brenneman 69b8c323d0 EGL: Use EGL_FALSE instead of False.
Fix InternalMakeCurrentDispatch to use the constant EGL_FALSE instead of the
Xlib-specific False.
2019-09-13 15:31:45 -06:00
Kyle Brenneman c6e6b831d6 configure: Recognize the host_cpu value "armv8l".
If $host_cpu is "armv8l", then that means the 32-bit compatibility mode on an
aarch64 system. Treat that the same as armv7.
2019-09-12 14:11:59 -06:00
Kyle Brenneman f7186d1fb1
Merge pull request #184 from kbrenneman/make-x11-optional
Make x11 optional

Fixes https://github.com/NVIDIA/libglvnd/issues/183
2019-09-12 13:25:06 -06:00
Kyle Brenneman 68066ebc8e tests: Fix building the GLX tests.
Defining a target-specific CFLAGS variable overrides AM_CFLAGS, so add the same
include paths for the GLX tests that we used to add using AM_CFLAGS.

Also remove the -Wno-error flags, since they aren't needed anymore.
2019-09-12 12:19:32 -06: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 a5a74957d8 Make X11 support optional.
Add a new configure option, --disable-x11. That option will disable GLX, and
will #ifdef out the X11 platform detection in EGL, but also remove the
dependency on the X11 libraries and headers.

In addition, only check for the xext and glproto packages if GLX is enabled,
since that's the only component that needs them.
2019-09-12 10:02:37 -06:00
Kyle Brenneman 396433be5b
Merge pull request #179 from kbrenneman/add-pkg-config
Add pkgconfig data
2019-09-04 14:18:41 -06:00
Kyle Brenneman 6b8d76bf4e Add a configure option for whether to install the GL headers.
Add a --disable-headers option, which tells it not to install the
GL/GLES/GLX/EGL header files.
2019-09-04 14:15:00 -06:00
Kyle Brenneman ab9b5fcc3b Install the GL/GLES/GLX/EGL header files.
Since we've got pkg-config files for the various libraries, we should also
install the corresponding header files so that the include directory matches
up.
2019-09-04 14:15:09 -06:00
Kyle Brenneman e5a4edcf17 Add the missing GL and GLES headers.
Add copies of glcorearb.h, and of the GLES2 and GLES3 headers.
2019-09-04 14:15:00 -06:00
Kyle Brenneman 6476491d4d Update the EGL headers.
Updated the EGL headers and XML file to the Khronos repository, from commit
598f20e3b7b7eec3e8d8a83e64b9592a21c55bb6.
2019-09-04 14:15:00 -06:00
Kyle Brenneman e67d3241c3 Update GL and GLX header and XML files.
Updated the OpenGL and GLX header and XML files to the Khronos repository, from
commit 08749e62826f34ba2e6e3733af545895f23e784b.
2019-09-03 09:22:52 -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 c805774da2 tests: Add utils_misc to tests that need it.
src/util/trace.c calls glvnd_vasprintf, which is defined in
src/util/utils_misc.c, so any tests that use trace.c also need to
use utils_misc.c.
2019-07-31 09:54:00 -06:00
Kyle Brenneman 58c8c4a402 Check if dirent.d_type is available in the configure script.
Add a check in the configure script to check if the dirent struct has a d_type
member, since that's not available on all systems.
2019-04-26 11:10:14 -06:00