fix conditional glXSwapInterval usage

and cleanup profiling relics

REVIEW: 105632
BUG: 303397
(cherry picked from commit 0babc455aea4f5099a4f829668160bda3ef68a28)
This commit is contained in:
Thomas Lübking 2012-07-18 01:50:43 +02:00
parent 498783c66b
commit 35baf3f97a
2 changed files with 8 additions and 8 deletions

View file

@ -392,8 +392,8 @@ void Workspace::timerEvent(QTimerEvent *te)
} else
QObject::timerEvent(te);
}
static bool s_pending = false;
QElapsedTimer profiler;
void Workspace::performCompositing()
{
if (!scene->overlayWindow()->isVisible())
@ -408,7 +408,6 @@ void Workspace::performCompositing()
// Otherwise the window would not be painted normally anyway.
return;
}
profiler.start();
s_pending = pending;
// create a list of all windows in the stacking order
ToplevelList windows = xStackingOrder();

View file

@ -514,18 +514,19 @@ void SceneOpenGL::waitSync()
// but this only leads to waiting for two frames??!?
glXGetVideoSync(&sync);
glXWaitVideoSync(2, (sync + 1) % 2, &sync);
#endif
#else
glXWaitVideoSync(1, 0, &sync);
#endif
#if VSYNC_DEBUG
static int waitTime = 0, waitCounter = 0, crapCounter = 0;
static int waitTime = 0, waitCounter = 0, doubleSyncCounter = 0;
if (m_renderTimer.elapsed() > 11)
++crapCounter;
++doubleSyncCounter;
waitTime += m_renderTimer.elapsed();
++waitCounter;
if (waitCounter > 99)
{
qDebug() << "mean vsync wait time:" << float((float)waitTime / (float)waitCounter) << crapCounter << "/100";
crapCounter = waitTime = waitCounter = 0;
qDebug() << "mean vsync wait time:" << float((float)waitTime / (float)waitCounter) << doubleSyncCounter << "/100";
doubleSyncCounter = waitTime = waitCounter = 0;
}
#endif
}
@ -590,7 +591,7 @@ void SceneOpenGL::flushBuffer(int mask, QRegion damage)
}
} else {
if (glXSwapInterval) {
glXSwapInterval(1);
glXSwapInterval(options->isGlVSync() ? 1 : 0);
glXSwapBuffers(display(), glxbuffer);
glXSwapInterval(0);
m_renderTimer.start(); // this is important so we don't assume to be loosing frames in the compositor timing calculation