diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-11-24 11:50:45 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-11-24 14:31:11 +0000 |
commit | 2837f1c868b92e7cc8293064ff7ec3f76cdf6c7b (patch) | |
tree | d85fc417fd3e9773cf745e74b2b9d66785be5799 /src/quick/scenegraph/util | |
parent | c712f638a0a3ad2a71a9a18601fd320dabd50f16 (diff) |
QmlProfiler: Explicitly specify the offsets for scene graph events
The profiler can be switched on in the middle of a frame. In that case
the last offset into the timing data would be some random number, which
may lead to a crash when recording the sample.
However, as we know all the data points we are going to record, we can
as well specify where they are supposed to go. The timings themselves
may still be random for frames of which we only recorded parts, but
the clients can deal with this.
Task-number: QTBUG-57304
Change-Id: I1d507f2591516e43d5b3cd25f7939716f2b64ed9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/quick/scenegraph/util')
-rw-r--r-- | src/quick/scenegraph/util/qsgatlastexture.cpp | 17 | ||||
-rw-r--r-- | src/quick/scenegraph/util/qsgtexture.cpp | 18 |
2 files changed, 24 insertions, 11 deletions
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp index e163191c6e..d26629900f 100644 --- a/src/quick/scenegraph/util/qsgatlastexture.cpp +++ b/src/quick/scenegraph/util/qsgatlastexture.cpp @@ -388,9 +388,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 && @@ -408,10 +411,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 df9e569ca3..7625130dfe 100644 --- a/src/quick/scenegraph/util/qsgtexture.cpp +++ b/src/quick/scenegraph/util/qsgtexture.cpp @@ -646,7 +646,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(); @@ -662,7 +663,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... @@ -703,7 +705,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); @@ -746,14 +749,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); @@ -776,7 +781,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); |