aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-05-09 17:35:49 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-05-11 08:44:20 +0200
commit662432801141b723792818d4639523e0b240e4ee (patch)
tree93b4568cb6f9d48e762845e1bcceb95c8990b605 /src/quick/scenegraph
parent8c9b7de4c6dd7532e99a068083d0eb6c70aa49a3 (diff)
Allow aborting syncAndRender() when sync results in no changes
This is the behavior with direct OpenGL. With QRhi, we avoided returning early because QRhi::beginFrame() was already called, so rendering the frame seemed like a better choice, at first at least. (the SkipPresent flag was likely introduced at a later point) Now we just do an endFrame() with SkipPresent set, and then return without moving on to the rendering phase. This fixes the noUpdateWhenNothingChanges case in the qquickwindow autotest. Additionally, it is suspected that this also fixes the qquicklayout auto test failures: there we have tests that wait for the frameSwapped() signal. Until now we did not abort the update when sync resulted in no changes (with RHI), which confuses said tests because there is an unexpected frameSwapped() signal emitted. Change-Id: Id6a859d27a525ed2c16c6b331b1ad5debabfcd77 Reviewed-by: Christian Strømme <christian.stromme@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 2fc2ef43a2..20ed00664a 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -793,12 +793,16 @@ void QSGRenderThread::syncAndRender(QImage *grabImage)
&& !(pendingUpdate & RepaintRequest) // may have been set in sync()
&& sgrc->isValid()
&& !grabRequested
- && (gl || (rhi && !rhi->isRecordingFrame())))
+ && (gl || rhi))
{
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- no changes, render aborted");
+ if (rhi && rhi->isRecordingFrame())
+ rhi->endFrame(cd->swapchain, QRhi::SkipPresent);
+
int waitTime = vsyncDelta - (int) waitTimer.elapsed();
if (waitTime > 0)
msleep(waitTime);
+
return;
}