Commit graph

537 commits

Author SHA1 Message Date
Eric Engestrom 0ba59394e4 egl: use dedent() and consistent indentation in source code 2019-12-12 23:04:34 +00:00
Eric Engestrom 02f82033f1 egl: drop superfluous () in conditions 2019-12-12 23:04:34 +00:00
Eric Engestrom 8dd5f93faf egl: avoid comparing with the value of None 2019-12-12 23:04:34 +00:00
Eric Engestrom 679f40aa6e egl: #include <stddef.h> for NULL 2019-12-12 22:56:42 +00:00
Eric Engestrom c60b40ef6c meson: fix double-space in pkg-config description 2019-12-12 17:16:12 +00:00
q66 c31a7c06eb vnd-glapi: allow asm to be used on ELFv2 ppc64 big endian
These entry points are actually not little endian specific,
but they are specific to ELFv2 ABI. ELFv2 ABI can be used
on either little or big endian, and there are distributions
doing so (e.g. Void Linux, Adélie Linux) as well as other
OSes transitioning (FreeBSD).

These have been confirmed to work on a Power Mac G5 running
Void Linux.
2019-12-09 18:49:41 +01:00
Kyle Brenneman 5ffb8df0ae meson: Fix the PPC64 build.
Check for a cpu_family value of 'ppc64', not 'ppc'. 'ppc' is for 32-bit power.

In GLdispatch, fix the file list for the PPC64 entrypoints.
2019-12-06 07:29:11 -07:00
Kyle Brenneman 9ccdb05cdd meson: Fix the armv7 build.
Fix the GLdispatch meson file so that it checks for the value "armv7_tsd" for
gl_dispatch_type instead of "arm_tsd".
2019-12-06 07:29:11 -07:00
Dylan Baker b308a876d3 autotools: Include meson.build and meson_options.txt in dist 2019-12-05 12:01:36 -08:00
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
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
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 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
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 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 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 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
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
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
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
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 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 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 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 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
Kyle Brenneman 0e0060fba5 Use glvnd_vasprintf instead of vasprintf in trace.c.
vasprintf isn't available on all systems, so use the local implementation
instead.
2019-04-26 11:02:30 -06:00
Sai Kiran Korwar 9948df6367 AARCH64 : Fix address passed to clear cache
The entrypointExec address is modified before being passed to
clear_cache function. We do a small add/subtract for ARMv7 in
order to enable Thumb mode. This is not required for Aarch64 as
it does not support Thumb mode. Since we were not adding anything,
do not subtract as well before passing the address to clear_cache.

This was causing a crash while calling glXGetProcAddress.
2019-02-13 10:52:01 +05:30
Kyle Brenneman c501991842 GLdispatch: Don't save r12 in the PPC64LE TSD stubs.
We don't need to save and restore r12 across the call to _glapi_get_current.
It's only used for function linkage, and the dispatch stub overwrites the value
a few instructions later anyway.
2018-11-01 11:41:35 -07:00
Kyle Brenneman 884c5075d8 GLdispatch: Fix the PPC stubs for slots >= 4096.
We can't use a simple ld instruction for a slot greater than or equal to 4096,
because the offset no longer fits in the signed 16-bit offset field.

Instead, use an addis instruction to deal with the high-order bits in the
offset.
2018-11-01 10:07:37 -07:00
Kyle Brenneman d153b06d05 GLdispatch: Fix the TOC save in the PPC64LE TSD stubs
Call _glapi_get_current through the PLT call stub. The PLT call stub takes care
of saving the TOC pointer.

Also rearranged the assembly code to remove the need for a backwards jump after
calling _glapi_get_current.
2018-11-01 10:04:31 -07:00
Kyle Brenneman ff9246a97f GLdispatch: Keep the mutex when calling the vendor's threadAttach callback
In __glDispatchCheckMultithreaded, don't unlock the mutex until after calling
stubCurrentPatchCb->threadAttach.

