Change glMakeCurrentTestResults to a GLX function instead of a GL function, so
that it can be dispatched using a vendor-provided stub instead of having to
generate one.
Remove the testglxmclate test, and the --late option in testglxmakecurrent,
since that only makes sense when MakeCurrentTestResults was a GL function.
It now calls glXGetClientString up front to load the dummy vendor library. The
GLX entrypoint generation path has its own test now, so this test can now work
on builds without assembly support.
It now uses glXQueryServerString to test calling a core GLX function. That's a
better test because it returns a predictable value, so we can make sure that it
actually gets dispatched to the vendor library, instead of just checking that
it doesn't crash.
For testing looking up an OpenGL function, it'll call glXGetProcAddress and
directly call __glDispatchGetProcAddress, and make sure that it gets the same
pointer from both. It doesn't try to call the function, since OpenGL
dispatching has its own tests.
Added a separate test program testglxgetprocaddress_genentry to test the GLX
entrypoint generation by itself instead of lumping that in with
testglxgetprocaddress.
Defining a target-specific CFLAGS variable overrides AM_CFLAGS, so add the same
include paths for the GLX tests that we used to add using AM_CFLAGS.
Also remove the -Wno-error flags, since they aren't needed anymore.
This is important for testing the TSD stubs, which have a separate fast path
for single-threaded programs.
The TSD stubs start with a simple global variable to hold the dispatch table
so that a single-threaded program doesn't have to deal with the overhead of
calling pthread_getspecific. When a second thread comes along, it sets that
variable to NULL, which makes the stubs call pthread_getspecific instead.
This change adds a flag to the testgldispatch test program that tells it to
call into libGLdispatch from two threads to force it into its multi-threaded
mode.
It also adds three new test scripts, which are the same testgldispatch tests
but for the multithreaded path.
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.
Add a new test, testglxcreatecontext to test the various functions for creating
GLX contexts.
It tests the core GLX functions, the GLX_ARB_create_context and
GLX_EXT_no_config_context extensions, and using a vendor-provided extension
function.
The new test is much simpler than trying to use testglxmakecurrent to test both
context creation and MakeCurrent, especially for trying to test multiple
context creation functions.
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.
Added three new configure options to disable building the EGL, GLX, GLES
libraries.
In the tests makefile, move the list of test scripts to separate unconditional
variables, and add those to EXTRA_DIST. Just conditionally adding variables to
TESTS isn't enough to include the test scripts in the dist package.
Split up the TESTS and check_PROGRAMS variable assignments, so that they're
assigned next to the commands to build each test.
In addition to better readability and making it easier to avoid merge
conflicts, this will allow making some of the tests conditional based on build
options.
Add a test for switching between different contexts across multiple vendors.
The new test also checks libEGL's recovery when a vendor's eglMakeCurrent
fails.
The EGL dummy vendor will now keep track of the current context, so that we
can test whether eglMakeCurrent calls get passed through correctly.
Also added a command to force an eglMakeCurrent call to fail, and to fetch the
the current context from directly from a vendor library.
Added a test for EGL_EXT_device_enumeration and EGL_EXT_platform_device, plus
dispatching to an EGL extesnion function based on an EGLDeviceEXT handle.
Added a test for eglGetProcAddress and dispatching for EGL and GL functions.
Added three EGL extension functions to the EGL dummy vendor, to test
dispatching extensions by display, device, and current context.
Added a simple implementation of eglCreateContext, eglDestroyContext, and
eglMakeCurrent, and glGetString.
Added two dummy libraries for EGL. They both use the same code, but each one
has a name string that can be used to check which vendor something is
dispatched to.
The dummy library is still incomplete, but more functions will be add later
along with more tests.
The test just creates an EGLDisplay using a dummy platform type, and then
checks to make sure that the display dispatches to the correct vendor library.
Also added a script to set up the test environment, and a file for common
functions and variables for EGL tests.
Added a variation of testglxgetprocaddress that doesn't pre-load the vendor
library. This forces it to generate a GLX entrypoint at runtime for
glXExampleExtensionFunction.
In testglxgetprocaddress.c, added a call to glXGetClientString so that it will
load the vendor library without having to pre-load it.
Add a new unit test, testpatchentrypoints_gldispatch. It calls into
libGLdispatch directly instead of going through GLX or EGL, and it tests
patching and unpatching between multiple vendor libraries.
Rewrote the x86-64 assembly for the entrypoint patching tests. It now uses
absolute memory addresses instead of RIP-relative, so it can work even if the
variable that it's supposed to update isn't within +-2GB of the function.
Added a separate script glxenv.sh for the common environment variables used by
the other GLX tests.
Removed the testx11glvndproto and testglxnscreens tests, since both of them
depend on the x11glvnd X extension, which is no longer used.
Removed the unused GLX_dummy_copy stuff from the GLX_dummy makefile. Also
removed the COMMON_* variables, since they're only ever used once each.
Fixed a few order and variable name warnings.
Defined convenience libraries for the source files under src/util, to avoid the
subdir-objects warning from them.
Delete the x11glvnd directory.
Commented out the two tests that depend on it, testx11glvndproto and
testglxnscreens. Eventually, they should be rewritten to use the
GLX_EXT_libglvnd extension instead.
Moved glvnd_pthread.h and glvnd_pthread.c into src/utils, and removed the
separate makefile for them. The other makefiles now just grab the source file
directly instead.
Reviewed-by: Andy Ritger <aritger@nvidia.com>
The test function in testglxgetprocaddress uses a display and screen number to
figure out which vendor to dispatch to, so it needs a real, valid display
connection.
Fixes issue #32.
This unit test verifies that entrypoint patching works as expected, by
loading libGLX_patchentry.so, looking up the address of
__glXSawVertex3fv defined in libGLX_patchentry.so, and verifying that
the value at this symbol matches the number of calls to glVertex3fv()
(which is hacked to increment __glXSawVertex3fv via entrypoint
rewriting).
Everything needed to actually build the driver needs to be included in something
that makes it end up in the distribution tarball. For headers, use
noinst_HEADERS. For everything else, use EXTRA_DIST.
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
I missed these in commit debae590e7 because my
test system had a compatible glxext.h in /usr/include/GL. On a system with an
incompatible version (i.e. Ubuntu), this causes build failures. Fix the include
paths to include the GL headers from the repository instead of the system.
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
Debug builds of libglvnd_pthread.la depend on the __glvnd_dbg_printf
symbol from libtrace.la. Sort the link order so that the linker sees
libglvnd_pthread.la and its unresolved symbol first, so that it knows
to resolve it when it subsequently sees libtrace.la.
Signed-off-by: Andy Ritger <aritger@nvidia.com>
Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
testx11glvndproto tests specifically the GLVendor X extension, which is
used to lookup XID -> screen and screen -> vendor mappings in the
prototype.
testglxnscreens tests that the API library successfully dispatches GL
calls to the right vendor based on this lookup.
This subtest verifies that the GLX API library's implementation of
glXGetClientString() (which takes the "union" (concatenation) of each
vendor's client string) works as expected.
This is a variant of the testglxmakecurrent subtest which links against
the libGL filter library instead of libOpenGL + libGLX. This verifies
the ELF symbol filtering works as expected.
This implements a test app, testglxmakecurrent, which verifies the
correctness of the API library's GL dispatching when a vendor's context
is current in one or more threads.
This test spawns a given number of threads each with their own separate
context and window, and has each thread make current to its given
context. The thread then calls some core GL functions and
(to-be-implemented) a GL extension function, glMakeCurrentTestResults(),
which returns the number of times each core GL function was called.
The test then compares glMakeCurrentTestResults()'s result (which should
match up with the vendor library's call count) to the application's call
count and fails if there is a mismatch.
The test is designed to only require pthreads if multiple threads are
used. This verifies that the API library's single-threaded fake pthread
wrapper functions work properly.
Add testglxmc{basic,late,loop,threads}.sh scripts, which run the
testglxmakecurrent test with different arguments for ordering of
glXGetProcAddress(), number of threads, and number of iterations.
Isolate helper functions for window creation/destruction to a separate
test_utils.c source file which will be used by later tests.
This subtest verifies that glXGetProcAddress() works for the various
classifications of "GetProcAddress-able" functions:
- GLX 1.4 functions with dispatchers implemented directly by the API
library
- GLX 1.4 extension functions with dispatchers implemented by a vendor
loaded by the API library
- Core OpenGL functions with static dispatch stubs in libGLdispatch
- Core OpenGL functions with dynamic dispatch stubs generated by
libGLdispatch
This also tests some assertions about these dispatch stubs; namely that
the core GL dispatch stubs are no-ops if no context is current.
This adds build infrastructure for unit testing the API library
using the serial test harness. TODO: this should be replaced with
the parallel test harness, as the automake documentation says the
serial harness is deprecated.
The first and last tests to be run are scripts to initialize the test
environment (an X session with a special -modulepath argument and
xorg.conf file to pick up x11glvnd) and tear it down after all unit
tests are run.
This also adds a placeholder directory for a fake vendor library
called "GLX_dummy", to be implemented later.