fix conditional glXSwapInterval usage
and cleanup profiling relics REVIEW: 105632 BUG: 303397 (cherry picked from commit 0babc455aea4f5099a4f829668160bda3ef68a28)
This commit is contained in:
parent
498783c66b
commit
35baf3f97a
2 changed files with 8 additions and 8 deletions
|
@ -392,8 +392,8 @@ void Workspace::timerEvent(QTimerEvent *te)
|
||||||
} else
|
} else
|
||||||
QObject::timerEvent(te);
|
QObject::timerEvent(te);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool s_pending = false;
|
static bool s_pending = false;
|
||||||
QElapsedTimer profiler;
|
|
||||||
void Workspace::performCompositing()
|
void Workspace::performCompositing()
|
||||||
{
|
{
|
||||||
if (!scene->overlayWindow()->isVisible())
|
if (!scene->overlayWindow()->isVisible())
|
||||||
|
@ -408,7 +408,6 @@ void Workspace::performCompositing()
|
||||||
// Otherwise the window would not be painted normally anyway.
|
// Otherwise the window would not be painted normally anyway.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
profiler.start();
|
|
||||||
s_pending = pending;
|
s_pending = pending;
|
||||||
// create a list of all windows in the stacking order
|
// create a list of all windows in the stacking order
|
||||||
ToplevelList windows = xStackingOrder();
|
ToplevelList windows = xStackingOrder();
|
||||||
|
|
|
@ -514,18 +514,19 @@ void SceneOpenGL::waitSync()
|
||||||
// but this only leads to waiting for two frames??!?
|
// but this only leads to waiting for two frames??!?
|
||||||
glXGetVideoSync(&sync);
|
glXGetVideoSync(&sync);
|
||||||
glXWaitVideoSync(2, (sync + 1) % 2, &sync);
|
glXWaitVideoSync(2, (sync + 1) % 2, &sync);
|
||||||
#endif
|
#else
|
||||||
glXWaitVideoSync(1, 0, &sync);
|
glXWaitVideoSync(1, 0, &sync);
|
||||||
|
#endif
|
||||||
#if VSYNC_DEBUG
|
#if VSYNC_DEBUG
|
||||||
static int waitTime = 0, waitCounter = 0, crapCounter = 0;
|
static int waitTime = 0, waitCounter = 0, doubleSyncCounter = 0;
|
||||||
if (m_renderTimer.elapsed() > 11)
|
if (m_renderTimer.elapsed() > 11)
|
||||||
++crapCounter;
|
++doubleSyncCounter;
|
||||||
waitTime += m_renderTimer.elapsed();
|
waitTime += m_renderTimer.elapsed();
|
||||||
++waitCounter;
|
++waitCounter;
|
||||||
if (waitCounter > 99)
|
if (waitCounter > 99)
|
||||||
{
|
{
|
||||||
qDebug() << "mean vsync wait time:" << float((float)waitTime / (float)waitCounter) << crapCounter << "/100";
|
qDebug() << "mean vsync wait time:" << float((float)waitTime / (float)waitCounter) << doubleSyncCounter << "/100";
|
||||||
crapCounter = waitTime = waitCounter = 0;
|
doubleSyncCounter = waitTime = waitCounter = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -590,7 +591,7 @@ void SceneOpenGL::flushBuffer(int mask, QRegion damage)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (glXSwapInterval) {
|
if (glXSwapInterval) {
|
||||||
glXSwapInterval(1);
|
glXSwapInterval(options->isGlVSync() ? 1 : 0);
|
||||||
glXSwapBuffers(display(), glxbuffer);
|
glXSwapBuffers(display(), glxbuffer);
|
||||||
glXSwapInterval(0);
|
glXSwapInterval(0);
|
||||||
m_renderTimer.start(); // this is important so we don't assume to be loosing frames in the compositor timing calculation
|
m_renderTimer.start(); // this is important so we don't assume to be loosing frames in the compositor timing calculation
|
||||||
|
|
Loading…
Reference in a new issue