aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2017-03-02 15:25:07 +0100
committerDominik Holland <dominik.holland@pelagicore.com>2017-06-16 06:59:04 +0000
commiteeb320bbd8763f3e72f79369cc3908e999a0da3c (patch)
treec0dedd87c84fc5f6e943d5efc121c20ec4ee27c2 /src/quick/scenegraph
parentd2bb2e202427ebae545a408f065c893f3d837061 (diff)
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>
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp1
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp2
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp12
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp1
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp10
5 files changed, 26 insertions, 0 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
index 962db20cbc..3f0d1383b9 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
@@ -149,6 +149,7 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose)
emit window->afterAnimating();
cd->syncSceneGraph();
+ rc->endSync();
if (profileFrames)
syncTime = renderTimer.nsecsElapsed();
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
index 71db35377e..19f16a79fb 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
@@ -330,6 +330,7 @@ bool QSGSoftwareRenderThread::event(QEvent *e)
softwareRenderer->setBackingStore(backingStore);
rc->initialize(nullptr);
wd->syncSceneGraph();
+ rc->endSync();
wd->renderSceneGraph(wme->window->size());
*wme->image = backingStore->handle()->toImage();
}
@@ -443,6 +444,7 @@ void QSGSoftwareRenderThread::sync(bool inExpose)
rc->initialize(nullptr);
wd->syncSceneGraph();
+ rc->endSync();
if (!hadRenderer && wd->renderer) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "RT - created renderer");
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index c27700cf84..bc65dc1bc3 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -380,6 +380,16 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
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;
@@ -407,6 +417,8 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
emit window->afterAnimating();
cd->syncSceneGraph();
+ if (lastDirtyWindow)
+ rc->endSync();
if (profileFrames)
syncTime = renderTimer.nsecsElapsed();
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 2364fb714c..3a8e673c0d 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -425,6 +425,7 @@ 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());
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index e16f7ea966..e10e52d95e 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -445,6 +445,14 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
}
}
+ 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))
@@ -464,6 +472,8 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
RLDEBUG(" - syncing");
d->syncSceneGraph();
+ if (lastDirtyWindow)
+ m_rc->endSync();
QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_synced,
QQuickProfiler::SceneGraphRenderLoopSync);