Without that lock, another thread could come along and change
stubCurrentPatchCb out from under it.
2018-09-19 15:23:49 -06:00
Kyle Brenneman 55fad54ac7 Make Python optional when building from the make dist tarball.
When you run "make dist", the resulting tarball includes all of the generated
files. When building from that, we don't need to generate anything.
2018-08-17 07:17:56 -06:00
Kyle Brenneman 56450264b8 EGL: Fix typo in the makefile.
The $(VM_V_GEN) variable should be $(AM_V_GEN).
2018-08-17 07:17:53 -06:00
Mathieu Bridon 90f973f74d build: Find Python the Autotools way
An added advantage to this is that it makes it really easy to build with
Python 3, the same way other Autotools projects support it:

    $ export PYTHON=/usr/bin/python3
    $ ./configure
2018-08-16 13:57:27 +02:00
Kyle Brenneman 9d909106f2 Update the OpenGL XML and header files.
Update the gl.xml, GL/glext.h, and the GLES headers to commit
42f61786696df5102625d9b046976ee857645704 from the Khronos registry.
2018-06-20 15:57:00 -06:00
Kyle Brenneman 638ef33fc7 EGL: Remove a few unused functions in egldispatchstubs.c.
Remove FindProcIndex, __eglSetDispatchIndex, and
__eglDispatchFindDispatchFunction from egldispatchstubs.c.

The dispatch indices are allocated and assigned during initialization, so none
of those functions are ever called.
2018-06-06 08:42:41 -06: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 652909fbff Some fixes for "make dist"
Don't point nonst_HEADERS or EXTRA_DIST at entire directories. That causes
"make dist" to include files that it shouldn't, such as configured makefiles
and .pyc files.

Also added a few generated header files to noinst_HEADERS.
2018-04-13 16:15:37 -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 dfaf0fd2b9 Add a (void*) cast for the last parameter when calling mincore.
The third parameter to mincore(2) can be a pointer to char or unsigned char,
depending on what system it's building on. To build in either case, just cast
that argument to a (void *).
2018-03-26 14:41:07 -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 f47132e649 GL: Expand glapi_gen_libglglxstubs in the makefile.
glapi_gen_libglglxstubs is only used once, so just expand it out instead of
using a function.
2018-03-26 14:40:59 -06:00
Kyle Brenneman adf997feb8 Move the glapi_gen_libglglxstubs function into the GL makefile.
Remove the now-empty file glvnd_gen.mk.
2018-03-26 14:40:57 -06:00
Kyle Brenneman f2b886ddea vnd-glapi: Change glapi_gen_mapi to a makefile variable.
Change glapi_gen_mapi to be a makefile variable instead of a function, so that
it still works when not using GNU make.
2018-03-26 14:40:55 -06:00
Kyle Brenneman 342cb23f22 Move the glapi_gen_mapi function into the vnd-glapi makefile.
$(glapi_gen_mapi) is only used in the vnd-glapi makefile, so define it there.
2018-03-26 14:40:52 -06:00
Kyle Brenneman 1578be92f2 generate: Remove glapi_gen_libopengl_exports.
Generating a symbol list for the entrypoint libraries used to be necessary when
we generated the same set of dispatch stubs in each library.

Since then, we only generate the stubs that each library is going to export, so
we don't need a separate export list anymore.
2018-03-26 14:40:50 -06:00
Kyle Brenneman 1e8ea3fe10 GL: Don't generate g_glapi_mapi_gl_tmp.h
Don't generate g_glapi_mapi_gl_tmp.h in the libGL makefile. That's not needed
anymore, because all of the GLDispatch stuff is built separately under
src/GLdispatch/vnd-glapi.

Likewise, remove the STATIC_DISPATCH_ONLY define from the compiler flags.
2018-03-26 14:40:48 -06:00
Kyle Brenneman f6d236e8dc
Merge pull request #150 from aaronp24/work-around-xorgproto-api-break
GLX: Work around 'X_GLXCreateContextAtrribsARB' typo fix API break
2018-03-08 09:40:32 -07:00
Christopher James Halse Rogers 45d92a4b6d
Handle dlsym succeeding with info.dli_sname == NULL.
When dlsym is handed an address in a shared object that doesn't match a symbol
in that shared object (such as a C++ vtable) it returns success but sets
dli_sname to null.

