aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgthreadedrenderloop.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2022-01-18 15:36:58 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2022-01-20 19:33:02 +0100
commit03357bf77b682e7b0f7402da4ab3922dd09e5b78 (patch)
tree7c4977c6900b9ddc4a34ad6ba733ad8f93cbcf69 /src/quick/scenegraph/qsgthreadedrenderloop.cpp
parent82e8dbb8b724a18a1b7ca8ad1a9e1df9ec353682 (diff)
sg: combine logic in fallback timer and animation driver
Use the animation driver subclass as the only place that calculates the vsync interval. Do not replicate (in a slightly different way) the same logic in the threaded render loop. Make it possible to query this value via the context interface. Also fix up some types. Change-Id: I80257499ad95d3c043f5467c0b8d5b107f0c06a1 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgthreadedrenderloop.cpp')
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 6ddc6a5c9d..fb0289b9ac 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -119,15 +119,6 @@ QT_BEGIN_NAMESPACE
#define QSG_RT_PAD " (RT) %s"
-static inline int qsgrl_animation_interval() {
- qreal refreshRate = QGuiApplication::primaryScreen()->refreshRate();
- // To work around that some platforms wrongfully return 0 or something
- // bogus for refreshrate
- if (refreshRate < 1)
- return 16;
- return int(1000 / refreshRate);
-}
-
extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
// RL: Render Loop
@@ -1127,7 +1118,7 @@ void QSGThreadedRenderLoop::startOrStopAnimationTimer()
} else if (m_animation_timer == 0 && !canUseVSyncBasedAnimation && m_animation_driver->isRunning()) {
qCDebug(QSG_LOG_RENDERLOOP, "*** Starting non-render thread animation timer (exposedWindows=%d unthrottledWindows=%d)",
exposedWindows, unthrottledWindows);
- m_animation_timer = startTimer(qsgrl_animation_interval());
+ m_animation_timer = startTimer(int(sg->vsyncIntervalForAnimationDriver(m_animation_driver)));
}
}