diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-09-06 16:06:30 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-09-07 11:48:30 +0200 |
commit | 27d674e9ec226559bb6a18085f570928e277fa1e (patch) | |
tree | c637848e6d5578d9abfeb8ff1f6678e7e9534ee3 | |
parent | c0f16df6d8ddc66afd3528f18f20c65130df3de6 (diff) |
threaded renderloop: Do not abort with sleep when no changes after sync
Task-number: QTBUG-86089
Change-Id: If1b3369d49b5088b78f683d7512b156af3765bce
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index a47aa4f359..ff3bacf0e4 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -735,23 +735,16 @@ void QSGRenderThread::syncAndRender(QImage *grabImage) Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame, QQuickProfiler::SceneGraphRenderLoopSync); - if (!syncResultedInChanges - && !repaintRequested - && !(pendingUpdate & RepaintRequest) // may have been set in sync() - && sgrc->isValid() - && !grabRequested - && 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; - } + // Qt 6 no longer aborts when !syncResultedInChanges && !RepaintRequest, + // meaning this function always completes and presents a frame. This is + // more compatible with what the basic render loop (or a custom loop with + // QQuickRenderControl) would do, is more accurate due to not having to do + // an msleep() with an inaccurate interval, and avoids misunderstandings + // for signals like frameSwapped(). (in Qt 5 a continuously "updating" + // window is continuously presenting frames with the basic loop, but not + // with threaded due to aborting when sync() finds there are no relevant + // visual changes in the scene graph; this system proved to be simply too + // confusing in practice) qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- rendering started"); |