From 69ef2f9c167eb43c0c28d0909bfc99fb9a5b1494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Wed, 10 Apr 2013 22:14:17 +0200 Subject: [PATCH] tidy up REVIEW: 109785 --- composite.cpp | 6 +----- composite.h | 8 +------- glxbackend.cpp | 19 ------------------- scene.cpp | 5 +---- 4 files changed, 3 insertions(+), 35 deletions(-) diff --git a/composite.cpp b/composite.cpp index 4884a7032b..d82be84d5b 100644 --- a/composite.cpp +++ b/composite.cpp @@ -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"); @@ -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 } diff --git a/composite.h b/composite.h index c9ba1ef120..b4158faf7c 100644 --- a/composite.h +++ b/composite.h @@ -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) diff --git a/glxbackend.cpp b/glxbackend.cpp index 8518b949f8..95d0b3931e 100644 --- a/glxbackend.cpp +++ b/glxbackend.cpp @@ -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()); diff --git a/scene.cpp b/scene.cpp index 71ebaaea60..64cb507d2e 100644 --- a/scene.cpp +++ b/scene.cpp @@ -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;