diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-03-25 11:51:53 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-27 10:09:34 +0100 |
commit | 34335e81471e2695c74612a15f9e88d5f4e2dd7e (patch) | |
tree | d0e00406ba8f2c4c025fcdd201f8173cb59ea820 /src/quick/items/context2d/qquickcontext2d_p.h | |
parent | 577fd8b43dbfcf7fd319eade620b93764a1c94ca (diff) |
Use an offscreen surface in Canvas
Canvas elements using the default Immediate render strategy
and an FBO result in a failing makeCurrent() and subsequent
crashes due to trying to make the Quick window's surface current
on the gui thread while it is current on the scenegraph render thread.
The EGL spec disallows this explicitly and so the makeCurrent fails with
EGL_BAD_ACCESS. Others, like GLX, do not seem to have this issue since
the spec says nothing about this scenario.
To overcome this, a QOffscreenSurface is used instead since what the
canvas does (rendering into an FBO on a thread that is different than
the one on which the rest of the rendering happens) is a primary use
case for offscreen surfaces (pbuffers) anyway.
This makes demos like stocqt functional again.
Task-number: QTBUG-37772
Change-Id: Id89f71545154856415bbbe4fa924176b25b5086f
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/quick/items/context2d/qquickcontext2d_p.h')
-rw-r--r-- | src/quick/items/context2d/qquickcontext2d_p.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d_p.h b/src/quick/items/context2d/qquickcontext2d_p.h index 4390ae62cc..ab851d302f 100644 --- a/src/quick/items/context2d/qquickcontext2d_p.h +++ b/src/quick/items/context2d/qquickcontext2d_p.h @@ -49,6 +49,7 @@ #include <private/qquickcanvasitem_p.h> #include <QtGui/qpainter.h> #include <QtGui/qpainterpath.h> +#include <QtGui/qoffscreensurface.h> #include <QtCore/qstring.h> #include <QtCore/qstack.h> #include <QtCore/qqueue.h> @@ -229,7 +230,7 @@ public: QQmlRefPointer<QQuickCanvasPixmap> createPixmap(const QUrl& url); QOpenGLContext *glContext() { return m_glContext; } - QSurface *surface() { return m_surface; } + QSurface *surface() { return m_surface.data(); } void setGrabbedImage(const QImage& grab); State state; @@ -241,7 +242,7 @@ public: QV4::PersistentValue m_strokeStyle; QV4::PersistentValue m_v4path; QV8Engine *m_v8engine; - QSurface *m_surface; + QScopedPointer<QOffscreenSurface> m_surface; QOpenGLContext *m_glContext; QV4::PersistentValue m_v4value; QQuickContext2DTexture *m_texture; |