Handle this case rather than crashing.
2018-03-05 10:15:02 +01:00
Kyle Brenneman 28e05b9349 Always return an error from eglMakeCurrent if the EGLDispaly is invalid
In eglMakeCurrent, check to make sure the EGLDisplay is valid, even if the
context is NULL.

Fixes https://github.com/NVIDIA/libglvnd/issues/151
2018-02-22 11:33:43 -07:00
Aaron Plattner 627cc6634c GLX: Work around 'X_GLXCreateContextAtrribsARB' typo fix API break
Older versions of glxproto.h contained a typo where "Attribs" was misspelled.
The typo was fixed in the xorgproto version of glxproto.h, breaking the API.

Fixes #149.
2018-02-12 09:45:39 -08:00
Kyle Brenneman 1b74e819e1 Bump the version numbers in the library filenames.
If libglvnd is installed onto a system that already has non-libglvnd versions
of any of the OpenGL libraries installed, then ldconfig can get confused about
which files to create symlinks to. At worst, you could end up with a mix of the
libglvnd libraries and leftover non-libglvnd libraries.

To avoid that, bump the version numbers in these filenames:
- libGL.so.1.0.0 -> libGL.so.1.7.0
- libGLESv1_CM.so.1.0.0 -> libGLESv1_CM.so.1.2.0
- libGLESv2.so.2.0.0 -> libGLESv2.so.2.1.0
- libEGL.so.1.0.0 -> libEGL.so.1.1.0

Fixes https://github.com/NVIDIA/libglvnd/issues/147
2018-01-30 11:04:18 -07:00
Kyle Brenneman 398e80757f
Merge pull request #143 from kbrenneman/gldispatch-fix-execmem
Fix executable memory allocation ifdefs and size
2018-01-17 09:34:53 -07:00
Kyle Brenneman fa8cea5bce GLdispatch: Fix the allocation size for the dynamic stubs.
In u_execmem.c, use entry_stub_size and MAPI_TABLE_NUM_DYNAMIC to determine how
much executable memory to allocate, instead of just hard-coding 256KB.

The stubs on some architectures are larger than 64 bytes, so 256KB isn't always
going to be large enough, and it's wasteful on architectures with stubs that
are smaller than 64 bytes.
2018-01-16 11:34:41 -07:00
Kyle Brenneman 294ccb2f49 GLdispatch: Remove obsolete #ifdefs from u_execmem.c.
Remove the #ifdefs and the Win32 and malloc-based code from u_execmem.c. It's
not needed or used anymore, and even if it was, the allocation code is in
src/utils/utils_misc.c now.
2018-01-16 11:26:50 -07:00
Kyle Brenneman 60331f22d2 Add support for GLX_EXT_no_config_context.
Added a dispatch handler for glXCreateContextAttribsARB. It'll look for a
GLX_SCREEN attribute first if the caller provides one, and then the GLXFBConfig
handle if the caller doesn't.
2017-12-06 12:43:39 -07:00
Gabríel Arthúr Pétursson e3ab0a24cf Cleanup winsys dispatch index list on EGL mapping teardown
This fixes a memory leak reported by both Valgrind and LeakSanitizer
when libEGL is dlopen()-ed and dlclose()-ed afterwards.
2017-10-07 01:15:20 +00:00
Gabríel Arthúr Pétursson c2f81ca7ce Fix memory leak in LoadVendorsFromConfigDir
The individual entries allocated by scandir need to be freed too.
2017-10-06 22:39:20 +00:00
Aaron Plattner 6198bd6ef6 Update cJSON to version 1.5.9
Downloaded from https://github.com/DaveGamble/cJSON/releases/tag/v1.5.9
2017-09-13 12:56:57 -07:00
Aaron Plattner 75d2385205 Remove the cJSON README and tests
These aren't used by the build system, so there's no reason to include them in
the repository.

