Commit graph

683 commits

Author SHA1 Message Date
Dylan Baker 16dc32352d Add meson build system
Theres a couple of things that this meson build system does differently
than autotools. It doesn't use a config.h file, it just puts #defines on
the command line with -D. It also does all of the code generation in the
generated folder, simply because it's simpler to do that.

On my 2 core / 4 thread KBL system:

autotools (no ccache):
sh -c "./autogen.sh&& ./configure && make -j6 check"  44.74s user 6.70s system 145% cpu 35.269 total

autotools (warm ccache):
sh -c "./autogen.sh&& ./configure && make -j6 check"  32.86s user 4.22s system 129% cpu 28.580 total

meson (no ccache):
sh -c "meson build; ninja -C build test"  23.48s user 3.71s system 236% cpu 11.487 total

meson (warm ccache)
sh -c "meson build; ninja -C build test"  16.06s user 2.31s system 210% cpu 8.727 total
2019-12-05 12:01:36 -08:00
Dylan Baker 24fddd6eaa tests/dummy/glx: Remove config.h
autotools force includes this with `-include config.h`, so it's
unnecessary to make compilation work. Meson doesn't generate a config.h
so this will break meson compilation.
2019-12-05 11:50:56 -08:00
Kyle Brenneman a9060bb67d tests: Add tests for the end of the dispatch table.
Add a '-l' flag to testgldispatch, which tells it to test a generated stub
at the very end of the dispatch table.

On PPC, looking up a function past index 4096 requires more than just a simple
register+immediate load, so this makes sure that it's correct.
2019-12-05 11:50:56 -08:00
Kyle Brenneman fbcce35d97 Merge branch 'cleanup-assembly' into 'master'
Remove runtime assembly generation

See merge request glvnd/libglvnd!202
2019-12-05 18:13:17 +00:00
Kyle Brenneman db89fc7462 Merge branch 'meson-test-fixes' into 'master'
Test changes from the meson MR

See merge request glvnd/libglvnd!206
2019-12-04 18:52:39 +00: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
Eric Engestrom 12caca778a Merge branch 'editorconfig' into 'master'
Add .editorconfig file

See merge request glvnd/libglvnd!205
2019-12-04 17:33:53 +00:00
Dylan Baker ad2c870ad8 tests: Add -t to testgldispatch patched thr test
Since right now it tests the same thing as the patch test
2019-12-04 08:53:00 -08:00
Dylan Baker 000a0f2b71 Add .editorconfig file
Many project in the freedesktop graphics space use editorconfig files as
a way to standardize style in an editor agnostic way. This one
configures all of the files current in libglvnd (I looked at the .c and
.h files and they seem to all use 4 spaces for indent). Because it
seemed everything used 4 spaces I just set that to the default and
overrode as necessary.
2019-12-04 08:51:22 -08:00
Kyle Brenneman 7b9e9ad684 Merge branch 'egl-fix-ext-export' into 'master'
EGL: Fix two exported extension functions

Closes #196

See merge request glvnd/libglvnd!204
2019-12-04 15:10:29 +00:00
Kyle Brenneman fc32d56862 EGL: Fix two exported extension functions
Fix a bug in gen_egl_dispatch.py which caused libEGL.so to export two extension
functions, eglCreatePlatformWindowSurfaceEXT and
eglCreatePlatformPixmapSurfaceEXT.

Fixes https://gitlab.freedesktop.org/glvnd/libglvnd/issues/196
2019-12-04 08:06:08 -07:00
Eric Engestrom eade458a67 Merge branch 'gitlab-ci-fixes' into 'master'
gitlab-ci: Update the wayland-template version

See merge request glvnd/libglvnd!207
2019-12-04 00:09:20 +00:00
Dylan Baker 3aec7f0903 gitlab-ci: Update the wayland-template version
This resolves issues with creating a docker image.
2019-12-03 15:51:34 -08:00
Aaron Plattner 2d5d9d6c3a Merge branch 'tests-fix-missing-libs' into 'master'
tests: Fix some missing libraries

See merge request glvnd/libglvnd!201
2019-12-03 21:39:43 +00:00
Kyle Brenneman e9b5e559a1 Merge branch 'egl-no-x11-macro' into 'master'
EGL: Set EGL_NO_X11 macro if --disable-x11 is used.

See merge request glvnd/libglvnd!193
2019-11-22 23:56:40 +00:00
Kyle Brenneman 9ba775ea21 configure: Define EGL_NO_X11 unconditionally.
Change the configure script to define the EGL_NO_X11 macro unconditionally, so
that the EGL headers don't try to include the Xlib headers.

Regardless of whether --disable-x11 is used, libglvnd doesn't need X11-specific
typedefs for EGLNativeDisplayType et. al.
2019-11-22 16:39:46 -07: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 aeb905d8a7 util: Remove the executable allocation functions.
Remove all of the functions related to allocating executable memory, since
they're no longer needed.
2019-11-22 15:58:11 -07:00
Kyle Brenneman 77c4c27e0b tests: Fix some missing libraries.
Fixed some missing static libraries for the EGL dummy vendor library.

Added Xlib to the GLX dummy library.

Added the --no-undefined flag for both of the dummy vendor libraries.
2019-11-22 15:03:30 -07:00
Kyle Brenneman 005d2568ee Merge branch 'fasm2' into 'master'
GLdispatch: Improve the x86 tsd stubs performance.

See merge request glvnd/libglvnd!197
2019-11-22 21:49:07 +00:00
Kyle Brenneman 79b1b8933d Merge branch 'tls' into 'master'
GLdispatch: Improve the x86 TLS stubs performance.

See merge request glvnd/libglvnd!196
2019-11-22 21:48:56 +00:00
Kyle Brenneman 02b8b9332b Merge branch 'github/fork/kbrenneman/compile-time-stubs-gldispatch-v2' into 'master'
GLdispatch: Define all dispatch stubs at compile time (v2)

See merge request glvnd/libglvnd!145
2019-11-22 20:40:27 +00:00
Kyle Brenneman 67aa9ac505 Merge branch 'github/fork/kbrenneman/compile-time-stubs-glx-v2' into 'master'
GLX: Define the GLX dispatch stubs at compile time (v2)

See merge request glvnd/libglvnd!146
2019-11-22 20:39:13 +00:00
Kyle Brenneman 6811a4bcc9 GLX: Add labels to the GLX entrypoint stubs. 2019-11-22 13:16:48 -07: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 0c08a09276 GLdispatch: Use all 4096 dynamic dispatch stubs.
In stub_add_dynamic, use all 4096 dynamic dispatch stubs. There's no longer any
need to leave the last one empty.
2019-11-22 10:18:55 -07:00
Kyle Brenneman 13df532963 GLdispatch: Change entry_generate_default_code to take an index.
For better consistency with the rest of GLdispatch, entry_generate_default_code
now takes the index of the stub instead of a function pointer.
2019-11-22 10:18:55 -07:00
Kyle Brenneman 44ea7c355b GLdispatch: Change entry_get_patch_address to return a single address.
entry_get_patch_address now returns a single address, since it doesn't have
separate writable and executable mappings anymore.
2019-11-22 10:18:55 -07:00
Kyle Brenneman 5222e64d82 GLdispatch: Move entry_get_patch_addresses into entry_common.c.
Move the function entry_get_patch_addresses into entry_common.c for all
architectures.

Now that it takes an index instead of a pointer, ther's no longer a difference
between ARMv7 and everything else.
2019-11-22 10:18:55 -07:00
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