summaryrefslogtreecommitdiffstats
path: root/progs/xdemos
diff options
context:
space:
mode:
authorJesse Barnes <[email protected]>2009-11-02 11:20:08 -0800
committerJesse Barnes <[email protected]>2010-01-08 12:37:43 -0500
commitf35f666f81221aea0b2eda533573bcbd07d10d65 (patch)
tree2dd88ca8d6fc4944411f5aec236d55852e33e778 /progs/xdemos
parent7f170573ea486f2f2dd474c2590346f1a0110773 (diff)
xdemos/glsync: Add swap interval support to glsync test
Diffstat (limited to 'progs/xdemos')
-rw-r--r--progs/xdemos/glsync.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/progs/xdemos/glsync.c b/progs/xdemos/glsync.c
index da87306cf2a..e813c8770d5 100644
--- a/progs/xdemos/glsync.c
+++ b/progs/xdemos/glsync.c
@@ -59,6 +59,7 @@
void (*video_sync_get)();
void (*video_sync)();
+void (*swap_interval)();
static int GLXExtensionSupported(Display *dpy, const char *extension)
{
@@ -84,7 +85,7 @@ static int GLXExtensionSupported(Display *dpy, const char *extension)
extern char *optarg;
extern int optind, opterr, optopt;
-static char optstr[] = "w:h:s:v";
+static char optstr[] = "w:h:s:vi:";
enum sync_type {
none = 0,
@@ -100,6 +101,7 @@ static void usage(char *name)
printf("\t\tn: none\n");
printf("\t\ts: SGI video sync extension\n");
printf("\t\tb: buffer swap\n");
+ printf("\t-i<swap interval>\n");
printf("\t-v: verbose (print count)\n");
exit(-1);
}
@@ -117,7 +119,7 @@ int main(int argc, char *argv[])
Atom wmDelete;
enum sync_type waitforsync = none;
int width = 500, height = 500, verbose = 0,
- countonly = 0;
+ countonly = 0, interval = 1;
int c, i = 1;
opterr = 0;
@@ -148,6 +150,9 @@ int main(int argc, char *argv[])
case 'v':
verbose = 1;
break;
+ case 'i':
+ interval = atoi(optarg);
+ break;
default:
usage(argv[0]);
break;
@@ -227,11 +232,15 @@ int main(int argc, char *argv[])
video_sync_get = glXGetProcAddress((unsigned char *)"glXGetVideoSyncSGI");
video_sync = glXGetProcAddress((unsigned char *)"glXWaitVideoSyncSGI");
- if (!video_sync_get || !video_sync) {
+ swap_interval = glXGetProcAddress((unsigned char *)"glXSwapIntervalSGI");
+
+ if (!video_sync_get || !video_sync || !swap_interval) {
fprintf(stderr, "failed to get sync functions\n");
return -1;
}
+ swap_interval(interval);
+ fprintf(stderr, "set swap interval to %d\n", interval);
video_sync_get(&count);
count++;
while (i++) {
@@ -256,6 +265,11 @@ int main(int argc, char *argv[])
continue;
}
+ if (verbose) {
+ video_sync_get(&count);
+ fprintf(stderr, "current count: %d\n", count);
+ }
+
/* Alternate colors to make tearing obvious */
if (i & 1)
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);