diff options
author | Alan Alpert <aalpert@blackberry.com> | 2013-05-31 10:38:33 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-07 19:09:33 +0200 |
commit | 9d75626b1073113d77988bcb52e99215d5af4787 (patch) | |
tree | b42ad298daaae258a405367da1c9fd0d56d3013c /src/quick/scenegraph/qsgthreadedrenderloop.cpp | |
parent | cfd4bf9d6cb8a932eab5ac99bae8973b9cedc803 (diff) |
Set incubation controller when a Window{} is loaded via QQmlApplicationEngine
This was the one convenience that was lost when transitioning templates
from QQuickView + Item{} to QQmlApplicationEngine + Window{}.
As the default window incubation controller was tied to the first
window's frameSwapped, we could easily run into a situation where
a secondary window required incubation while the first window
was idle. This would then starve the incubation controller. Instead
make it so that the renderloop emits "timeToIncubate" once it
is done with a renderpass over all windows, so the incubator
gets to run once and exactly once per vsync when animating.
The incubator logic was also flawed in that it could post
a lot of events to itself as a result of incubatingObjectCountChanged
and thus starve system events while processing incubation requests.
Now we start a timer and don't start it again until we have
completed an incubation pass.
Task-number: QTBUG-31203
Change-Id: Iea9e2c81efb46bb7875c70ccda0cdc4b3b3e58e7
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgthreadedrenderloop.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index bd69fd5464..bfd9a2fb20 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -574,6 +574,7 @@ void QSGRenderThread::syncAndRender() int waitTime = vsyncDelta - (int) waitTimer.elapsed(); if (waitTime > 0) msleep(waitTime); + emit wm->timeToIncubate(); return; } @@ -600,6 +601,7 @@ void QSGRenderThread::syncAndRender() d->fireFrameSwapped(); } RLDEBUG(" Render: - rendering done"); + emit wm->timeToIncubate(); #ifndef QSG_NO_RENDER_TIMING if (qsg_render_timing) @@ -723,7 +725,7 @@ QSGContext *QSGThreadedRenderLoop::sceneGraphContext() const return m_thread->sg; } -bool QSGThreadedRenderLoop::anyoneShowing() +bool QSGThreadedRenderLoop::anyoneShowing() const { for (int i=0; i<m_windows.size(); ++i) { QQuickWindow *c = m_windows.at(i).window; @@ -733,6 +735,11 @@ bool QSGThreadedRenderLoop::anyoneShowing() return false; } +bool QSGThreadedRenderLoop::interleaveIncubation() const +{ + return m_animation_driver->isRunning() && anyoneShowing(); +} + void QSGThreadedRenderLoop::animationStarted() { RLDEBUG("GUI: animationStarted()"); @@ -1011,7 +1018,6 @@ void QSGThreadedRenderLoop::polishAndSync() RLDEBUG("GUI: - animations advancing"); m_animation_driver->advance(); RLDEBUG("GUI: - animations done"); - // We need to trigger another sync to keep animations running... maybePostPolishRequest(); } else if (m_sync_triggered_update) { |