aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-04-13 10:18:22 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-04-13 10:20:40 +0000
commitd3b0bd40ec2a2741e35e19250205af2d632a0a52 (patch)
treea1d0d08409197d516b9dfa45f365df684b602428 /src/quick
parentf7e1f7b2f1f1577fd94dfffb93ef15ded5d09031 (diff)
Avoid running anims at 3x speed on Windows
When there is no render pending, renderWindow() is not called and so there is no blocking for vsync. Advancing the animations without any sleep is wrong in this case and results in animations running at 3x speed in case there is no change in the scenegraph contents. To solve this, import the threaded render loop's sleep call. Task-number: QTBUG-42699 Change-Id: I3658a827af12d4bc2ac05c7b0b29c65e9fc99675 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index b88d21ce66..0e22fa8b7b 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -35,6 +35,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QLibraryInfo>
+#include <QtCore/QThread>
#include <QtGui/QScreen>
#include <QtGui/QGuiApplication>
@@ -355,13 +356,20 @@ bool QSGWindowsRenderLoop::event(QEvent *event)
void QSGWindowsRenderLoop::render()
{
RLDEBUG("render");
+ bool rendered = false;
foreach (const WindowData &wd, m_windows) {
if (wd.pendingUpdate) {
const_cast<WindowData &>(wd).pendingUpdate = false;
renderWindow(wd.window);
+ rendered = true;
}
}
+ if (!rendered) {
+ RLDEBUG("no changes, sleep");
+ QThread::msleep(m_vsyncDelta);
+ }
+
if (m_animationDriver->isRunning()) {
RLDEBUG("advancing animations");
QSG_LOG_TIME_SAMPLE(time_start);