- 31 May, 2016 1 commit
-
-
Kyle Brenneman authored
In __glDispatchLoseCurrent, don't try to restore the default entrypoints. Instead, __glDispatchMakeCurrent will check if it's using a different vendor library, and if so, it will unpatch and repatch the entrypoints then. If it's using the same vendor library (which will usually be the case), then it can leave them patched and skip the patch overhead. Some applications will call glXMakeCurrent to release and bind the same context every frame, sometimes multiples times. Each patch and unpatch sequnce can chew up 1-2 milliseconds. That's enough to significantly reduce the framerate of some applications. Reviewed-by:
James Jones <jajones@nvidia.com>
-
- 29 Mar, 2016 1 commit
-
-
Kyle Brenneman authored
The libglvnd libraries will now check for a new environment variable, __GLVND_APP_ERROR_CHECKING. If it's set to a non-zero value, then libglvnd will check for and report some application errors. Many non-libglvnd implementations of libGL.so have been fairly tolerant of certain application bugs. Libglvnd has to be similarly tolerant to support existing apps that the developers can't or won't fix. The new __GLVND_APP_ERROR_CHECKING provides a way to check for some of those errors, so that hopefully there will be fewer broken apps in the future. In addition to the setting itself, this updates the no-op stubs in libGLdispatch to report an error when the app tries to call an OpenGL function without a current context. Later changes will likely add other error checks.
-
- 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
__glx_Main now takes a pointer to the __GLXapiImports struct and fills it in. The __GLXapiImports struct is now allocated and zeroed by libGLX. This makes it possible to add an optional element to the end of the struct without breaking backward compatibility.
-
- 29 Feb, 2016 2 commits
-
-
Kyle Brenneman authored
Renamed __GLdispatchPatchCallbacks::checkPatchSupported to isPatchSupported, and renamed __GLXapiImports::checkSupportsScreen to isScreenSupported.
-
Kyle Brenneman authored
The threadAttach callback is used so that a vendor library can go through any thread initialization it needs to in order to deal with any later OpenGL calls. This allows a vendor library to work around broken applications that try to call OpenGL functions without a current context.
-
- 25 Feb, 2016 1 commit
-
-
Kyle Brenneman authored
glvnd_pthread.h and glvnd_pthread.c now declare and define a GLVNDPthreadFuncs struct, instead of having a separate declaration in libGLX and libGLdispatch. This mostly just simplifies initialization a bit, but it will also make it easier to have common code that uses pthreads functions. Reviewed-by:
Andy Ritger <aritger@nvidia.com>
-
- 21 Jan, 2016 1 commit
-
-
Kyle Brenneman authored
__glDispatchCheckMultithreaded will now check if the thread's current dispatch table is NULL, and if it is, it will plug in the no-op table. This is a workaround for some broken applications which try to call OpenGL functions without a current context. As long as the thread calls a GLX function first, any OpenGL calls it makes later will call a no-op stub instead of just crashing. Added calls to __glXThreadInitialize to some of the functions in __GLXapiExports, so that GLX extension functions will still call __glXThreadInitialize.
-
- 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.
-
- 23 Sep, 2015 1 commit
-
-
Kyle Brenneman authored
Rename the functions _glapi_get_dispatch and _glapi_set_dispatch to _glapi_get_current and _glapi_set_current. Aside from better consistency with _glapi_Current and _glapi_tls_Current, this should make it easier to avoid name clashes with Mesa's GLAPI functions.
-
- 10 Sep, 2015 2 commits
-
-
Kyle Brenneman authored
_glapi_get_proc_address (and stub_add_dynamic) will now assign an offset to a new dynamic stub when it's first generated, instead of waiting until _glapi_add_dispatch. Deferring it until _glapi_add_dispatch is only useful for handling aliases (where multiple functions are assigned to the same dispatch table slot), but libGLdispatch does not use aliases. Removed the newProcList list in GLdispatch.c. It'll now add all functions directly to extProcList. Removed _glapi_add_dispatch and stub_fix_dynamic.
-
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.
-
- 11 Aug, 2015 2 commits
-
-
Kyle Brenneman authored
When the last client calls __glDispatchFini, it will now free all of the TSD keys that it created in __glDispatchInit.
-
Kyle Brenneman authored
In libGLdispatch, initialize the pthreads table in a constructor function so that we can use the dispatch mutex in __glDispatchInit. In __glDispatchFini, check whether clientRefcount has dropped to zero before tearing everything down. libGL and libOpenGL will now call __glDispatchFini when they're unloaded, since they also call __glDispatchInit.
-
- 24 Jul, 2015 1 commit
-
-
Kyle Brenneman authored
-
- 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.
-
- 13 Jul, 2015 1 commit
-
-
Kyle Brenneman authored
Remove the isClientAPI parameter from __GLXvendorCallbacksRec::getProcAddress. The only thing that libGLX can use to determine the the isClientAPI flag is the function name, which a vendor library could implement just as easily. In addition, since it would be possible for a GL entrypoint to start with "glX", the isClientAPI flag isn't always reliable.
-
- 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 2 commits
-
-
Kyle Brenneman authored
Reworked the __GLdispatchPatchCallbacks interface, mostly toward fixing issue 37. __GLdispatchPatchCallbacks::initiatePatch now handles the entire patching process, instead of splitting it between initiatePatch, getOffsetHook, and finalizePatch. Added callbacks to __GLdispatchStubPatchCallbacks that are called before and after calling into the vendor library to patch the entrypoints. Changed the documentation to say that the vendor library can only change the entrypoints during the call to initiatePatch. That'll allow libGLdispatch to change the memory protection before and after the app is finished modifying the entrypoints. The callback that a vendor library calls to fetch an entrypoint now returns separate writable and executable addresses.
-
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.
-
- 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 2 commits
-
-
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.
-
Kyle Brenneman authored
Add a _glapi_init function to perform any initialization for the GLAPI layer. u_current_init will now initialize the TSD keys, instead of trying to create them when they're first used. Moved the check to multiple threads to __glDispatchCheckMultithreaded. The GLAPI layer now just has a _glapi_set_multithread function to tell it to switch to multi-threaded mode. Removed glapi/glthread.h, since nothing in it was used anywhere.
-
- 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.
-
- 27 Mar, 2015 1 commit
-
-
Kyle Brenneman authored
-
- 06 Feb, 2015 1 commit
-
-
Brian Nguyen authored
There is a theoretical problem of wrapping if an application frequently loads and unloads an API library which registers its entrypoints with GLdispatch. Proactively prevent this from being an issue by widening dispatchStubListGeneration, and the corresponding stubGeneration argument in the __GLdispatchPatchCallbacks API in GLdispatchABI.h, to 64-bit.
-
- 29 Jan, 2015 1 commit
-
-
Brian Nguyen authored
This callback notifies vendors when they no longer "own" patched top-level libglvnd entrypoints. This allows vendors to safely take advantage of optimizations which may modify entrypoint code outside of the finalizePatch() callback.
-
- 28 Oct, 2014 3 commits
-
-
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>
-
Brian Nguyen authored
Theoretically multiple clients (libGLX and a future libEGL) may call into __glDispatchInit() to set up dispatching, and we will want to refcount GLdispatch to determine when dispatch teardown should occur. So replace the global boolean 'initialized' with a counter 'clientRefcount' which tracks the number of clients using GLdispatch. Signed-off-by:
Brian Nguyen <brnguyen@nvidia.com>
-
Brian Nguyen authored
dispatchStubListGeneration was declared twice in GLdispatch.c, so delete one of the declarations. Signed-off-by:
Brian Nguyen <brnguyen@nvidia.com>
-
- 24 Jan, 2014 6 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 defines several callbacks to be used by vendor libraries for rewriting top-level entrypoints defined in libglvnd: - initiatePatch(): libglvnd calls into this function at make current time to determine whether entrypoint patching is possible with the given stub type and code size. The vendor library will notify libglvnd whether offsets are needed based on a generation number. - getOffsetHook(): libglvnd calls into the vendor library with this hook for each loaded interface library so the vendor can lookup the stub locations for rewriting. - finalizePatch(): libglvnd calls into this function after the vendor library has updated its stub locations to complete the patch.
-
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.
-
Brian Nguyen authored
GLdispatch previously relied on locking primitives retrieved from libGLX, but it may be loaded and used by other interface libraries (e.g. libOpenGL) prior to being loaded by libGLX. Instead, statically link the glvnd_pthread wrapper library in libGLdispatch and import the wrapper functions into libGLX when it first initializes libGLdispatch.
-
Brian Nguyen authored
This will be useful when determining whether contexts are current on threads other than the current thread, for the purposes of determining whether entrypoint re-writing is safe.
-