summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2010-08-17 08:29:03 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-08-17 08:40:24 (GMT)
commita76b8bf67696ae69888cc6237417e7c8f07f8da6 (patch)
tree082ff846348c222ae1c87b18c882fc96adf4adf1 /src
parent69e8769e2a3f44700c24437dc851ea817c16318f (diff)
downloadQt-a76b8bf67696ae69888cc6237417e7c8f07f8da6.zip
Qt-a76b8bf67696ae69888cc6237417e7c8f07f8da6.tar.gz
Qt-a76b8bf67696ae69888cc6237417e7c8f07f8da6.tar.bz2
Prevented Xorg crash in qtdemo when running corkboards example.
The crash happens in the Nvidia driver in glXReleaseTexImageEXT when scrolling the corkboard using the mouse. To work around it we detect the Nvidia driver versions where this is known to be a problem and skip using the texture from pixmap extension in those cases. Task-number: QTBUG-12914 Reviewed-by: Trond
Diffstat (limited to 'src')
-rw-r--r--src/opengl/qgl.cpp30
-rw-r--r--src/opengl/qgl_p.h3
2 files changed, 28 insertions, 5 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 4daa866..74bde36 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1688,6 +1688,10 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)
workaround_needsFullClearOnEveryFrame = false;
workaround_brokenFBOReadBack = false;
workaroundsCached = false;
+
+ workaround_brokenTextureFromPixmap = false;
+ workaround_brokenTextureFromPixmap_init = false;
+
for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i)
vertexAttributeArraysEnabledState[i] = false;
}
@@ -2570,11 +2574,27 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target,
&& xinfo && xinfo->screen() == pixmap.x11Info().screen()
&& target == GL_TEXTURE_2D)
{
- texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options);
- if (texture) {
- texture->options |= QGLContext::MemoryManagedBindOption;
- texture->boundPixmap = pd;
- boundPixmaps.insert(pd, QPixmap(pixmap));
+ if (!workaround_brokenTextureFromPixmap_init) {
+ workaround_brokenTextureFromPixmap_init = true;
+
+ const QByteArray versionString(reinterpret_cast<const char*>(glGetString(GL_VERSION)));
+ const int pos = versionString.indexOf("NVIDIA ");
+
+ if (pos >= 0) {
+ const QByteArray nvidiaVersionString = versionString.mid(pos + strlen("NVIDIA "));
+
+ if (nvidiaVersionString.startsWith("195") || nvidiaVersionString.startsWith("256"))
+ workaround_brokenTextureFromPixmap = true;
+ }
+ }
+
+ if (!workaround_brokenTextureFromPixmap) {
+ texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options);
+ if (texture) {
+ texture->options |= QGLContext::MemoryManagedBindOption;
+ texture->boundPixmap = pd;
+ boundPixmaps.insert(pd, QPixmap(pixmap));
+ }
}
}
#endif
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 32feacd..ca0d3fa 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -393,6 +393,9 @@ public:
uint workaround_brokenFBOReadBack : 1;
uint workaroundsCached : 1;
+ uint workaround_brokenTextureFromPixmap : 1;
+ uint workaround_brokenTextureFromPixmap_init : 1;
+
QPaintDevice *paintDevice;
QColor transpColor;
QGLContext *q_ptr;