Leave the LICENSE file, to indicate the license as it appeared in the snapshot
from https://github.com/DaveGamble/cJSON/
2017-09-13 12:54:17 -07:00
Aaron Plattner cf6bcb36ab Remove -Wno-misleading-indentation
This option is not recognized by clang, so it produces an error when configured
with

  CC=clang ./configure

  error: unknown warning option '-Wno-misleading-indentation'; did you mean '-Wno-missing-declarations'? [-Werror,-Wunknown-warning-option]

This flag is only needed for cJSON.c. Deobfuscate that file just enough to
eliminate the misleading indentation warnings, then remove the warning flag from
Makefile.am.
2017-09-13 12:35:55 -07:00
Aaron Plattner b0f7755142 Don't #define USE_ASM (defined(USE_X86_ASM) || ... )
This produces a warning when built with clang:

 ../../home/aaron/git/libglvnd/src/util/glvnd_genentry.c:46:26: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
 #if defined(__GNUC__) && USE_ASM
                          ^
 ../../home/aaron/git/libglvnd/src/util/glvnd_genentry.c:40:18: note: expanded from macro 'USE_ASM'
 #define USE_ASM (defined(USE_X86_ASM) ||    \

Instead, use the defined(...) conditions to conditionally define USE_ASM to 1 or
0 explicitly.
2017-09-13 12:24:25 -07:00
Kyle Brenneman 5ff90a1568 Merge pull request #125 from kbrenneman/ppc64le-convert-lq-stq
Convert lq/stq instructions
2017-08-30 09:45:18 -06:00
Ben Crocker 345b4c54b5 Convert lq/stq instructions
The Power8 spec allows for implementations to implement the 128-bit
lq/stq instructions in ways that perform much slower than the
equivalent pairs of ld/std instructions; So, convert lq/stq
to their equivalent ld/std pairs.

From section 3.3.4 in the PowerISA v.30B spec:

The lq and stq instructions exist primarily to permit software to access
quadwords in storage "atomically"; see Section 1.4 of Book II. Because GPRs
are 64 bits long, the Fixed-Point Facility on many designs is optimized for
storage accesses of at most eight bytes. On such designs, the quadword
atomicity required for lq and stq makes these instructions complex to
implement, with the result that the instructions may perform less well on these
designs than the corresponding two Load Doubleword or Store Doubleword
instructions.

Signed-off-by: Ben Crocker <bcrocker@redhat.com>
2017-08-30 09:42:40 -06:00
Kyle Brenneman 8d4d03f77d Merge branch 'fix-aarch64-page-size'
Change the dispatch stubs on aarch64 to be aligned to a 64K boundary, since
some aarch64 systems use a 64K page size.
2017-08-18 12:58:33 -06:00
Michal Srb 37fc6caa4b Fix typo in _LIBRARY_FEATURE_NAMES.
The missing comma caused the "GL_ES_VERSION_3_1" and "GL_ES_VERSION_3_2" to
concatenate into non-existing feature name. Symbols from gles 3.1 and 3.2 were
then missing in the generated files.
2017-08-14 15:28:41 +02:00
Kyle Brenneman cfce0c8704 GLdispatch aarch64: Align the dispatch stubs to a 64K page size.
On aarch64, the page size can be as large as 64K, so align the dispatch stubs
to a 64K boundary instead of 4K.
2017-08-04 11:16:39 -06:00
Kyle Brenneman aca30d2c06 GLdispatch: Clean up the assembly dispatch code.
Made the names for macros and common variables more consistent.

Added a GLDISPATCH_PAGE_SIZE macro to specify the page size that it uses to
align the dispatch stubs. This value can be overridden at configure time, so a
later change could allow the configure script to figure out the page size on
architectures where it could vary.

