summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2012-09-25 11:12:47 -0700
committerEric Anholt <eric@anholt.net>2012-10-26 12:57:46 -0700
commit6ac0ff742bca7c405a275407efa92e8a29adbd37 (patch)
treec692d83d5ab343fb7e8ddcb25b26bb54f2d2acaa /tests
parent9f7bcd6848e485b64ca5b23d6ba421457e7f8ef9 (diff)
GLX_OML_sync_control: Add new tests.
I was going to go touch this code in Mesa, then I realised that we didn't have a single test for it. v2: Rebase on Chad's BUILD_* sedjob, and explicitly test various swap intervals. v3: Rewrite wrapping loops. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/all.tests8
-rw-r--r--tests/spec/CMakeLists.txt1
-rw-r--r--tests/spec/glx_oml_sync_control/CMakeLists.gl.txt30
-rw-r--r--tests/spec/glx_oml_sync_control/CMakeLists.txt1
-rw-r--r--tests/spec/glx_oml_sync_control/common.c88
-rw-r--r--tests/spec/glx_oml_sync_control/common.h16
-rw-r--r--tests/spec/glx_oml_sync_control/swapbuffersmsc-divisor-zero.c143
-rw-r--r--tests/spec/glx_oml_sync_control/swapbuffersmsc-return.c116
-rw-r--r--tests/spec/glx_oml_sync_control/waitformsc.c102
9 files changed, 505 insertions, 0 deletions
diff --git a/tests/all.tests b/tests/all.tests
index 27cb528d..0ee4ca9c 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -432,6 +432,14 @@ glx['GLX_EXT_create_context_es2_profile'] = create_context_es2_profile
create_context_es2_profile['indirect rendering ES2 profile'] = concurrent_test('glx-create-context-indirect-es2-profile')
create_context_es2_profile['invalid OpenGL ES version'] = concurrent_test('glx-create-context-invalid-es-version')
+oml_sync_control = Group();
+glx['GLX_OML_sync_control'] = oml_sync_control
+oml_sync_control['swapbuffersmsc-divisor-zero'] = concurrent_test('glx-oml-sync-control-swapbuffersmsc-divisor-zero')
+oml_sync_control['swapbuffersmsc-return'] = concurrent_test('glx-oml-sync-control-swapbuffersmsc-return')
+oml_sync_control['swapbuffersmsc-return swap_interval 0'] = concurrent_test('glx-oml-sync-control-swapbuffersmsc-return 0')
+oml_sync_control['swapbuffersmsc-return swap_interval 1'] = concurrent_test('glx-oml-sync-control-swapbuffersmsc-return 1')
+oml_sync_control['waitformsc'] = concurrent_test('glx-oml-sync-control-waitformsc')
+
def texwrap_test(args):
test = PlainExecTest(['texwrap', '-fbo', '-auto'] + args)
test.runConcurrent = True
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 1e2b0a1f..351b113c 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -52,6 +52,7 @@ add_subdirectory (gl-3.0)
add_subdirectory (gl-3.1)
add_subdirectory (glx_arb_create_context)
add_subdirectory (glx_ext_import_context)
+add_subdirectory (glx_oml_sync_control)
add_subdirectory (arb_vertex_type_2_10_10_10_rev)
add_subdirectory (ext_texture_array)
add_subdirectory (ext_texture_integer)
diff --git a/tests/spec/glx_oml_sync_control/CMakeLists.gl.txt b/tests/spec/glx_oml_sync_control/CMakeLists.gl.txt
new file mode 100644
index 00000000..d73365de
--- /dev/null
+++ b/tests/spec/glx_oml_sync_control/CMakeLists.gl.txt
@@ -0,0 +1,30 @@
+
+include_directories(
+ ${GLEXT_INCLUDE_DIR}
+ ${OPENGL_INCLUDE_PATH}
+)
+
+if(PIGLIT_BUILD_GLX_TESTS)
+ link_libraries (
+ piglitglxutil
+ )
+endif(PIGLIT_BUILD_GLX_TESTS)
+
+link_libraries (
+ ${OPENGL_gl_LIBRARY}
+ ${OPENGL_glu_LIBRARY}
+)
+
+IF(PIGLIT_BUILD_GLX_TESTS)
+ include_directories(
+ ${GLPROTO_INCLUDE_DIRS}
+ )
+ link_libraries (
+ ${X11_X11_LIB}
+ )
+ piglit_add_executable (glx-oml-sync-control-swapbuffersmsc-divisor-zero swapbuffersmsc-divisor-zero.c common.c)
+ piglit_add_executable (glx-oml-sync-control-swapbuffersmsc-return swapbuffersmsc-return.c common.c)
+ piglit_add_executable (glx-oml-sync-control-waitformsc waitformsc.c common.c)
+ENDIF(PIGLIT_BUILD_GLX_TESTS)
+
+# vim: ft=cmake:
diff --git a/tests/spec/glx_oml_sync_control/CMakeLists.txt b/tests/spec/glx_oml_sync_control/CMakeLists.txt
new file mode 100644
index 00000000..144a306f
--- /dev/null
+++ b/tests/spec/glx_oml_sync_control/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/glx_oml_sync_control/common.c b/tests/spec/glx_oml_sync_control/common.c
new file mode 100644
index 00000000..db4c3aab
--- /dev/null
+++ b/tests/spec/glx_oml_sync_control/common.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+/** @file common.c
+ *
+ * Support code for running tests of GLX_OML_sync_control.
+ */
+
+#include "piglit-util-gl-common.h"
+#include "piglit-glx-util.h"
+#include "common.h"
+
+PFNGLXGETSYNCVALUESOMLPROC __piglit_glXGetSyncValuesOML;
+PFNGLXGETMSCRATEOMLPROC __piglit_glXGetMscRateOML;
+PFNGLXSWAPBUFFERSMSCOMLPROC __piglit_glXSwapBuffersMscOML;
+PFNGLXWAITFORMSCOMLPROC __piglit_glXWaitForMscOML;
+PFNGLXWAITFORSBCOMLPROC __piglit_glXWaitForSbcOML;
+Window win;
+XVisualInfo *visinfo;
+
+void
+piglit_oml_sync_control_test_run(enum piglit_result (*draw)(Display *dpy))
+{
+ Display *dpy;
+ GLXContext ctx;
+ const int proc_count = 5;
+ __GLXextFuncPtr *procs[proc_count];
+ const char *names[proc_count];
+ int i;
+
+#define ADD_FUNC(name) \
+ do { \
+ procs[i] = (__GLXextFuncPtr *)&(__piglit_##name); \
+ names[i] = #name; \
+ i++; \
+ } while (0)
+
+ i = 0;
+ ADD_FUNC(glXGetSyncValuesOML);
+ ADD_FUNC(glXGetMscRateOML);
+ ADD_FUNC(glXSwapBuffersMscOML);
+ ADD_FUNC(glXWaitForMscOML);
+ ADD_FUNC(glXWaitForSbcOML);
+
+ dpy = XOpenDisplay(NULL);
+ if (dpy == NULL) {
+ fprintf(stderr, "couldn't open display\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ piglit_require_glx_extension(dpy, "GLX_OML_sync_control");
+ piglit_glx_get_all_proc_addresses(procs, names, ARRAY_SIZE(procs));
+
+ visinfo = piglit_get_glx_visual(dpy);
+ win = piglit_get_glx_window(dpy, visinfo);
+ ctx = piglit_get_glx_context(dpy, visinfo);
+ glXMakeCurrent(dpy, win, ctx);
+
+ piglit_dispatch_default_init();
+
+ XMapWindow(dpy, win);
+
+ piglit_glx_event_loop(dpy, draw);
+}
diff --git a/tests/spec/glx_oml_sync_control/common.h b/tests/spec/glx_oml_sync_control/common.h
new file mode 100644
index 00000000..c06bdd7b
--- /dev/null
+++ b/tests/spec/glx_oml_sync_control/common.h
@@ -0,0 +1,16 @@
+#define glXGetSyncValuesOML __piglit_glXGetSyncValuesOML
+#define glXGetMscRateOML __piglit_glXGetMscRateOML
+#define glXSwapBuffersMscOML __piglit_glXSwapBuffersMscOML
+#define glXWaitForMscOML __piglit_glXWaitForMscOML
+#define glXWaitForSbcOML __piglit_glXWaitForSbcOML
+
+extern PFNGLXGETSYNCVALUESOMLPROC __piglit_glXGetSyncValuesOML;
+extern PFNGLXGETMSCRATEOMLPROC __piglit_glXGetMscRateOML;
+extern PFNGLXSWAPBUFFERSMSCOMLPROC __piglit_glXSwapBuffersMscOML;
+extern PFNGLXWAITFORMSCOMLPROC __piglit_glXWaitForMscOML;
+extern PFNGLXWAITFORSBCOMLPROC __piglit_glXWaitForSbcOML;
+
+extern Window win;
+extern XVisualInfo *visinfo;
+
+void piglit_oml_sync_control_test_run(enum piglit_result (*draw)(Display *dpy));
diff --git a/tests/spec/glx_oml_sync_control/swapbuffersmsc-divisor-zero.c b/tests/spec/glx_oml_sync_control/swapbuffersmsc-divisor-zero.c
new file mode 100644
index 00000000..555f5514
--- /dev/null
+++ b/tests/spec/glx_oml_sync_control/swapbuffersmsc-divisor-zero.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+/** @file swapbuffersmsc-divisor-zero.c
+ *
+ * Test that when the divsior is zero in glXSwapBuffersMscOML, the
+ * target MSC is reached.
+ */
+
+#include "piglit-util-gl-common.h"
+#include "piglit-glx-util.h"
+#include "common.h"
+
+int piglit_width = 50, piglit_height = 50;
+
+enum piglit_result
+draw(Display *dpy)
+{
+ /* Fill the variables that will be returned as out values with
+ * junk to better detect failure there.
+ */
+ int64_t start_ust = 0xd0, start_msc = 0xd0, start_sbc = 0xd0;
+ int64_t swapped_ust = 0xd0, swapped_msc = 0xd0, swapped_sbc = 0xd0;
+ int64_t current_ust = 0xd0, current_msc = 0xd0, current_sbc = 0xd0;
+ int64_t target_msc, outstanding_sbc;
+ bool already_wrapped = false;
+
+ glXGetSyncValuesOML(dpy, win, &start_ust, &start_msc, &start_sbc);
+ if (start_sbc != 0) {
+ fprintf(stderr,
+ "Initial SBC for the window should be 0, was %lld\n",
+ (long long)start_sbc);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+ outstanding_sbc = start_sbc;
+
+wrap:
+ glClearColor(0.0, 1.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* Queue a swap for 5 frames from when we started. */
+ target_msc = start_msc + 5;
+ glXSwapBuffersMscOML(dpy, win, target_msc, 0, 0);
+ outstanding_sbc++;
+
+ /* Wait for that swap. */
+ glXWaitForSbcOML(dpy, win, outstanding_sbc,
+ &swapped_ust, &swapped_msc, &swapped_sbc);
+ if (swapped_sbc != outstanding_sbc) {
+ fprintf(stderr,
+ "glXWaitForSbcOML() returned SBC %lld, "
+ "should be %lld\n",
+ (long long)swapped_sbc, (long long)outstanding_sbc);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ glXGetSyncValuesOML(dpy, win,
+ &current_ust, &current_msc, &current_sbc);
+ if (current_sbc != outstanding_sbc) {
+ fprintf(stderr,
+ "glXGetSyncValuesOML() returned SBC %lld, "
+ "should be %lld\n",
+ (long long)current_sbc, (long long)outstanding_sbc);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ if (current_msc < start_msc) {
+ /* The MSC counter wrapped. Try the test again. But
+ * it definitely won't wrap this time.
+ */
+ if (already_wrapped) {
+ fprintf(stderr,
+ "Wrapped MSC twice!\n"
+ "Second time: %lld -> %lld\n",
+ (long long)start_msc,
+ (long long)current_msc);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ glXGetSyncValuesOML(dpy, win,
+ &start_ust, &start_msc, &start_sbc);
+ already_wrapped = true;
+ goto wrap;
+ }
+
+ if (swapped_msc < target_msc) {
+ fprintf(stderr,
+ "glXWaitForSbcOML() returned MSC %lld, "
+ "should be at least %lld\n",
+ (long long)swapped_msc,
+ (long long)target_msc);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ if (current_msc < target_msc ||
+ current_msc < swapped_msc) {
+ fprintf(stderr,
+ "glXGetSyncValuesMsc() returned MSC %lld, "
+ "should be at least swap target msc (%lld) "
+ "and last swap MSC (%lld)\n",
+ (long long)current_msc,
+ (long long)target_msc,
+ (long long)swapped_msc);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ piglit_report_result(PIGLIT_PASS);
+
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
+
+int
+main(int argc, char **argv)
+{
+ piglit_oml_sync_control_test_run(draw);
+
+ return 0;
+}
diff --git a/tests/spec/glx_oml_sync_control/swapbuffersmsc-return.c b/tests/spec/glx_oml_sync_control/swapbuffersmsc-return.c
new file mode 100644
index 00000000..92f34ea2
--- /dev/null
+++ b/tests/spec/glx_oml_sync_control/swapbuffersmsc-return.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+/** @file swapbuffersmsc-return.c
+ *
+ * Test that glXSwapBuffersMscOML() returns a correct sbc value.
+ *
+ * Catches a bug in the X Server when a swap interval of 0 is used.
+ */
+
+#include "piglit-util-gl-common.h"
+#include "piglit-glx-util.h"
+#include "common.h"
+
+int piglit_width = 50, piglit_height = 50;
+
+int swap_interval = -1;
+
+enum piglit_result
+draw(Display *dpy)
+{
+ /* Fill the variables that will be returned as out values with
+ * junk to better detect failure there.
+ */
+ int64_t start_ust = 0xd0, start_msc = 0xd0, start_sbc = 0xd0;
+ int64_t next_sbc;
+ bool pass = true;
+ int i;
+
+#if defined(GLX_MESA_swap_control)
+ if (swap_interval != -1) {
+ PFNGLXSWAPINTERVALMESAPROC pglXSwapIntervalMESA;
+
+ printf("Testing with swap interval %d\n", swap_interval);
+
+ piglit_require_glx_extension(dpy, "GLX_MESA_swap_control");
+ pglXSwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)
+ glXGetProcAddressARB((const GLubyte *)
+ "glXSwapIntervalMESA");
+ pglXSwapIntervalMESA(swap_interval);
+ } else {
+ printf("Testing with default swap interval\n");
+ }
+#else
+ printf("Testing with default swap interval\n");
+#endif
+
+ glXGetSyncValuesOML(dpy, win, &start_ust, &start_msc, &start_sbc);
+ if (start_sbc != 0) {
+ fprintf(stderr,
+ "Initial SBC for the window should be 0, was %lld\n",
+ (long long)start_sbc);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+ next_sbc = start_sbc + 1;
+
+ for (i = 0; i < 3; i++) {
+ int64_t ret_sbc;
+
+ glClearColor(0.0, 1.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ ret_sbc = glXSwapBuffersMscOML(dpy, win, 0, 1, 0);
+
+ if (ret_sbc != next_sbc) {
+ printf("Frame %d: sbc was %lld, should be %lld\n",
+ i,
+ (long long)ret_sbc,
+ (long long)next_sbc);
+ pass = false;
+ }
+
+ next_sbc++;
+ }
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
+
+int
+main(int argc, char **argv)
+{
+ if (argc >= 2) {
+ swap_interval = atoi(argv[1]);
+ }
+
+ piglit_oml_sync_control_test_run(draw);
+
+ return 0;
+}
diff --git a/tests/spec/glx_oml_sync_control/waitformsc.c b/tests/spec/glx_oml_sync_control/waitformsc.c
new file mode 100644
index 00000000..6fdef6ec
--- /dev/null
+++ b/tests/spec/glx_oml_sync_control/waitformsc.c
@@ -0,0 +1,102 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+/** @file waitformsc.c
+ *
+ * Test that glXWaitForMscOML() waits until both it and
+ * glXGetSyncValuesOML() return a an msc that meet the target.
+ */
+
+#include "piglit-util-gl-common.h"
+#include "piglit-glx-util.h"
+#include "common.h"
+
+int piglit_width = 50, piglit_height = 50;
+
+enum piglit_result
+draw(Display *dpy)
+{
+ /* Fill the variables that will be returned as out values with
+ * junk to better detect failure there.
+ */
+ int64_t start_ust = 0xd0, start_msc = 0xd0, start_sbc = 0xd0;
+ int64_t wait_ust = 0xd0, wait_msc = 0xd0, wait_sbc = 0xd0;
+ int64_t current_ust = 0xd0, current_msc = 0xd0, current_sbc = 0xd0;
+ int64_t target_msc;
+ bool already_wrapped = false;
+
+wrap:
+ glXGetSyncValuesOML(dpy, win, &start_ust, &start_msc, &start_sbc);
+
+ /* Wait for the MSC to be at least equal to target,
+ * with no divisor trickery.
+ */
+ target_msc = start_msc + 5;
+ glXWaitForMscOML(dpy, win, target_msc, 0, 0,
+ &wait_ust, &wait_msc, &wait_sbc);
+
+ glXGetSyncValuesOML(dpy, win,
+ &current_ust, &current_msc, &current_sbc);
+
+ if (current_msc < target_msc) {
+ /* The clock may have actually wrapped, in which case
+ * we need to try again because we're not doing
+ * wrapping math here for simplicity.
+ */
+ if (!already_wrapped) {
+ already_wrapped = true;
+ goto wrap;
+ }
+
+ fprintf(stderr,
+ "glXGetSyncValuesOML() returned msc of %lld, "
+ "expected >= %lld\n",
+ (long long)current_msc,
+ (long long)target_msc);
+ }
+
+ if (wait_msc < target_msc) {
+ fprintf(stderr,
+ "glXWaitForMscOML() returned msc of %lld, "
+ "expected >= %lld\n",
+ (long long)wait_msc,
+ (long long)target_msc);
+ }
+
+ piglit_report_result(PIGLIT_PASS);
+
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
+
+int
+main(int argc, char **argv)
+{
+ piglit_oml_sync_control_test_run(draw);
+
+ return 0;
+}