aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-11-26 12:53:14 +0100
committerUlf Hermann <ulf.hermann@qt.io>2016-11-28 12:24:13 +0100
commit9044800083ccffe4d0b732f8b3b60512f32d8f8a (patch)
treecdd6d2038d53e99a5a9326be6b47a68553830480 /src/quick
parent8bf579d8d4feb13ca8651e98dd762b28483abe9e (diff)
parentcc1c3d0e2be6dfea6befebdc5f25e519e3fe79b2 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
The renderers added in 5.8 had to be adapted to the changed profiling macros from 5.6. Conflicts: src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp src/quick/util/qquickprofiler_p.h tests/auto/qml/qjsengine/tst_qjsengine.cpp tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp Change-Id: Icb370b7c95aab12589ad73881ac6d178759a5c6b
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquicktextnode.cpp8
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp12
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp24
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp6
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer.cpp12
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer.cpp4
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp12
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp24
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp21
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp17
-rw-r--r--src/quick/scenegraph/util/qsgtexture.cpp18
-rw-r--r--src/quick/util/qquickprofiler_p.h141
12 files changed, 201 insertions, 98 deletions
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp
index 6cfc1d0313..e6ac9b603e 100644
--- a/src/quick/items/qquicktextnode.cpp
+++ b/src/quick/items/qquicktextnode.cpp
@@ -99,10 +99,12 @@ QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun
bool preferNativeGlyphNode = m_useNativeRenderer;
if (!preferNativeGlyphNode) {
QRawFontPrivate *fontPriv = QRawFontPrivate::get(font);
- if (fontPriv->fontEngine->hasUnreliableGlyphOutline())
+ if (fontPriv->fontEngine->hasUnreliableGlyphOutline()) {
preferNativeGlyphNode = true;
- else
- preferNativeGlyphNode = !QFontDatabase().isSmoothlyScalable(font.familyName(), font.styleName());
+ } else {
+ QFontEngine *fe = QRawFontPrivate::get(font)->fontEngine;
+ preferNativeGlyphNode = !fe->isSmoothlyScalable;
+ }
}
QSGGlyphNode *node = sg->sceneGraphContext()->createGlyphNode(sg, preferNativeGlyphNode);
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
index 19a963b403..6856d34616 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
@@ -143,7 +143,8 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
polishTime = renderTimer.nsecsElapsed();
Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
- QQuickProfiler::SceneGraphRenderLoopFrame);
+ QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphPolishPolish);
emit window->afterAnimating();
@@ -151,7 +152,8 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
syncTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSync);
//Tell the renderer about the windows backing store
auto softwareRenderer = static_cast<QSGSoftwareRenderer*>(cd->renderer);
@@ -162,7 +164,8 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
renderTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopRender);
if (data.grabOnly) {
grabContent = m_backingStores[window]->handle()->toImage();
@@ -178,7 +181,8 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window)
qint64 swapTime = 0;
if (profileFrames)
swapTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSwap);
if (QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled()) {
static QTime lastFrameTime = QTime::currentTime();
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
index 5d5485ed8f..df5ec9b745 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
@@ -484,7 +484,8 @@ void QSGSoftwareRenderThread::syncAndRender()
if (syncRequested)
sync(exposeRequested);
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSync);
if (!syncResultedInChanges && !repaintRequested) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "RT - no changes, render aborted");
@@ -510,7 +511,8 @@ void QSGSoftwareRenderThread::syncAndRender()
softwareRenderer->setBackingStore(backingStore);
wd->renderSceneGraph(exposedWindow->size());
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopRender);
if (softwareRenderer && (!wd->customRenderStage || !wd->customRenderStage->swap()))
backingStore->flush(softwareRenderer->flushRegion());
@@ -526,7 +528,8 @@ void QSGSoftwareRenderThread::syncAndRender()
wd->fireFrameSwapped();
} else {
- Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame, 1);
+ Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSync, 1);
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "RT - window not ready, skipping render");
}
@@ -538,7 +541,8 @@ void QSGSoftwareRenderThread::syncAndRender()
mutex.unlock();
}
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSwap);
}
template<class T> T *windowFor(const QVector<T> &list, QQuickWindow *window)
@@ -951,7 +955,8 @@ void QSGSoftwareThreadedRenderLoop::polishAndSync(QSGSoftwareThreadedRenderLoop:
QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window);
wd->polishItems();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncPolish);
w->updateDuringSync = false;
@@ -965,13 +970,15 @@ void QSGSoftwareThreadedRenderLoop::polishAndSync(QSGSoftwareThreadedRenderLoop:
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "polishAndSync - wait for sync");
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncWait);
w->thread->waitCondition.wait(&w->thread->mutex);
lockedForSync = false;
w->thread->mutex.unlock();
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "polishAndSync - unlock after sync");
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncSync);
if (!animationTimer && m_anim->isRunning()) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "polishAndSync - advancing animations");
@@ -983,7 +990,8 @@ void QSGSoftwareThreadedRenderLoop::polishAndSync(QSGSoftwareThreadedRenderLoop:
w->window->requestUpdate();
}
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncAnimations);
}
#include "qsgsoftwarethreadedrenderloop.moc"
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index 81aa641e03..6771c0e940 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -170,7 +170,8 @@ ShaderManager::Shader *ShaderManager::prepareMaterial(QSGMaterial *material)
qCDebug(QSG_LOG_TIME_COMPILATION, "shader compiled in %dms", (int) qsg_renderer_timer.elapsed());
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphContextFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphContextFrame,
+ QQuickProfiler::SceneGraphContextMaterialCompile);
rewrittenShaders[type] = shader;
return shader;
@@ -201,7 +202,8 @@ ShaderManager::Shader *ShaderManager::prepareMaterialNoRewrite(QSGMaterial *mate
qCDebug(QSG_LOG_TIME_COMPILATION, "shader compiled in %dms (no rewrite)", (int) qsg_renderer_timer.elapsed());
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphContextFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphContextFrame,
+ QQuickProfiler::SceneGraphContextMaterialCompile);
return shader;
}
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
index 220e6ab212..34cdfc0a6d 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
@@ -220,7 +220,8 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
bindable.bind();
if (profileFrames)
bindTime = frameTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame,
+ QQuickProfiler::SceneGraphRendererBinding);
#ifndef QT_NO_OPENGL
// Sanity check that attribute registers are disabled
@@ -240,7 +241,8 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
render();
if (profileFrames)
renderTime = frameTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRendererFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRendererFrame,
+ QQuickProfiler::SceneGraphRendererRender);
m_is_rendering = false;
m_changed_emitted = false;
@@ -304,13 +306,15 @@ void QSGRenderer::preprocess()
bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled();
if (profileFrames)
preprocessTime = frameTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame,
+ QQuickProfiler::SceneGraphRendererPreprocess);
nodeUpdater()->updateStates(root);
if (profileFrames)
updatePassTime = frameTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame,
+ QQuickProfiler::SceneGraphRendererUpdate);
}
void QSGRenderer::addNodesToPreprocess(QSGNode *node)
diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp
index 9923fa6e24..84ca09285a 100644
--- a/src/quick/scenegraph/qsgadaptationlayer.cpp
+++ b/src/quick/scenegraph/qsgadaptationlayer.cpp
@@ -189,7 +189,8 @@ void QSGDistanceFieldGlyphCache::update()
int count = m_pendingGlyphs.size();
if (profileFrames)
renderTime = qsg_render_timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphAdaptationLayerFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphAdaptationLayerFrame,
+ QQuickProfiler::SceneGraphAdaptationLayerGlyphRender);
m_pendingGlyphs.reset();
@@ -210,6 +211,7 @@ void QSGDistanceFieldGlyphCache::update()
int((now - (renderTime / 1000000))));
}
Q_QUICK_SG_PROFILE_END_WITH_PAYLOAD(QQuickProfiler::SceneGraphAdaptationLayerFrame,
+ QQuickProfiler::SceneGraphAdaptationLayerGlyphStore,
(qint64)count);
}
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index df7bbe6ceb..5bd1adc1f7 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -401,7 +401,8 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
polishTime = renderTimer.nsecsElapsed();
Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
- QQuickProfiler::SceneGraphRenderLoopFrame);
+ QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphPolishPolish);
emit window->afterAnimating();
@@ -409,13 +410,15 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
syncTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSync);
cd->renderSceneGraph(window->size());
if (profileFrames)
renderTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopRender);
if (data.grabOnly) {
bool alpha = window->format().alphaBufferSize() > 0 && window->color().alpha() != 255;
@@ -432,7 +435,8 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
qint64 swapTime = 0;
if (profileFrames)
swapTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSwap);
if (QSG_LOG_TIME_RENDERLOOP().isDebugEnabled()) {
static QTime lastFrameTime = QTime::currentTime();
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 693012154e..4543782d5b 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -602,7 +602,8 @@ void QSGRenderThread::syncAndRender()
if (profileFrames)
syncTime = threadTimer.nsecsElapsed();
#endif
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSync);
if (!syncResultedInChanges && !repaintRequested && sgrc->isValid()) {
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- no changes, render aborted";
@@ -634,12 +635,14 @@ void QSGRenderThread::syncAndRender()
d->renderSceneGraph(windowSize);
if (profileFrames)
renderTime = threadTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopRender);
if (!d->customRenderStage || !d->customRenderStage->swap())
gl->swapBuffers(window);
d->fireFrameSwapped();
} else {
- Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame, 1);
+ Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSync, 1);
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- window not ready, skipping render";
}
@@ -664,7 +667,8 @@ void QSGRenderThread::syncAndRender()
int(threadTimer.elapsed() - renderTime / 1000000));
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSwap);
}
@@ -1169,7 +1173,8 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
if (profileFrames)
polishTime = timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncPolish);
w->updateDuringSync = false;
@@ -1184,7 +1189,8 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
qCDebug(QSG_LOG_RENDERLOOP) << "- wait for sync";
if (profileFrames)
waitTime = timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncWait);
w->thread->waitCondition.wait(&w->thread->mutex);
m_lockedForSync = false;
w->thread->mutex.unlock();
@@ -1192,7 +1198,8 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
if (profileFrames)
syncTime = timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncSync);
if (m_animation_timer == 0 && m_animation_driver->isRunning()) {
qCDebug(QSG_LOG_RENDERLOOP) << "- advancing animations";
@@ -1213,7 +1220,8 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
<< ", animations=" << (timer.nsecsElapsed() - syncTime) / 1000000
<< " - (on Gui thread) " << window;
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncAnimations);
}
bool QSGThreadedRenderLoop::event(QEvent *e)
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index 941a7b3f3c..13388c0841 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -71,9 +71,9 @@ static QElapsedTimer qsg_render_timer;
if (QSG_LOG_TIME_RENDERLOOP().isDebugEnabled()) \
sampleName = qsg_render_timer.nsecsElapsed(); \
-#define QSG_RENDER_TIMING_SAMPLE(frameType, sampleName) \
+#define QSG_RENDER_TIMING_SAMPLE(frameType, sampleName, position) \
QSG_LOG_TIME_SAMPLE(sampleName) \
- Q_QUICK_SG_PROFILE_RECORD(frameType);
+ Q_QUICK_SG_PROFILE_RECORD(frameType, position);
QSGWindowsRenderLoop::QSGWindowsRenderLoop()
@@ -406,7 +406,7 @@ void QSGWindowsRenderLoop::render()
"animations ticked in %dms",
int((qsg_render_timer.nsecsElapsed() - time_start)/1000000));
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphWindowsAnimations);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphWindowsAnimations, 1);
// It is not given that animations triggered another maybeUpdate()
// and thus another render pass, so to keep things running,
@@ -457,22 +457,26 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
d->polishItems();
QSG_LOG_TIME_SAMPLE(time_polished);
Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
- QQuickProfiler::SceneGraphRenderLoopFrame);
+ QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphPolishPolish);
emit window->afterAnimating();
RLDEBUG(" - syncing");
d->syncSceneGraph();
- QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_synced);
+ QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_synced,
+ QQuickProfiler::SceneGraphRenderLoopSync);
RLDEBUG(" - rendering");
d->renderSceneGraph(window->size());
- QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_rendered);
+ QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_rendered,
+ QQuickProfiler::SceneGraphRenderLoopRender);
RLDEBUG(" - swapping");
if (!d->customRenderStage || !d->customRenderStage->swap())
m_gl->swapBuffers(window);
- QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_swapped);
+ QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_swapped,
+ QQuickProfiler::SceneGraphRenderLoopSwap);
RLDEBUG(" - frameDone");
d->fireFrameSwapped();
@@ -485,7 +489,8 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
<< ", swap=" << (time_swapped - time_rendered) / 1000000
<< " - " << window;
- Q_QUICK_SG_PROFILE_REPORT(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_REPORT(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSwap);
}
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index b6abb55bd3..c864ea9496 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -395,9 +395,12 @@ void Atlas::bind(QSGTexture::Filtering filtering)
bool profileFrames = QSG_LOG_TIME_TEXTURE().isDebugEnabled();
if (profileFrames)
qsg_renderer_timer.start();
- // Skip bind, convert, swizzle; they're irrelevant
+
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphTexturePrepare);
- Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphTexturePrepare, 3);
+
+ // Skip bind, convert, swizzle; they're irrelevant
+ Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareStart, 3);
Texture *t = m_pending_uploads.at(i);
if (m_externalFormat == GL_BGRA &&
@@ -415,10 +418,14 @@ void Atlas::bind(QSGTexture::Filtering filtering)
<< "ms (" << t->textureSize().width() << "x"
<< t->textureSize().height() << ")";
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareUpload);
+
// Skip mipmap; unused
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
- Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphTexturePrepare, 1);
- Q_QUICK_SG_PROFILE_REPORT(QQuickProfiler::SceneGraphTexturePrepare);
+ Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareUpload, 1);
+ Q_QUICK_SG_PROFILE_REPORT(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareMipmap);
}
GLenum f = filtering == QSGTexture::Nearest ? GL_NEAREST : GL_LINEAR;
diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp
index 4cf339aeb8..436f97b1ff 100644
--- a/src/quick/scenegraph/util/qsgtexture.cpp
+++ b/src/quick/scenegraph/util/qsgtexture.cpp
@@ -673,7 +673,8 @@ void QSGPlainTexture::bind()
(int) qsg_renderer_timer.elapsed(),
m_texture_size.width(),
m_texture_size.height());
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphTextureDeletion);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphTextureDeletion,
+ QQuickProfiler::SceneGraphTextureDeletionDelete);
}
m_texture_id = 0;
m_texture_size = QSize();
@@ -689,7 +690,8 @@ void QSGPlainTexture::bind()
qint64 bindTime = 0;
if (profileFrames)
bindTime = qsg_renderer_timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareBind);
// ### TODO: check for out-of-memory situations...
@@ -730,7 +732,8 @@ void QSGPlainTexture::bind()
qint64 convertTime = 0;
if (profileFrames)
convertTime = qsg_renderer_timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareConvert);
updateBindOptions(m_dirty_bind_options);
@@ -773,14 +776,16 @@ void QSGPlainTexture::bind()
qint64 swizzleTime = 0;
if (profileFrames)
swizzleTime = qsg_renderer_timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareSwizzle);
funcs->glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, m_texture_size.width(), m_texture_size.height(), 0, externalFormat, GL_UNSIGNED_BYTE, tmp.constBits());
qint64 uploadTime = 0;
if (profileFrames)
uploadTime = qsg_renderer_timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareUpload);
if (mipmapFiltering() != QSGTexture::None) {
funcs->glGenerateMipmap(GL_TEXTURE_2D);
@@ -803,7 +808,8 @@ void QSGPlainTexture::bind()
int((mipmapTime - uploadTime)/1000000),
m_texture_size != m_image.size() ? " (scaled to GL_MAX_TEXTURE_SIZE)" : "");
}
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphTexturePrepare);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareMipmap);
m_texture_rect = QRectF(0, 0, 1, 1);
diff --git a/src/quick/util/qquickprofiler_p.h b/src/quick/util/qquickprofiler_p.h
index 66ed212722..d2fa935ad4 100644
--- a/src/quick/util/qquickprofiler_p.h
+++ b/src/quick/util/qquickprofiler_p.h
@@ -152,7 +152,6 @@ private:
template<uint size>
struct TimingData {
qint64 values[size][s_numSceneGraphTimings + 1];
- int offsets[size];
};
QThreadStorage<TimingData<NumRenderThreadFrameTypes> > renderThreadTimings;
@@ -167,15 +166,6 @@ public:
else
return guiThreadTimings.values[type - NumRenderThreadFrameTypes];
}
-
- template<SceneGraphFrameType type>
- int &offset()
- {
- if (type < NumRenderThreadFrameTypes)
- return renderThreadTimings.localData().offsets[type];
- else
- return guiThreadTimings.offsets[type - NumRenderThreadFrameTypes];
- }
};
class Q_QUICK_PRIVATE_EXPORT QQuickProfiler : public QObject, public QQmlProfilerDefinitions {
@@ -187,6 +177,59 @@ public:
RenderThread
};
+ enum SceneGraphContextStage {
+ SceneGraphContextStart,
+ SceneGraphContextMaterialCompile
+ };
+
+ enum SceneGraphRendererStage {
+ SceneGraphRendererStart,
+ SceneGraphRendererPreprocess,
+ SceneGraphRendererUpdate,
+ SceneGraphRendererBinding,
+ SceneGraphRendererRender
+ };
+
+ enum SceneGraphAdaptationLayerStage {
+ SceneGraphAdaptationLayerStart,
+ SceneGraphAdaptationLayerGlyphRender,
+ SceneGraphAdaptationLayerGlyphStore
+ };
+
+ enum SceneGraphRenderLoopStage {
+ SceneGraphRenderLoopStart,
+ SceneGraphRenderLoopSync,
+ SceneGraphRenderLoopRender,
+ SceneGraphRenderLoopSwap
+ };
+
+ enum SceneGraphPolishStage {
+ SceneGraphPolishStart,
+ SceneGraphPolishPolish
+ };
+
+ enum SceneGraphPolishAndSyncStage {
+ SceneGraphPolishAndSyncStart,
+ SceneGraphPolishAndSyncPolish,
+ SceneGraphPolishAndSyncWait,
+ SceneGraphPolishAndSyncSync,
+ SceneGraphPolishAndSyncAnimations
+ };
+
+ enum SceneGraphTexturePrepareStage {
+ SceneGraphTexturePrepareStart,
+ SceneGraphTexturePrepareBind,
+ SceneGraphTexturePrepareConvert,
+ SceneGraphTexturePrepareSwizzle,
+ SceneGraphTexturePrepareUpload,
+ SceneGraphTexturePrepareMipmap
+ };
+
+ enum SceneGraphTextureDeletionStage {
+ SceneGraphTextureDeletionStart,
+ SceneGraphTextureDeletionDelete
+ };
+
template<EventType DetailType, InputEventType InputType>
static void inputEvent(int x, int y = 0)
{
@@ -209,7 +252,6 @@ public:
static void startSceneGraphFrame()
{
startSceneGraphFrame<FrameType1>();
- s_instance->m_sceneGraphData.offset<FrameType2>() = 0;
s_instance->m_sceneGraphData.timings<FrameType2>()[0] =
s_instance->m_sceneGraphData.timings<FrameType1>()[0];
}
@@ -217,50 +259,45 @@ public:
template<SceneGraphFrameType FrameType>
static void startSceneGraphFrame()
{
- s_instance->m_sceneGraphData.offset<FrameType>() = 0;
s_instance->m_sceneGraphData.timings<FrameType>()[0] = s_instance->timestamp();
}
template<SceneGraphFrameType FrameType>
- static void recordSceneGraphTimestamp()
+ static void recordSceneGraphTimestamp(uint position)
{
- s_instance->m_sceneGraphData.timings<FrameType>()
- [++s_instance->m_sceneGraphData.offset<FrameType>()] = s_instance->timestamp();
+ s_instance->m_sceneGraphData.timings<FrameType>()[position] = s_instance->timestamp();
}
template<SceneGraphFrameType FrameType, uint Skip>
- static void skipSceneGraphTimestamps()
+ static void skipSceneGraphTimestamps(uint position)
{
qint64 *timings = s_instance->m_sceneGraphData.timings<FrameType>();
- const qint64 last = timings[s_instance->m_sceneGraphData.offset<FrameType>()];
+ const qint64 last = timings[position];
for (uint i = 0; i < Skip; ++i)
- timings[++s_instance->m_sceneGraphData.offset<FrameType>()] = last;
+ timings[++position] = last;
}
template<SceneGraphFrameType FrameType, bool Record>
- static void reportSceneGraphFrame(quint64 payload = ~0)
+ static void reportSceneGraphFrame(uint position, quint64 payload = ~0)
{
qint64 *timings = s_instance->m_sceneGraphData.timings<FrameType>();
- int &offset = s_instance->m_sceneGraphData.offset<FrameType>();
if (Record)
- timings[++offset] = s_instance->timestamp();
+ timings[position] = s_instance->timestamp();
s_instance->processMessage(QQuickProfilerData(
- timings[offset], 1 << SceneGraphFrame, 1 << FrameType,
- offset > 0 ? timings[1] - timings[0] : payload,
- offset > 1 ? timings[2] - timings[1] : payload,
- offset > 2 ? timings[3] - timings[2] : payload,
- offset > 3 ? timings[4] - timings[3] : payload,
- offset > 4 ? timings[5] - timings[4] : payload));
+ timings[position], 1 << SceneGraphFrame, 1 << FrameType,
+ position > 0 ? timings[1] - timings[0] : payload,
+ position > 1 ? timings[2] - timings[1] : payload,
+ position > 2 ? timings[3] - timings[2] : payload,
+ position > 3 ? timings[4] - timings[3] : payload,
+ position > 4 ? timings[5] - timings[4] : payload));
}
template<SceneGraphFrameType FrameType, bool Record, SceneGraphFrameType SwitchTo>
- static void reportSceneGraphFrame(quint64 payload = ~0)
+ static void reportSceneGraphFrame(uint position, quint64 payload = ~0)
{
- reportSceneGraphFrame<FrameType, Record>(payload);
- s_instance->m_sceneGraphData.offset<SwitchTo>() = 0;
+ reportSceneGraphFrame<FrameType, Record>(position, payload);
s_instance->m_sceneGraphData.timings<SwitchTo>()[0] =
- s_instance->m_sceneGraphData.timings<FrameType>()
- [s_instance->m_sceneGraphData.offset<FrameType>()];
+ s_instance->m_sceneGraphData.timings<FrameType>()[position];
}
template<PixmapEventType PixmapState>
@@ -326,38 +363,52 @@ protected:
#define Q_QUICK_PROFILE(feature, Method)\
Q_QUICK_PROFILE_IF_ENABLED(feature, QQuickProfiler::Method)
+// Record current timestamp for \a Type at position 0.
#define Q_QUICK_SG_PROFILE_START(Type)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
(QQuickProfiler::startSceneGraphFrame<Type>()))
-#define Q_QUICK_SG_PROFILE_RECORD(Type)\
+// Record current timestamp for \a Type at \a position.
+#define Q_QUICK_SG_PROFILE_RECORD(Type, position)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
- (QQuickProfiler::recordSceneGraphTimestamp<Type>()))
+ (QQuickProfiler::recordSceneGraphTimestamp<Type>(position)))
-#define Q_QUICK_SG_PROFILE_SKIP(Type, Skip)\
+// Use the timestamp for \a Type at position \a position and repeat it \a Skip times in subsequent
+// positions.
+#define Q_QUICK_SG_PROFILE_SKIP(Type, position, Skip)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
- (QQuickProfiler::skipSceneGraphTimestamps<Type, Skip>()))
+ (QQuickProfiler::skipSceneGraphTimestamps<Type, Skip>(position)))
+// Record current timestamp for both \a Type1 and \a Type2 at position 0.
#define Q_QUICK_SG_PROFILE_START_SYNCHRONIZED(Type1, Type2)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
(QQuickProfiler::startSceneGraphFrame<Type1, Type2>()))
-#define Q_QUICK_SG_PROFILE_SWITCH(Type1, Type2) \
+// report \a Type1, using the current timestamp at \a position, and switch to \a Typ2, using
+// the current timestamp at position 0.
+#define Q_QUICK_SG_PROFILE_SWITCH(Type1, Type2, position)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
- (QQuickProfiler::reportSceneGraphFrame<Type1, true, Type2>()))
+ (QQuickProfiler::reportSceneGraphFrame<Type1, true, Type2>(\
+ position)))
-#define Q_QUICK_SG_PROFILE_REPORT(Type)\
+// report \a Type, using data points 0 to \a position, including \a position.
+#define Q_QUICK_SG_PROFILE_REPORT(Type, position)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
- (QQuickProfiler::reportSceneGraphFrame<Type, false>()))
+ (QQuickProfiler::reportSceneGraphFrame<Type, false>(position)))
-#define Q_QUICK_SG_PROFILE_END(Type)\
+// report \a Type, using data points 0 to \a position, including \a position, and setting the
+// timestamp at \a position to the current one.
+#define Q_QUICK_SG_PROFILE_END(Type, position)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
- (QQuickProfiler::reportSceneGraphFrame<Type, true>()))
+ (QQuickProfiler::reportSceneGraphFrame<Type, true>(position)))
-#define Q_QUICK_SG_PROFILE_END_WITH_PAYLOAD(Type, Payload)\
+// report \a Type, using data points 0 to \a position, including \a position, and setting the
+// timestamp at \a position to the current one. Remaining data points up to position 5 are filled
+// with \a Payload.
+#define Q_QUICK_SG_PROFILE_END_WITH_PAYLOAD(Type, position, Payload)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
- (QQuickProfiler::reportSceneGraphFrame<Type, true>(Payload)))
-
+ (QQuickProfiler::reportSceneGraphFrame<Type, true>(position,\
+ Payload)))
#define Q_QUICK_INPUT_PROFILE(Type, DetailType, A, B)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileInputEvents,\