This is all formatting changes, so there should be no functional difference.
2017-08-04 11:16:32 -06:00
Kyle Brenneman a14972089e EGL: Fix handling a malloc failure in eglQueryString.
In GetClientExtensionString, if it runs into a malloc failure, then return NULL
instead of trying to dereference the result.
2017-07-25 08:50:10 -06:00
Kyle Brenneman 75c77c4f9e GLX: Fix an error in handling GLX dispatch stubs.
In __glXGetGLXDispatchAddress, add a missing call to
__GLXapiImports::getProcAddress.
2017-07-25 08:46:47 -06: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 71226b013c EGL: Allow vendor libraries to identify platforms for eglGetDisplay. (#124)
EGL: Allow vendor libraries to identify platforms for eglGetDisplay.

Add a new optional function __EGLapiImports::findNativeDisplayPlatform. Vendor
libraries can provide that function to identify the platform for the native
display passed to eglGetDisplay.

Reviewed-by: Emil Velikov emil.velikov@collabora.com
2017-06-20 12:50:40 -06:00
Kyle Brenneman 8b4f6aeb7a PPC64LE: Fix the cache clear instructions.
Change the cache clear instructions for generated PPC64LE code so that it uses
an input variable instead of an output variable.

With an output variable, it doesn't use the correct address for the dcbst and
icbi instructions, possibly causing it to crash.
2017-06-13 11:53:51 -06:00
Emil Velikov 94691a3ee2 EGL: honour eglGetPlatformDisplay's attrib_list
Currently we simply drop them on the floor.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-06-07 17:43:56 +01:00
Emil Velikov f6c14fabfa EGL: alias "drm" to gbm when using EGL_PLATFORM
Since the inseption of EGL/GBM the unofficial way to force
the platform was via EGL_PLATFORM="drm".

Strictly speaking one could remove the gbm one, but it should have no
side effects. Plus it's more consistent with other platforms.

In either case, one should not be using eglGetDisplay but the Platform
version of the API.

Signed-off-by: Emil Velikov <emil.velikov@gmail.com>
2017-06-07 17:43:56 +01:00
Emil Velikov a6120e6ec5 EGL: add platform gbm detection in eglGetDisplay
Without it any applications that depend on the platform will fail to
run.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-06-07 17:43:56 +01:00
Emil Velikov b559273fbd EGL: detect platform gbm vendor capability
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-06-07 17:43:56 +01:00
Kyle Brenneman 6bcecd8f33 Merge pull request #120 from kbrenneman/ppc64le-support-v3
Add support for PPC64LE
2017-04-27 12:13:35 -06:00
Kyle Brenneman cd502b4c1a GLdispatch: Rename entry_x86_64_common.c to entry_simple_asm.c.
Rename the file entry_x86_64_common.c to entry_simple_asm.c, since it's used
for more than just x86 systems.

In addition, it's now used for aarch64 as well.
2017-04-26 15:48:47 -06:00
Ben Crocker f5f6cd79ef GLX: Add cache-flushing sequence to the generated GLX stubs.
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
2017-04-26 09:11:33 -06:00
Ben Crocker 7caaabcd9c GLX: Implement GLX dispatch stubs for PPC64LE.
Fill in PPC64LE STUB_TEMPLATE, changing type from unsigned char[] to
uint32_t[]. Set DISPATCH_FUNC_OFFSET accordingly for PPC64LE.

Signed-off-by: Ben Crocker <bcrocker@redhat.com>
2017-04-24 11:49:58 -06:00
Ben Crocker 290594c3e7 GLdispatch: Implement the TLS dispatch stubs for PPC64LE.
Fill in STUB_ASM_CODE macro and ENTRY_TEMPLATE[] array, changing type of the
latter to uint32_t[].

Define TEMPLATE_OFFSET_TLS_ADDR and TEMPLATE_OFFSET_SLOT relative to end of
ENTRY_TEMPLATE[] array.

Signed-off-by: Ben Crocker <bcrocker@redhat.com>
2017-04-24 11:49:52 -06:00