Commit 0babc455 authored by Thomas Lübking's avatar Thomas Lübking
Browse files

fix conditional glXSwapInterval usage

and cleanup profiling relics

REVIEW: 105632
BUG: 303397
parent e3edcbcf
......@@ -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();
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment