summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2009-07-22 14:14:59 -0700
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-07-22 14:14:59 -0700
commit4ee624771ab698e797b4c9d148ee75a3b14a73e7 (patch)
tree18f40d3b9eb9d17f14e0660aeac3cb9604a83a1e
parenta5a97b22c256cdadcfbf0b440474bfdf856e3ace (diff)
Add swapbuffers and vsync_wait optionsHEADmaster
Some drivers will automatically prevent tearing when swapbuffers or copysubbuffer is called, and will throttle drawing at that time as well (usually to the refresh rate); the --no-wait option can be used in that case. And for testing drivers, the --always-swap option can be nice, since it will force full screen updates, allowing page flipping paths to be taken, for example. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
-rw-r--r--include/compiz-core.h2
-rw-r--r--src/display.c9
-rw-r--r--src/main.c14
3 files changed, 22 insertions, 3 deletions
diff --git a/include/compiz-core.h b/include/compiz-core.h
index 05409f5d..d9c7ca5a 100644
--- a/include/compiz-core.h
+++ b/include/compiz-core.h
@@ -219,6 +219,8 @@ extern Bool useCow;
extern Bool noDetection;
extern Bool useDesktopHints;
extern Bool onlyCurrentScreen;
+extern Bool noWait;
+extern Bool alwaysSwap;
extern int defaultRefreshRate;
extern char *defaultTextureFilter;
diff --git a/src/display.c b/src/display.c
index caf63d46..dcb05cb9 100644
--- a/src/display.c
+++ b/src/display.c
@@ -1450,6 +1450,9 @@ eventLoop (void)
s->idle ? s->redrawTime :
timeDiff);
+ if (alwaysSwap == TRUE)
+ damageScreen (s);
+
/* substract top most overlay window region */
if (s->overlayWindowCount)
{
@@ -1509,9 +1512,11 @@ eventLoop (void)
targetScreen = NULL;
targetOutput = &s->outputDev[0];
- waitForVideoSync (s);
+ if (!noWait)
+ waitForVideoSync (s);
- if (mask & COMP_SCREEN_DAMAGE_ALL_MASK)
+ if ((mask & COMP_SCREEN_DAMAGE_ALL_MASK) ||
+ (alwaysSwap == TRUE))
{
glXSwapBuffers (d->display, s->output);
}
diff --git a/src/main.c b/src/main.c
index e089bbb0..8f20a1c0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -63,6 +63,8 @@ Bool strictBinding = TRUE;
Bool noDetection = FALSE;
Bool useDesktopHints = FALSE;
Bool onlyCurrentScreen = FALSE;
+Bool noWait = FALSE;
+Bool alwaysSwap = FALSE;
#ifdef USE_COW
Bool useCow = TRUE;
@@ -85,7 +87,9 @@ usage (void)
"[--replace]\n "
"[--sm-disable] "
"[--sm-client-id ID] "
- "[--only-current-screen]\n "
+ "[--only-current-screen] "
+ "[--no-wait]\n "
+ "[--always-swap]"
#ifdef USE_COW
" [--use-root-window] "
@@ -364,6 +368,14 @@ main (int argc, char **argv)
if (i + 1 < argc)
backgroundImage = argv[++i];
}
+ else if (!strcmp (argv[i], "--no-wait"))
+ {
+ noWait = TRUE;
+ }
+ else if (!strcmp (argv[i], "--always-swap"))
+ {
+ alwaysSwap = TRUE;
+ }
else if (*argv[i] == '-')
{
compLogMessage ("core", CompLogLevelWarn,