Commit Graph

853 Commits

Author SHA1 Message Date
Félix Baylac Jacqué f4dff011f7 glx: introduce NIX_GLVND_GLX_PATH env variable
If NIX_GLVND_GLX_PATH is set, libglvnd will try to load the glx DSOs
from the directory it points at instead of loading them from LD_LIBRARY_PATH.
2022-11-15 16:27:16 +01:00
Kyle Brenneman 58d49d7f1d Merge branch 'fix-glx-x32-assembly' into 'master'
GLX: Fix assembly stubs for x32

Closes #225

See merge request glvnd/libglvnd!272
2022-10-06 15:09:48 +00:00
Kyle Brenneman 6c5497e527 GLX: Fix assembly stubs for x32
Add x32 assembly stubs for GLX functions.

Fixes https://gitlab.freedesktop.org/glvnd/libglvnd/-/issues/225
2022-10-05 14:34:44 -06:00
Kyle Brenneman 9215f347d2 Merge branch 'master' into 'master'
Add support for loongarch64.

See merge request glvnd/libglvnd!271
2022-09-20 14:05:14 +00:00
yes,i Do 05f75de586 Add support for loongarch64. 2022-09-20 14:05:14 +00:00
Kyle Brenneman 1d270ce502 Merge branch 'update-opengl-headers' into 'master'
Update OpenGL headers

See merge request glvnd/libglvnd!268
2022-08-30 14:16:22 +00:00
Kyle Brenneman fd1df5e989 Update GL headers and XML files.
Update the GL headers and XML files to the Khronos repository, from
commit 11d7b7baebfc2b58116670cd17266f9c6a0d760b.
2022-08-23 07:30:18 -06:00
Kyle Brenneman c7cdf0cc43 Increment the version number to 1.5.0.
Increment the minor version, since we added some features that other
things might depend on.
2022-08-22 07:02:53 -06:00
Kyle Brenneman 5e289fbcec Merge branch 'meson-modernize' into 'master'
meson: use meson.override_dependency when possible

See merge request glvnd/libglvnd!269
2022-07-06 22:31:18 +00:00
Dylan Baker a1a4123c7e meson: rename idep_glx -> dep_glx
Since we use idep as a convention to mean "internal dep"
2022-07-06 14:15:28 -07:00
Dylan Baker 8ee0213413 meson: use meson.override_dependency when possible
Which allows libglvnd to be consumed as a meson subproject.
2022-07-06 14:15:28 -07:00
Dylan Baker ca2eeb5a3b meson: remove dep_glx
It's just an array holding two external dependencies, and we usually use
dep_* to mean "here's a dependency object that subprojects can use".
2022-07-06 14:15:28 -07:00
Kyle Brenneman 3144f287d1 Read gl.symbols when generating stubs for libGL.so.
Instead of generating symbols for everything in gl.xml, read the symbol
list from src/GL/gl.symbols and only generate the functions listed
there.

That way, when new functions get added to gl.xml, we won't add any more
symbols in libGL.so.

To do that, if the target parameter to gen_gldispatch_mapi.py is a
filename, then it will read that file for symbols instead of calling
genCommon.getExportNamesFromRoots.

Also added a new genCommon.readSymbolsFile function, which is mostly
copied from symbols-check.py.
2022-06-07 07:57:02 -06:00
Kyle Brenneman 8e5f0f1646 Merge branch 'tests-egl-thread-cleanup' into 'master'
Add a unit test for cleaning up EGL's thread state

See merge request glvnd/libglvnd!266
2022-06-07 12:57:06 +00:00
Kyle Brenneman 7b892b72e0 Merge branch 'fix-gldispatch-thread-state-leak' into 'master'
Fix a memory leak in libGLdispatch

Closes #230

See merge request glvnd/libglvnd!265
2022-06-07 12:54:32 +00:00
Kyle Brenneman e99a11518c Merge branch 'armv7-use-arm-stubs' into 'master'
Use ARM mode for dispatch stubs on ARMv6 and ARMv7

