tidy up
REVIEW: 109785
This commit is contained in:
parent
b7e6a334da
commit
69ef2f9c16
4 changed files with 3 additions and 35 deletions
|
@ -88,7 +88,6 @@ Compositor::Compositor(QObject* workspace)
|
|||
, forceUnredirectCheck(false)
|
||||
, m_finishing(false)
|
||||
, m_timeSinceLastVBlank(0)
|
||||
, m_nextFrameDelay(0)
|
||||
, m_scene(NULL)
|
||||
{
|
||||
qRegisterMetaType<Compositor::SuspendReason>("Compositor::SuspendReason");
|
||||
|
@ -669,18 +668,15 @@ void Compositor::setCompositeTimer()
|
|||
}
|
||||
|
||||
if (padding < options->vBlankTime()) { // we'll likely miss this frame
|
||||
m_nextFrameDelay = nanoToMilli(padding + vBlankInterval);
|
||||
waitTime = nanoToMilli(padding + vBlankInterval - options->vBlankTime()); // so we add one
|
||||
// qDebug() << "WE LOST A FRAME";
|
||||
} else {
|
||||
m_nextFrameDelay = nanoToMilli(padding);
|
||||
waitTime = nanoToMilli(padding - options->vBlankTime());
|
||||
}
|
||||
}
|
||||
else // w/o vsync we just jump to the next demanded tick
|
||||
// the "1" will ensure we don't block out the eventloop - the system's just not faster
|
||||
// "0" would be sufficient, but the compositor isn't the WMs only task
|
||||
m_nextFrameDelay = waitTime = (m_timeSinceLastVBlank > fpsInterval) ? 1 : nanoToMilli(fpsInterval - m_timeSinceLastVBlank);
|
||||
waitTime = (m_timeSinceLastVBlank > fpsInterval) ? 1 : nanoToMilli(fpsInterval - m_timeSinceLastVBlank);
|
||||
compositeTimer.start(qMin(waitTime, 250u), this); // force 4fps minimum
|
||||
}
|
||||
|
||||
|
|
|
@ -97,12 +97,7 @@ public:
|
|||
return m_xrrRefreshRate;
|
||||
}
|
||||
void setCompositeResetTimer(int msecs);
|
||||
// returns the _estimated_ delay to the next screen update
|
||||
// good for having a rough idea to calculate transformations, bad to rely on.
|
||||
// might happen few ms earlier, might be an entire frame to short. This is NOT deterministic.
|
||||
int nextFrameDelay() const {
|
||||
return m_nextFrameDelay;
|
||||
}
|
||||
|
||||
bool hasScene() const {
|
||||
return m_scene != NULL;
|
||||
}
|
||||
|
@ -307,7 +302,6 @@ private:
|
|||
bool m_finishing; // finish() sets this variable while shutting down
|
||||
bool m_starting; // start() sets this variable while starting
|
||||
qint64 m_timeSinceLastVBlank;
|
||||
int m_nextFrameDelay;
|
||||
Scene *m_scene;
|
||||
|
||||
KWIN_SINGLETON_VARIABLE(Compositor, s_compositor)
|
||||
|
|
|
@ -368,15 +368,10 @@ void GlxBackend::setSwapInterval(int interval)
|
|||
glXSwapIntervalSGI(interval);
|
||||
}
|
||||
|
||||
#define VSYNC_DEBUG 0
|
||||
|
||||
void GlxBackend::waitSync()
|
||||
{
|
||||
// NOTE that vsync has no effect with indirect rendering
|
||||
if (haveWaitSync) {
|
||||
#if VSYNC_DEBUG
|
||||
startRenderTimer();
|
||||
#endif
|
||||
uint sync;
|
||||
#if 0
|
||||
// TODO: why precisely is this important?
|
||||
|
@ -386,25 +381,11 @@ void GlxBackend::waitSync()
|
|||
glXWaitVideoSync(2, (sync + 1) % 2, &sync);
|
||||
#else
|
||||
glXWaitVideoSync(1, 0, &sync);
|
||||
#endif
|
||||
#if VSYNC_DEBUG
|
||||
static int waitTime = 0, waitCounter = 0, doubleSyncCounter = 0;
|
||||
if (renderTime() > 11)
|
||||
++doubleSyncCounter;
|
||||
waitTime += renderTime();
|
||||
++waitCounter;
|
||||
if (waitCounter > 99)
|
||||
{
|
||||
qDebug() << "mean vsync wait time:" << float((float)waitTime / (float)waitCounter) << doubleSyncCounter << "/100";
|
||||
doubleSyncCounter = waitTime = waitCounter = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
startRenderTimer(); // yes, the framerate shall be constant anyway.
|
||||
}
|
||||
|
||||
#undef VSYNC_DEBUG
|
||||
|
||||
void GlxBackend::present()
|
||||
{
|
||||
const QRegion displayRegion(0, 0, displayWidth(), displayHeight());
|
||||
|
|
|
@ -162,10 +162,7 @@ void Scene::updateTimeDiff()
|
|||
last_time.start();
|
||||
} else
|
||||
|
||||
// the extra wspace->nextFrameDelay() basically means that we lie to the effect about the passed
|
||||
// time - as a result the (animated) effect will run up to a frame shorter but in return stick
|
||||
// closer to the runtime from the trigger
|
||||
time_diff = last_time.restart()/* + wspace->nextFrameDelay()*/;
|
||||
time_diff = last_time.restart();
|
||||
|
||||
if (time_diff < 0) // check time rollback
|
||||
time_diff = 1;
|
||||
|
|
Loading…
Reference in a new issue