Commit graph

853 commits

Author SHA1 Message Date
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
Kyle Brenneman 005fd3a0c4 Set package version to 1.0.0.
Now that both the EGL and GLX interfaces are defined and stable, set the
package version to 1.0.0.
2017-11-02 10:58:38 -06:00
Kyle Brenneman e202ebf27f Merge pull request #137 from polarina/memleak
Fix memory leak in LoadVendorsFromConfigDir and __eglMappingInit
2017-10-09 09:58:31 -06: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
Kyle Brenneman fe4a384094 Merge pull request #135 from aaronp24/remove-misleading-indentation
Update cJSON to version 1.5.9.

Remove -Wno-misleading-indentation, which doesn't work in clang.
2017-09-13 14:15:59 -06: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
Kyle Brenneman 3ed1275746 Merge pull request #131 from michalsrb/fix-missing-gles-symbols
Fix typo in _LIBRARY_FEATURE_NAMES.
2017-08-14 08:35:18 -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 7751d668e5 configure: Remove AC_PROG_CXX.
Libglvnd doesn't use C++ anywhere, so it doesn't need the C++ compiler.
2017-06-13 12:02:11 -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
Kyle Brenneman 80d9a87b50 Merge pull request #122 from evelikov/egl-platform-gbm-support
Add platform GBM support in eglGetDisplay
2017-06-07 15:32:33 -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 962fc1a161 tests: Fill in the ASM code in the template in patch_ppc64le().
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
2017-04-24 11:50:07 -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
Ben Crocker 1c40432132 GLdispatch: Implement the TSD dispatch stubs for PPC64LE.
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
2017-04-24 11:49:49 -06:00
Kyle Brenneman e77d29a67c Makefile and structural changes for ppc64le support.
Added the files and makefile changes needed for adding support for ppc64le
dispatch stubs.

The actual assembly code still needs to be written, along with any other
arch-specific requirements for self-modifying code.

The new entry_ppc64le_*.c files are mostly based on the x86-64 files.

It still needs:
- Assembly code for OpenGL dispatch stubs in entry_ppc64le_tls.c,
  entry_ppc64le_tsd.c, or both.
- Assembly code for GLX dispatch stubs in glvnd_genentry.c.
- Assembly code for the entrypoint patching tests in patchentrypoints.c.
2017-04-24 11:49:02 -06:00
Kyle Brenneman f82f76c242 Merge branch 'armv7-textrel-fix'
Fixes https://github.com/NVIDIA/libglvnd/issues/116
2017-04-14 10:28:32 -06:00
Sai Kiran Korwar ef7a88b490 GLdispatch: Improve the documentation in entry_arm7_tsd.c. 2017-04-14 10:28:20 -06:00
Sai Kiran K 88cf38856f GLdispatch: Fix TEXTREL in the ARMv7 TSD stubs.
Rewrite the ARMv7 TSD dispatch stubs so that they'll go through the GOT and PLT
tables to look up _glapi_Current nd _glapi_get_current.
2017-04-14 10:28:13 -06:00
Kyle Brenneman 4ef975ca83 Update the README file.
Fix a few sections in the README file that are incorrect or out of date.

Expand the dispatching explanation to describe libGLdispatch and libEGL.
2017-04-13 14:14:49 -06:00
Kyle Brenneman 83b17fde1a GLdispatch: Remove the ".syntax divided" directive for ARMv7.
The ".syntax divided" directive causes build errors some compilers.

The error is because the compiler apparently generates unified syntax by
default and expects inline assembly to use unified syntax, and so just
generates a single ".syntax unified" directive at the top.  The ".syntax
divided" directive then causes problems, because the compiler still generates
unified syntax for the rest of the C code in the file.

As far as I can tell, newer versions of gcc will expect inline assembly to use
divided syntax, and they generate the necessary .syntax directives to cope with
switching to unified syntax in inline assembly.
2017-04-10 13:29:56 -06:00
Kyle Brenneman 8e6e102820 Merge branch 'x32-support'
Fixes https://github.com/NVIDIA/libglvnd/issues/115
2017-03-08 13:41:29 -07:00
Kyle Brenneman bb3d4a044c tests: Add support for x32.
Update the entrypoint patching tests to work on an x32 build. On x32, it'll use
the same patching as it would for x86-64.
2017-03-08 13:40:00 -07:00
Kyle Brenneman 7112ec663d GLX: Fix GLX entrypoint generation for x32.
This is a minor tweak to the x86-64 GLX entrypoint generation. On an x32 build,
it'll use the same stubs as for x86-64, but when it patches in the address to
the vendor library's dispatch function it has to expand the address to 64 bits.

The GLX dispatch stubs for x86-64 work by loading the address of the vendor
library's dispatch function as a 64-bit immediate value for a movabs
instruction. It loads the address into the RAX register, which is safe to
overwrite in either ABI, so the same code works for both.
2017-03-08 13:39:56 -07:00
Kyle Brenneman fa35a8383e Shorten the generated x86-64 TLS stubs.
Change the generated dispatch stubs for x86-64 TLS to match what Mesa
generates. The new stubs are shorter but functionally equivalent.
2017-03-08 13:39:21 -07:00
Kyle Brenneman 3d0ee810f1 GLdispatch: Add support for x32.
Implement TLS dispatch stubs for x32. The new x32 stubs are based on Mesa's
implementation, from Mesa commit 89458366585c34879b70110758bb4fd3acb62ce0.
2017-03-08 13:39:07 -07:00
Kyle Brenneman 4e637b074f GLdispatch: Minor cleanup of the x86-64 TLS stubs. 2017-03-08 13:37:40 -07:00
Kyle Brenneman 8b7a44fb6d tests: Expand the unit tests for libGLdispatch.
Replaced testpatchentrypoints_gldispatch with three new unit tests.

testgldispatch_static and testgldispatch_generated test dispatching to multiple
vendor libraries through static and generated dispatch stubs, respectively.

testgldispatch_generated tests entrypoint patching and unpatching. This adds
coverage for patching generated stubs in addition to the static ones.

The entrypoint patching functions in tests/dummy/patchentrypoints.c now take
the name of the function to patch, instead of hard-coding it to only patch
glVertex3fv.
2017-02-28 16:37:36 -07:00
Kyle Brenneman 4ba5345742 Merge pull request #113 from nwnk/armv7hl
Fixes for armv7.

Fix build failures for the ARMv7 stubs that show up on some compiler versions.
2017-02-09 10:46:23 -07:00
Kyle Brenneman dc16f8c337 Merge pull request #112 from kbrenneman/configure-component-flags
Add configure flags for EGL, GLX, and GLES
2016-12-22 13:05:51 -07:00