See merge request glvnd/libglvnd!267
2022-06-02 19:58:27 +00:00
Kyle Brenneman b90f235998 meson: Use assembly stubs on ARMv6.
Change the ARM version macro check in the meson file so that it'll look
for __ARM_ARCH_6__ or an __ARM_ARCH value >= 6.
2022-06-01 07:15:35 -06:00
Kyle Brenneman d853cf56f8 GLdispatch: Build ARMv7 stubs as ARM instead of Thumb
Change the ARMv7 dispatch stubs to use ARM instead of Thumb. There's no
difference in size (since either one fits in the 128-byte alignment that
we use), but using ARM means that they'll compile and work on an ARMv6
build as well.
2022-06-01 07:15:35 -06:00
Kyle Brenneman 28da9963e5 tests: Add support for __GLDISPATCH_STUB_ARMV7_ARM.
Add support for patching ARMv7 stubs as ARM code. Currently, we only
support generating Thumb code.
2022-06-01 07:15:35 -06:00
Kyle Brenneman 70e6a300b2 Fix a memory leak in libGLdispatch
In __glDispatchMakeCurrent, it allocates a
__GLdispatchThreadStatePrivate struct, which would normally get freed in
__glDispatchLoseCurrent.

However, if the library gets unloaded while another thread still has a
current context, then __glDispatchLoseCurrent never gets called, and so
that memory leaks.

Add the __GLdispatchThreadStatePrivate to a linked list so that it can
free any remaining structs in __glDispatchFini.

Fixes https://gitlab.freedesktop.org/glvnd/libglvnd/-/issues/230.
2022-05-17 13:37:06 -06:00
Kyle Brenneman c1fde19814 Add a unit test for cleaning up EGL thread state.
Added a new test program, eglcurrentcleanup, which tests thread and
process termination while a thread still has a current context.
2022-05-17 13:00:01 -06:00
Kyle Brenneman 00a65e7f06 tests: Clean up any remaining contexts in EGL_dummy.
During teardown, free any remaining DummyEGLContext structs.
2022-04-08 11:23:33 -06:00
Kyle Brenneman 47063a7fb7 tests: Fix thread state cleanup in EGL_dummy.
When freeing a DummyThreadState struct, remove it from the linked list
first.
2022-04-08 11:23:33 -06:00
Kyle Brenneman 5024e5796e Merge branch 'thread-state-to-null-in-teardown' into 'master'
Set current thread state to NULL in teardown

See merge request glvnd/libglvnd!264
2022-03-21 20:27:20 +00:00
Aidan Foster 9f59259dc6 Moving setspecific to before DestroyThreadState 2022-03-15 17:53:15 +00:00
Aidan Foster 1f2bfbb6f0 Update src/EGL/libeglcurrent.c 2022-03-14 20:38:20 +00:00
Aidan Foster 4834bd26e7 Set current thread state to NULL in teardown
In the EGL destructor, DestroyThreadState gets called by
__eglCurrentTeardown to free the threadState, but the threadState does
not get changed to NULL when this happens.

The function eglReleaseThread calls __eglDestroyCurrentThreadAPIState,
which does set the threadState to NULL, right before calling
DestroyThreadState. Both eglReleaseThread and
__eglDestroyCurrentThreadAPIState check to make sure the threadState is
NULL before continuing.

If eglReleaseThread gets externally called after destruction, the
threadState is not NULL, so DestroyThreadState will be called to free
the threadState that was already freed by the destructor, causing a
double free.

This change is to add the same setting threadState to NULL in
__eglCurrentTeardown as which already __eglDestroyCurrentThreadAPIState,
to prevent this double free situation.
2022-03-14 18:51:37 +00:00
Kyle Brenneman c8ee0055df Merge branch 'master' into 'master'
Add BTI landing pads for aarch64

