diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-11-20 12:05:49 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-20 14:23:29 +0100 |
commit | 3f1245aabc125c416f26028a12923f9055765e4f (patch) | |
tree | 23d89e2a0336ec54d3fd064974300ac115f1430e | |
parent | 8ae390e75bf589b1591cdf5caa77b254b9ac0d8a (diff) |
Enforce window rendering in sequence on llvmpipe.
When rendering multiple windows in parallel on llvmpipe we end up with
crashes deep inside llvmpipe as multiple threads seem to access
unprotected resources. Work around this bug by enforcing that scene
graph rendering happens on one window at a time.
Task-number: QTCREATORBUG-10666
Change-Id: I2f734e8f653b2a9b4108eb189280ab922581e2c0
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
-rw-r--r-- | src/quick/scenegraph/qsgcontext.cpp | 12 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext_p.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index fa095b8165..afde7939f2 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -340,6 +340,7 @@ QSGRenderContext::QSGRenderContext(QSGContext *context) , m_depthStencilManager(0) , m_distanceFieldCacheManager(0) , m_brokenIBOs(false) + , m_serializedRender(false) { } @@ -348,8 +349,13 @@ QSGRenderContext::~QSGRenderContext() invalidate(); } +static QBasicMutex qsg_framerender_mutex; + void QSGRenderContext::renderNextFrame(QSGRenderer *renderer, GLuint fboId) { + if (m_serializedRender) + qsg_framerender_mutex.lock(); + if (fboId) { QSGBindableFboId bindable(fboId); renderer->renderScene(bindable); @@ -357,6 +363,9 @@ void QSGRenderContext::renderNextFrame(QSGRenderer *renderer, GLuint fboId) renderer->renderScene(); } + if (m_serializedRender) + qsg_framerender_mutex.unlock(); + } /*! @@ -442,6 +451,9 @@ void QSGRenderContext::initialize(QOpenGLContext *context) const char *vendor = (const char *) glGetString(GL_VENDOR); if (strstr(vendor, "nouveau")) m_brokenIBOs = true; + const char *renderer = (const char *) glGetString(GL_RENDERER); + if (strstr(renderer, "llvmpipe")) + m_serializedRender = true; #endif emit initialized(); diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index 270f108373..c562a909c5 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -132,6 +132,7 @@ protected: QSet<QFontEngine *> m_fontEnginesToClean; bool m_brokenIBOs; + bool m_serializedRender; }; |