- 21 Aug, 2020 1 commit
-
-
Adam Jackson authored
This seems to be the shortest path to getting Delay working. It's kind of playing with fire, hence the warning, but it does seem to work if you're careful. Another option that I considered was to use dlmopen() to put libEGL into its own link map (and thus own TLS scope). That doesn't work because of dlmopen bugs, and wouldn't be portable outside of glibc and Solaris. Another another option I consider was to add a new GLDISPATCH_API_BLAH enum and teach the frontend libraries to handle it. This got ugly quickly, in part because I think that ends up wanting additional API between the frontend and vendor library without having a good way to signal from the frontend that that API is available. So if we're adding API anyway, simply exporting one function we already have seems quite a bit simpler.
-
- 24 Oct, 2016 1 commit
-
-
Kyle Brenneman authored
Added a new function to libGLdispatch, __glDispatchForceUnpatch, which forces it to unpatch the OpenGL entrypoints before libEGL or libGLX can unload the vendor library that patched them. If a vendor patches the OpenGL entrypoints, libGLdispatch doesn't unpatch them when that vendor's context is no longer current, because that adds too much overhead to repeated MakeCurrent+LoseCurrent calls. But, that also means that the patch callbacks end up being dangling pointers after the vendor library is unloaded. This mainly shows up at process termination when a process loads both libEGL and libGLX, because __glxFini and __eglFini will both call the vendor's threadAttach callback. Fixes https://github.com/NVIDIA/libglvnd/issues/103
-
- 24 Mar, 2016 1 commit
-
-
Kyle Brenneman authored
Rename __GLdispatchAPIState to __GLdispatchThreadState, to make it clearer that the structure contains thread-specific data. Updated some out-of-date comments.
-
- 10 Mar, 2016 1 commit
-
-
Kyle Brenneman authored
Added the function pointers for entrypoint rewriting as members of __GLXapiImports, instead of using a separate __GLdispatchPatchCallbacks pointer. Moved the __GLdispatchPatchCallbacks struct to GLdispatch.h.
-
- 13 Jan, 2016 1 commit
-
-
Kyle Brenneman authored
Two header files (libglxabi.h and GLdispatchABI.h) are public -- intended to be used by vendor libraries, while the other headers are all internal to libglvnd. Move the public header files to a new directory, include/glvnd. Add a makefile so that the public headers are installed by make install.
-
- 01 Oct, 2015 1 commit
-
-
Kyle Brenneman authored
The getProcAddress callback that libGLdispatch uses to populate the dispatch table now takes an extra parameter, which contains arbitrary data used by the callback. This allows much better flexibility in a how window system library populates a dispatch table.
-
- 10 Sep, 2015 1 commit
-
-
Kyle Brenneman authored
Removed __glDispatchGetOffset and __glDispatchSetEntry from libGLdispatch. Neither one is used anywhere, and the dispatch offsets should be an internal detail of libGLdispatch. Removed the mutex from stub_find_dynamic. Anything that calls that function should already be holding the GLdispatch lock. Also removed the __GLdispatchGetOffsetHook, since nothing uses it anymore.
-
- 23 Jul, 2015 2 commits
-
-
Kyle Brenneman authored
Move the vendorID and dispatch members from __GLdispatchAPIState to __GLdispatchAPIStatePrivate. How those variables are tracked and used is an internal detail of libGLdispatch, so they shouldn't be part of the public interface.
-
Kyle Brenneman authored
__GLdispatchAPIState now has a pointer to an opaque structure, to be used for arbitrary private data. This will allow later versions of libGLdispatch to add data for each API state without changing the binary interface to libGLX. The struct is mostly empty, but later changes will add more to it.
-
- 16 Jul, 2015 1 commit
-
-
Kyle Brenneman authored
__glDispatchMakeCurrent now fails if the current thread already has an API state. This removes the complication of dealing with switching directly from one vendor to another, and makes it easier for __glDispatchMakeCurrent to avoid any side effects if it fails.
-
- 10 Jul, 2015 1 commit
-
-
Kyle Brenneman authored
Add a version number for the interface between libGLX and libGLdispatch, which libGLX checks during initialization. The interface between libGLX and libGLdispatch can and should be a stable ABI, so that it's more resiliant to version mismatches if they come from different packages or installers. The version number is mainly a sanity check in case some future version of libGLdispatch does change the interface.
-
- 23 Jun, 2015 1 commit
-
-
Kyle Brenneman authored
Added a __GLdispatchStubPatchCallbacks struct to hold the callback functions that libGLdispatch uses to patch entrypoints in each DSO.
-
- 15 Jun, 2015 1 commit
-
-
Kyle Brenneman authored
Change __glDispatchInit to take no arguments, instead of having it optionlly fill in a GLVNDPthreadFuncs structure.
-
- 13 Jun, 2015 1 commit
-
-
Kyle Brenneman authored
Remvoved the context member of __GLdispatchAPIState, and instead added a new currentContext member to __GLXAPIState. libGLdispatch only needs the API state pointer, not the window system's context handle. This also removes the ill-defined case where a thread could have a current API state but not a current context.
-
- 12 Jun, 2015 1 commit
-
-
Kyle Brenneman authored
The "id" member of __GLdispatchAPIState isn't used anywhere in libGLdispatch, so it doesn't need to be part of libGLdispatch's interface. Instead, libGLX now stores the thread ID in __GLXAPIState::tid.
-
- 08 Jun, 2015 1 commit
-
-
Kyle Brenneman authored
Added a pointer to a callback function __GLdispatchAPIState to notify the window system library of thread termination. Removed tsdContextKey from libglx.c. It now uses the API state stored in libGLdispatch and the callback function in __GLdispatchAPIState instead. libGLX will now free the __GLXAPIState struct for a thread when the thread terminates, instead of waiting until __glXAPITeardown. Fixes issue #35
-
- 05 Jun, 2015 1 commit
-
-
Kyle Brenneman authored
Add a glvnd_key_t key to GLdispatch.c to hold the current API state. __glDispatchGetCurrentAPIState and __glDispatchGetCurrentContext are now normal exported functions instead of wrappers around _glapi_get_current. Removed _glapi_get_current, _glapi_set_current, _glapi_get_context, _glapi_set_context, and their associated functions in u_current.c. Removed the U_CURRENT_* constants and replaced them with the corresponding GLAPI_CURRENT_* constants. Removed the GLAPI_CURRENT_* enums except for GLAPI_CURRENT_DISPATCH.
-
- 01 Apr, 2015 1 commit
-
-
Kyle Brenneman authored
Added a __glDispatchCheckMultithreaded function to tell libGLdispatch to check for multiple threads. libGLX will now check for a second thread in __glXThreadInitialize. When ThreadSafe is true, u_current_get_index no longer returns a stale value from u_current.
-
- 28 Oct, 2014 1 commit
-
-
Brian Nguyen authored
__glDispatchFini() is called by a GLdispatch client to clean up GLdispatch-internal state when the client is done using GLdispatch functionality. __glDispatchReset() is called by a GLdispatch client to determine whether fork recovery is needed, and handle the fork if necessary. Signed-off-by:
Brian Nguyen <brnguyen@nvidia.com>
-
- 24 Jan, 2014 3 commits
-
-
Brian Nguyen authored
Modify __glDispatchMakeCurrent() to take a pointer to the patch callbacks for the vendor library whose context is about to be current. Implement GLdispatch.c:PatchEntrypoints() and helpers. This contains the logic for determining whether it is safe to patch entrypoints, and using the provided vendor callbacks to actually do the entrypoint patching. Call this from __glDispatchMakeCurrent() with the provided patch callbacks. Also implement GLdispatch.c:CurrentEntrypointsSafeToUse(), which determines based on the current vendor ID whether the current top-level code is safe to use with that vendor. If this check fails, the make current operation fails. Allow users to disable entrypoint rewriting functionality by setting the environment variable __GLVND_DISALLOW_PATCHING=1. When losing current, also attempt to restore the default libglvnd entrypoints so other vendors can potentially use them.
-
Brian Nguyen authored
This allows vendor libraries to potentially overwrite the static entrypoints of wrapper libraries (such as libGL and libOpenGL) at make current time, in addition to the main GLdispatch entrypoints.
-
Brian Nguyen authored
This implements the notion of a "vendor ID" that is unique to each vendor library instance loaded in a process. When entrypoint rewriting is implemented, this will be used by libglvnd to determine whether a given entrypoint implementation is compatible with a given context, by comparing the vendor owning the context with the vendor owning the implementation. This changes the function prototype of __glDispatchMakeCurrent() to include the vendorID as an argument, which will be saved off in the API state, and return a boolean value to indicate whether make current succeeded.
-
- 27 Nov, 2013 1 commit
-
-
Brian Nguyen authored
- Pull GL dispatch callback typedefs into GLdispatchABI.h. This is a common header which will be shared between the libGLX and libEGL ABIs. - Add extern "C" blocks to libglxabi.h and GLdispatchABI.h so these headers may be used with vendor libraries that are built C++. - Remove support for auxiliary dispatch table management (libglxgldispatch.[ch] and __GLdispatchExports). This can be added back in later on if it proves useful. - In libglxmappings.c, replace static initialization of glxExportsTable with one-time runtime initialization of the table. - In libglxmappings.c, use __glDispatchCreateTable() directly to create the initial dispatch table. - In libglxnoopdefs.h, remove unnecessary includes of libglxabipriv.h and libglxnoop.h. - Add screen mapping functions to the GLX exports table. Some extension functions not implemented by libglvnd, e.g. glXCreateContextAttribsARB() from GLX_ARB_create_context, may need to update the mappings from context or drawable to screen that are managed by libglvnd in order to work properly. Additionally, dispatch functions implemented by vendor libraries for GLX extension functions may want to query these mappings in order to properly dispatch the call. - Remove the getDispatchProto() vendor callback. This is not needed by libglvnd since libglvnd does not support mapping more than one entrypoint to a single dispatch stub. See GLdispatch.c for the rationale behind this decision. - Remove redundant typedefs to prevent build errors. - Delete the vendorData parameter from the getProcAddress() vendor callback, which isn't useful if there is no support for more than one libglvnd dispatch table per context. Add the isClientAPI parameter, which can be used to distinguish between getProcAddress() requests for GLX functions versus getProcAddress() requests for client API functions. - Remove the "screen" argument from Remove.*Mapping() functions. This is unnecessary, as the hash key used to lookup the mapping object in libglvnd's hashtables doesn't depend on the screen (which is the hash value). It's problematic since in some cases we don't actually know the value of the screen mapped to by a key. Signed-off-by:
Brian Nguyen <brnguyen@nvidia.com>
-
- 25 Nov, 2013 1 commit
-
-
Brian Nguyen authored
When making current, assign the API state's new context and dispatch table in GLdispatch rather than GLX. This avoids consistency issues if the API state is unchanged but the current dispatch or context may have changed. Update the __glDispatchMakeCurrent() call in __glXMakeGLDispatchCurrent() to get libglvnd building for now; a later change will remove libglxgldispatch.c altogether. Signed-off-by:
Brian Nguyen <brnguyen@nvidia.com>
-
- 26 Aug, 2013 4 commits
-
-
Brian Nguyen authored
This replaces the _glapi_tls_{Dispatch,Context} symbols with a single symbol, _glapi_tls_Current, which references an array of type (void*). This allows us to easily extend mapi to accomodate additional TLS entries, which will be necessary for storing current API state and allowing vendors to utilize TLS entries for their own purposes. This change is rather messy. It requires modification to both the dispatch stub generation code and mapi's compatibility #defines in u_current.h. This could probably be cleaned up in later changes. It's not clear whether _glapi_{set,get}_{dispatch,context}() are even needed anymore, but they are kept in place for backwards compatibility and to keep this change as self-contained as possible.
-
Brian Nguyen authored
This adds comments and (incomplete) code to describe the general strategy which will be taken to implement the GLdispatch API. This is still a WIP.
-
Brian Nguyen authored
Move the GLdispatch header file to its own directory in src/GLdispatch, and build a real DSO that GLX will depend on. In GLdispatch.c, add stub functions which will later be fleshed out.
-
Brian Nguyen authored
Add a new header file, GLdispatch.h, which defines an API for window-system libraries such as libGLX to manage core GL dispatch tables as well as TLS. Refactor the __GLXAPIState to be derived from __GLdispatchAPIState, make __GLXvendorInfo::glDispatch type __GLdispatchTable, and implement make current/get current functionality using this API. At some point this API will be implemented in a shared library used by both libGLX and libEGL.
-