See merge request glvnd/libglvnd!262
2022-02-24 15:48:56 +00:00
Guillaume Gardet 7107f73939 Add BTI landing pads for aarch64
When Branch Target Identifier (BTI) is enabled on aarch64,
any software which run libglvnd will fail with SIGILL, Illegal instruction.
This is because some assembler code misses the BTI landing pads.
See: https://developer.arm.com/documentation/102433/0100/Jump-oriented-programming

"hint #34" is the same thing as "BTI C" landing pad, but keep
compatibility with systems without BTI enabled.
2022-02-24 16:21:52 +01:00
Kyle Brenneman b2f8babece Merge branch 'update-egl' into 'master'
Update the EGL headers

See merge request glvnd/libglvnd!263
2022-02-07 15:50:45 +00:00
Alex Richardson 7fa33fac51 Update the EGL headers
Updated the EGL headers and XML file to the Khronos repository, from commit
0997d5398d9de08ac012e7230d6546eb342c2939.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2022-02-06 17:53:55 +00:00
Kyle Brenneman 8f3c5b17a2 Increment version number to 1.4.0.
Increment the minor version this time, since we've extended the EGL
vendor library interface.
2021-12-17 08:49:38 -07:00
Kyle Brenneman 862dec3d30 Merge branch 'add-eglQueryDisplayAttribKHR' into 'master'
EGL: Add support for eglQueryDisplayAttribKHR and NV.

See merge request glvnd/libglvnd!259
2021-12-17 15:42:20 +00:00
Kyle Brenneman b56a13f372 Merge branch 'submit/fix-get-option-x11' into 'master'
meson: use required : feature option correclty

See merge request glvnd/libglvnd!261
2021-12-07 23:34:39 +00:00
Dylan Baker 9d09a1a238 meson: use required : feature option correclty
The code here is a complicated way to write exactly the same thing. If
`get_option('x11')` returns `disabled`, ie `-Dx11=disabled` then
`dependency()` short circuits and returns a not found object (just like
`dependency('', required : false)`, but with the correct name for error
messages).
2021-12-06 09:59:26 -08:00
Kyle Brenneman db5ca3370c EGL: Add support for eglQueryDisplayAttribKHR and NV.
There are KHR, EXT, and NV versions of eglQueryDisplayAttrib, so add
support for all of them.

Define separate eglQueryDisplayAttribEXT, eglQueryDisplayAttribKHR, and
eglQueryDisplayAttribNV functions. They all call into the same common
function, with the only difference being the name passed to an error
callback.

When loading a vendor library, check for the vendor's
eglQueryDisplayAttrib using all three suffixes, and use whichever one is
available.
2021-11-29 07:26:39 -07:00
Kyle Brenneman 055a4bab62 Merge branch 'egl-allow-adding-devices' into 'master'
EGL: Allow adding EGLDeviceEXT handles

See merge request glvnd/libglvnd!239
2021-11-26 13:25:23 +00:00
Kyle Brenneman 288eb48c04 tests: Add unit test for eglQueryDisplayAttribEXT.
Extended testegldeviceadd to be able to test calling eglQueryDisplayAttribEXT
to return a new EGLDeviceEXT handle.
2021-11-25 09:58:10 -07:00
Kyle Brenneman a5688ef25e tests: Implement EGL_EXT_device_query in the dummy vendor.
Added implementations for eglQueryDisplayAttribEXT, eglQueryDeviceAttribEXT,
and eglQueryDeviceStringEXT.

Defined a new EGL_DEVICE_INDEX attribute for eglGetPlatformDisplay that uses
a device based on its index. This will allow us to test the case where
eglQueryDisplayAttribEXT returns an EGLDeviceEXT handle that libglvnd hasn't
seen before.
2021-11-25 09:58:09 -07:00
Kyle Brenneman af3f7e9c2f tests: Added unit tests for adding new EGLDisplayEXT handles.
Added a new test program, testegldeviceadd, which tests a vendor library adding
a new EGLDeviceEXT handle after the application calls eglQueryDevicesEXT.

