forked from pool/libqt5-qtdeclarative
080f03fa43
Qt 5.9.2 OBS-URL: https://build.opensuse.org/request/show/533796 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtdeclarative?expand=0&rev=43
222 lines
10 KiB
Diff
222 lines
10 KiB
Diff
From eeb320bbd8763f3e72f79369cc3908e999a0da3c Mon Sep 17 00:00:00 2001
|
|
From: Dominik Holland <dominik.holland@pelagicore.com>
|
|
Date: Thu, 2 Mar 2017 15:25:07 +0100
|
|
Subject: [PATCH] Delay the deletion of QSGTextures until all windows are
|
|
synchronized
|
|
|
|
With the 'basic' and the 'windows' render loop the scene graph
|
|
context is shared. Because of this we cannot start deleting textures
|
|
after the first window is synchronized as it may contain textures
|
|
needed by the another window, which is not yet synchronized.
|
|
|
|
QWindowPrivate::syncSceneGraph() is not calling endSync() anymore
|
|
as it doesn't know whether it is the last window or not. Instead
|
|
the renderloop is now responsible for calling endSync() once this
|
|
is safe to do.
|
|
|
|
Change-Id: Icb50ebfb447c928e38b41df7e26f3bfafdb4a811
|
|
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
|
|
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
|
|
---
|
|
src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp | 1 +
|
|
src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp | 2 ++
|
|
src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp | 1 +
|
|
src/quick/items/qquickrendercontrol.cpp | 3 +++
|
|
src/quick/items/qquickwindow.cpp | 2 --
|
|
.../adaptations/software/qsgsoftwarerenderloop.cpp | 1 +
|
|
.../adaptations/software/qsgsoftwarethreadedrenderloop.cpp | 2 ++
|
|
src/quick/scenegraph/qsgrenderloop.cpp | 12 ++++++++++++
|
|
src/quick/scenegraph/qsgthreadedrenderloop.cpp | 1 +
|
|
src/quick/scenegraph/qsgwindowsrenderloop.cpp | 10 ++++++++++
|
|
10 files changed, 33 insertions(+), 2 deletions(-)
|
|
|
|
Index: qtdeclarative-opensource-src-5.9.2/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp
|
|
===================================================================
|
|
--- qtdeclarative-opensource-src-5.9.2.orig/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp
|
|
+++ qtdeclarative-opensource-src-5.9.2/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp
|
|
@@ -461,7 +461,6 @@ void QSGD3D12RenderLoop::renderWindow(QQ
|
|
data.rc->initialize(nullptr);
|
|
|
|
wd->syncSceneGraph();
|
|
- data.rc->endSync();
|
|
|
|
if (profileFrames)
|
|
syncTime = renderTimer.nsecsElapsed();
|
|
Index: qtdeclarative-opensource-src-5.9.2/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
|
|
===================================================================
|
|
--- qtdeclarative-opensource-src-5.9.2.orig/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
|
|
+++ qtdeclarative-opensource-src-5.9.2/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
|
|
@@ -410,7 +410,6 @@ bool QSGD3D12RenderThread::event(QEvent
|
|
QQuickWindowPrivate *wd = QQuickWindowPrivate::get(wme->window);
|
|
rc->initialize(nullptr);
|
|
wd->syncSceneGraph();
|
|
- rc->endSync();
|
|
wd->renderSceneGraph(wme->window->size());
|
|
*wme->image = engine->executeAndWaitReadbackRenderTarget();
|
|
}
|
|
@@ -546,7 +545,6 @@ void QSGD3D12RenderThread::sync(bool inE
|
|
|
|
rc->initialize(nullptr);
|
|
wd->syncSceneGraph();
|
|
- rc->endSync();
|
|
|
|
if (!hadRenderer && wd->renderer) {
|
|
if (Q_UNLIKELY(debug_loop()))
|
|
Index: qtdeclarative-opensource-src-5.9.2/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
|
|
===================================================================
|
|
--- qtdeclarative-opensource-src-5.9.2.orig/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
|
|
+++ qtdeclarative-opensource-src-5.9.2/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
|
|
@@ -205,7 +205,6 @@ void QSGOpenVGRenderLoop::renderWindow(Q
|
|
emit window->afterAnimating();
|
|
|
|
cd->syncSceneGraph();
|
|
- rc->endSync();
|
|
|
|
if (profileFrames)
|
|
syncTime = renderTimer.nsecsElapsed();
|
|
Index: qtdeclarative-opensource-src-5.9.2/src/quick/items/qquickrendercontrol.cpp
|
|
===================================================================
|
|
--- qtdeclarative-opensource-src-5.9.2.orig/src/quick/items/qquickrendercontrol.cpp
|
|
+++ qtdeclarative-opensource-src-5.9.2/src/quick/items/qquickrendercontrol.cpp
|
|
@@ -284,7 +284,6 @@ bool QQuickRenderControl::sync()
|
|
|
|
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window);
|
|
cd->syncSceneGraph();
|
|
- d->rc->endSync();
|
|
|
|
// TODO: find out if the sync actually caused a scenegraph update.
|
|
return true;
|
|
@@ -384,7 +383,6 @@ QImage QQuickRenderControl::grab()
|
|
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window);
|
|
cd->polishItems();
|
|
cd->syncSceneGraph();
|
|
- d->rc->endSync();
|
|
render();
|
|
grabContent = qt_gl_read_framebuffer(d->window->size() * d->window->effectiveDevicePixelRatio(), false, false);
|
|
if (QQuickRenderControl::renderWindowFor(d->window)) {
|
|
@@ -404,7 +402,6 @@ QImage QQuickRenderControl::grab()
|
|
softwareRenderer->markDirty();
|
|
cd->polishItems();
|
|
cd->syncSceneGraph();
|
|
- d->rc->endSync();
|
|
render();
|
|
softwareRenderer->setCurrentPaintDevice(prevDev);
|
|
}
|
|
Index: qtdeclarative-opensource-src-5.9.2/src/quick/items/qquickwindow.cpp
|
|
===================================================================
|
|
--- qtdeclarative-opensource-src-5.9.2.orig/src/quick/items/qquickwindow.cpp
|
|
+++ qtdeclarative-opensource-src-5.9.2/src/quick/items/qquickwindow.cpp
|
|
@@ -432,8 +432,10 @@ void QQuickWindowPrivate::syncSceneGraph
|
|
|
|
emit q->afterSynchronizing();
|
|
runAndClearJobs(&afterSynchronizingJobs);
|
|
+ context->endSync();
|
|
}
|
|
|
|
+
|
|
void QQuickWindowPrivate::renderSceneGraph(const QSize &size)
|
|
{
|
|
QML_MEMORY_SCOPE_STRING("SceneGraph");
|
|
Index: qtdeclarative-opensource-src-5.9.2/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
|
|
===================================================================
|
|
--- qtdeclarative-opensource-src-5.9.2.orig/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
|
|
+++ qtdeclarative-opensource-src-5.9.2/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
|
|
@@ -149,7 +149,6 @@ void QSGSoftwareRenderLoop::renderWindow
|
|
emit window->afterAnimating();
|
|
|
|
cd->syncSceneGraph();
|
|
- rc->endSync();
|
|
|
|
if (profileFrames)
|
|
syncTime = renderTimer.nsecsElapsed();
|
|
Index: qtdeclarative-opensource-src-5.9.2/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
|
|
===================================================================
|
|
--- qtdeclarative-opensource-src-5.9.2.orig/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
|
|
+++ qtdeclarative-opensource-src-5.9.2/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
|
|
@@ -330,7 +330,6 @@ bool QSGSoftwareRenderThread::event(QEve
|
|
softwareRenderer->setBackingStore(backingStore);
|
|
rc->initialize(nullptr);
|
|
wd->syncSceneGraph();
|
|
- rc->endSync();
|
|
wd->renderSceneGraph(wme->window->size());
|
|
*wme->image = backingStore->handle()->toImage();
|
|
}
|
|
@@ -444,7 +443,6 @@ void QSGSoftwareRenderThread::sync(bool
|
|
|
|
rc->initialize(nullptr);
|
|
wd->syncSceneGraph();
|
|
- rc->endSync();
|
|
|
|
if (!hadRenderer && wd->renderer) {
|
|
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "RT - created renderer");
|
|
Index: qtdeclarative-opensource-src-5.9.2/src/quick/scenegraph/qsgrenderloop.cpp
|
|
===================================================================
|
|
--- qtdeclarative-opensource-src-5.9.2.orig/src/quick/scenegraph/qsgrenderloop.cpp
|
|
+++ qtdeclarative-opensource-src-5.9.2/src/quick/scenegraph/qsgrenderloop.cpp
|
|
@@ -381,16 +381,6 @@ void QSGGuiThreadRenderLoop::renderWindo
|
|
bool alsoSwap = data.updatePending;
|
|
data.updatePending = false;
|
|
|
|
- bool lastDirtyWindow = true;
|
|
- auto i = m_windows.constBegin();
|
|
- while (i != m_windows.constEnd()) {
|
|
- if (i.value().updatePending) {
|
|
- lastDirtyWindow = false;
|
|
- break;
|
|
- }
|
|
- i++;
|
|
- }
|
|
-
|
|
if (!current)
|
|
return;
|
|
|
|
@@ -418,8 +408,6 @@ void QSGGuiThreadRenderLoop::renderWindo
|
|
emit window->afterAnimating();
|
|
|
|
cd->syncSceneGraph();
|
|
- if (lastDirtyWindow)
|
|
- rc->endSync();
|
|
|
|
if (profileFrames)
|
|
syncTime = renderTimer.nsecsElapsed();
|
|
Index: qtdeclarative-opensource-src-5.9.2/src/quick/scenegraph/qsgthreadedrenderloop.cpp
|
|
===================================================================
|
|
--- qtdeclarative-opensource-src-5.9.2.orig/src/quick/scenegraph/qsgthreadedrenderloop.cpp
|
|
+++ qtdeclarative-opensource-src-5.9.2/src/quick/scenegraph/qsgthreadedrenderloop.cpp
|
|
@@ -432,7 +432,6 @@ bool QSGRenderThread::event(QEvent *e)
|
|
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- sync scene graph";
|
|
QQuickWindowPrivate *d = QQuickWindowPrivate::get(ce->window);
|
|
d->syncSceneGraph();
|
|
- sgrc->endSync();
|
|
|
|
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- rendering scene graph";
|
|
QQuickWindowPrivate::get(ce->window)->renderSceneGraph(ce->window->size());
|
|
Index: qtdeclarative-opensource-src-5.9.2/src/quick/scenegraph/qsgwindowsrenderloop.cpp
|
|
===================================================================
|
|
--- qtdeclarative-opensource-src-5.9.2.orig/src/quick/scenegraph/qsgwindowsrenderloop.cpp
|
|
+++ qtdeclarative-opensource-src-5.9.2/src/quick/scenegraph/qsgwindowsrenderloop.cpp
|
|
@@ -446,14 +446,6 @@ void QSGWindowsRenderLoop::renderWindow(
|
|
}
|
|
}
|
|
|
|
- bool lastDirtyWindow = true;
|
|
- for (int i=0; i<m_windows.size(); ++i) {
|
|
- if ( m_windows[i].pendingUpdate) {
|
|
- lastDirtyWindow = false;
|
|
- break;
|
|
- }
|
|
- }
|
|
-
|
|
d->flushFrameSynchronousEvents();
|
|
// Event delivery or processing has caused the window to stop rendering.
|
|
if (!windowData(window))
|
|
@@ -473,8 +465,6 @@ void QSGWindowsRenderLoop::renderWindow(
|
|
|
|
RLDEBUG(" - syncing");
|
|
d->syncSceneGraph();
|
|
- if (lastDirtyWindow)
|
|
- m_rc->endSync();
|
|
QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_synced,
|
|
QQuickProfiler::SceneGraphRenderLoopSync);
|
|
|