From d3b0bd40ec2a2741e35e19250205af2d632a0a52 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 13 Apr 2015 10:18:22 +0200 Subject: 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 --- src/quick/scenegraph/qsgwindowsrenderloop.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/quick/scenegraph') 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 #include +#include #include #include @@ -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(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); -- cgit v1.2.3