It's got two subtests right now. "querydevices" will test returning the new
device through a second eglQueryDevicesEXT call. "returndevice" tests returning
the new device through a vendor-provided dispatch stub.
2021-11-25 09:54:56 -07:00
Kyle Brenneman 01316ea91d tests: Update EGL test helpers to match the new EGL dummy vendor functions.
Updated egl_test_utils.c/h to include the new eglTestReturnDevice function.

Added functions to egl_test_utils.c/h to load each vendor's DummySetDeviceCount
function using dlopen+dlsym.
2021-11-25 09:54:56 -07:00
Kyle Brenneman 6d43e9bac5 tests: Add initial support for adding new devices to EGL_dummy.
Added a new function to the EGL dummy vendor called DummySetDeviceCount, which
will change the number of devices that it hands back for eglQueryDevicesEXT.

Also added a new dummy extension function, eglTestReturnDevice, which will
dispatch based on an EGLDisplay and return an EGLDeviceEXT handle. This is
used to test the new __EGLapiExports::setVendorForDevice function.
2021-11-25 09:51:20 -07:00
Kyle Brenneman eaffa7bc12 EGL: Add a dispatch stub for eglQueryDisplayAttribEXT.
Add a dispatch stub for eglQueryDisplayAttribEXT, which updates the device
hashtable if the application queries EGL_DEVICE_EXT.

It's possible that eglQueryDisplayAttribEXT could return an EGLDeviceEXT handle
that wasn't returned by eglQueryDevicesEXT, so the dispatch stub needs to add
the handle to the device hashtable.
2021-11-25 09:51:20 -07:00
Kyle Brenneman 26d15a9f13 EGL: Allow vendor's dispatch stubs to update the EGL device map.
Export a new __EGLapiExports::setVendorForDevice function, which allows
dispatch stubs to update the device hashtable when something returns an
EGLDeviceEXT handle.

Bumped the ABI version number to 1.2.
2021-11-25 09:51:20 -07:00
Kyle Brenneman 2747fcd3fc EGL: Allow adding EGLDeviceEXT handles
It's possible for new devices to become available while a program is running,
so eglQueryDevicesEXT might need to return a different list.

Change the EGLDeviceEXT hashtable so that each entry is allocated and added
separately, rathat than allocating every entry in a single malloc.

Added a new __eglAddDevice function, which adds an entry to the device
hashtable.

When the application calls eglQueryDevicesEXT, always call through to each
vendor library, and add (or update) each EGLDeviceEXT to the hashtable.

There's still no provision for removing an entry from the device hashtable. The
semantics of hot-unplugging a device aren't defined yet, and there's no way to
ensure that libglvnd's mapping will get updated if a device disappears
asynchonously, so it's up to the vendor library to deal with the old handle.
2021-11-25 09:51:20 -07:00
Kyle Brenneman 2d69d4720c Merge branch 'meson-test-environment-workaround' into 'master'
tests: Work around a bug in Meson 0.58.

Closes #218

See merge request glvnd/libglvnd!243
2021-10-28 15:30:02 +00:00
Kyle Brenneman 922b85a94a Merge branch 'fix-x11-config-option' into 'master'
Fix the option to disable X11 in meson

See merge request glvnd/libglvnd!258
2021-10-28 15:28:42 +00:00
Kyle Brenneman 6816db8015 Merge branch 'meson-test-add-dummy-depends' into 'master'
tests/meson: Add dependencies for the dummy vendor libraries.

See merge request glvnd/libglvnd!242
2021-10-27 18:32:48 +00:00
Kyle Brenneman f73ae47989 Merge branch 'tls-config-options' into 'master'
Add test coverage for TLS/TSD combinations

See merge request glvnd/libglvnd!251
2021-10-27 18:29:35 +00:00
Kyle Brenneman 27eb562a11 tests: Remove the X11 dependency from the EGL tests.
The EGL tests don't use X11, and only included the Xlib headers by way
of eglplatform.h.

Now that we don't set the USE_X11 macro anymore, eglplatform.h won't try
to include anything from Xlib, and so the EGL tests don't need X11 as a
dependency.
2021-10-27 12:27:47 -06:00