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.
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
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.
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
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.
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.
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.
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.
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.
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.
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
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')
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>
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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 *).
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.
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.
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.
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.
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.
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
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.
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.
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.
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/
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.
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.
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>
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.
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.
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.
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
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.
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>
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.
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>
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>