diff options
| author | Koen Kooi <koen@openembedded.org> | 2010-01-04 16:38:25 +0100 |
|---|---|---|
| committer | Koen Kooi <koen@openembedded.org> | 2010-01-05 10:07:58 +0100 |
| commit | 4a3a725cc558b2841959c84529389c97587eae45 (patch) | |
| tree | 8985a4997feccd22c565c4ebb6f3b92d9b563570 /recipes | |
| parent | 1029524234e0d6da592b946803cbd09b882acf2e (diff) | |
qt 4.6.0: backport a few patches from git, mainly QGL related
Diffstat (limited to 'recipes')
33 files changed, 3766 insertions, 6 deletions
diff --git a/recipes/qt4/qt-4.6.0.inc b/recipes/qt4/qt-4.6.0.inc index b29b708d74..91565f7e0e 100644 --- a/recipes/qt4/qt-4.6.0.inc +++ b/recipes/qt4/qt-4.6.0.inc @@ -1,5 +1,7 @@ DEFAULT_PREFERENCE = "-1" +FILESPATHPKG .= ":qt-${PV}" + SRC_URI = "ftp://ftp.trolltech.com/qt/source/qt-everywhere-opensource-src-${PV}.tar.gz \ file://0001-cross-compile.patch;patch=1 \ file://0002-fix-resinit-declaration.patch;patch=1 \ @@ -12,6 +14,37 @@ SRC_URI = "ftp://ftp.trolltech.com/qt/source/qt-everywhere-opensource-src-${PV}. file://g++.conf \ file://linux.conf \ " + +# Patches for '4.6' qt branch +SRC_URI += "\ + file://0860-Added-caching-of-vectorpaths-to-the-GL-paint-engine.patch;patch=1 \ + file://0917-Better-check-for-EGL-extension-strings.patch;patch=1 \ + file://0919-Rebind-window-surface-fbo-after-native-GL-rendering.patch;patch=1 \ + file://0943-Fixed-OpenGL-graphicssystem-issues-for-OpenGL-ES-2.0.patch;patch=1 \ + file://0945-Add-EGL_BUFFER_SIZE-to-QEglProperties-reduceConfigur.patch;patch=1 \ + file://0946-Fix-WA_TranslucentBackground-for-QGLWidgets-on-X11-E.patch;patch=1 \ + file://0947-Compressed-texture-binding-for-QtOpenGL-ETC1-and-PVR.patch;patch=1 \ + file://0951-Detect-GL2-paint-engine-based-on-fragment-shaders-no.patch;patch=1 \ + file://0971-Fix-GL_BGRA-formats-under-OpenGL-ES-systems.patch;patch=1 \ + file://0991-QGtkStyle-support-for-the-inner-border-property-in-G.patch;patch=1 \ + file://0992-Make-sure-a-context-is-current-when-loading-compress.patch;patch=1 \ + file://0993-Fix-upside-down-PVR-compressed-textures.patch;patch=1 \ + file://0996-Export-QGLShareRegister-because-qgl_share_reg-is-exp.patch;patch=1 \ + file://0998-Set-stacking-class-for-stays-on-top-windows-in-DFB.patch;patch=1 \ + file://0999-Enable-customizing-of-DirectFB-layer-to-use.patch;patch=1 \ + file://1008-GLES-2-should-not-use-a-multisampled-format-by-defau.patch;patch=1 \ + file://1115-Fix-QGLWidgets-created-with-an-alpha-channel-on-X11-.patch;patch=1 \ + file://1118-Fix-EGL-surface-leaks-when-re-parenting-QGLWidget-on.patch;patch=1 \ + file://1136-Disable-depth-testing-during-the-2D-QGLWidget-render.patch;patch=1 \ + file://1149-GL2Engine-Don-t-mark-brush-as-dirty-if-it-hasn-t-cha.patch;patch=1 \ + file://1157-Align-GL_RGB-lines-on-a-4-byte-boundary-when-uploadi.patch;patch=1 \ +# file://1165-NEON-configure-detection-and-initial-blend-function-.patch;patch=1 \ + file://1175-Fix-memory-leak-of-QGLGlyphCoord-objects-in-the-Open.patch;patch=1 \ + file://1197-Add-GLfloat-2-2-GLfloat-3-3-uniform-setters-to-QGLSh.patch;patch=1 \ + file://1198-Handle-broken-shaders-better-in-the-GL2-engine-s-sha.patch;patch=1 \ + file://1205-Fix-text-rendering-on-GL2-paint-engine.patch;patch=1 \ +" + S = "${WORKDIR}/qt-everywhere-opensource-src-${PV}" do_configure_prepend() { @@ -22,8 +55,6 @@ do_configure_prepend() { -e /QMAKE_UIC3\ /d \ -e /QMAKE_RCC\ /d \ ${S}/configure - -# sed -i /tools.pro/d ${S}/src/src.pro } QT_GLFLAGS ?= "" diff --git a/recipes/qt4/qt-4.6.0/0838-Fixed-the-GL2-engine-stroker-to-handle-Qt-SvgMiterJo.patch b/recipes/qt4/qt-4.6.0/0838-Fixed-the-GL2-engine-stroker-to-handle-Qt-SvgMiterJo.patch new file mode 100644 index 0000000000..a517d3ce41 --- /dev/null +++ b/recipes/qt4/qt-4.6.0/0838-Fixed-the-GL2-engine-stroker-to-handle-Qt-SvgMiterJo.patch @@ -0,0 +1,25 @@ +From 0f61a0f1ce02bb0248cb87055240a8a474dce452 Mon Sep 17 00:00:00 2001 +From: Kim Motoyoshi Kalland <kim.kalland@nokia.com> +Date: Fri, 27 Nov 2009 16:17:25 +0100 +Subject: [PATCH 0838/1244] Fixed the GL2 engine stroker to handle Qt::SvgMiterJoin. + +Reviewed-by: Trond +--- + .../gl2paintengineex/qtriangulatingstroker.cpp | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp +index c78f73f..6082f49 100644 +--- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp ++++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp +@@ -313,6 +313,7 @@ void QTriangulatingStroker::join(const qreal *pts) + switch (m_join_style) { + case Qt::BevelJoin: + break; ++ case Qt::SvgMiterJoin: + case Qt::MiterJoin: { + // Find out on which side the join should be. + int count = m_vertices.size(); +-- +1.6.5 + diff --git a/recipes/qt4/qt-4.6.0/0860-Added-caching-of-vectorpaths-to-the-GL-paint-engine.patch b/recipes/qt4/qt-4.6.0/0860-Added-caching-of-vectorpaths-to-the-GL-paint-engine.patch new file mode 100644 index 0000000000..794380ab91 --- /dev/null +++ b/recipes/qt4/qt-4.6.0/0860-Added-caching-of-vectorpaths-to-the-GL-paint-engine.patch @@ -0,0 +1,317 @@ +From dbfdfdb1bc37dd18dd1b723b5d5b0b65c37f3f41 Mon Sep 17 00:00:00 2001 +From: Gunnar Sletta <gunnar@trolltech.com> +Date: Tue, 1 Dec 2009 09:18:47 +0100 +Subject: [PATCH 0860/1244] Added caching of vectorpaths to the GL paint engine. + +The first time a path is drawn we call makeCachable on the path, which +means that if it is drawn again, we start caching it. This is a bit of +a trick to avoid caching paths that are drawn once and discared while +at the same time cache paths that are reused automatically. + +The GL engine owns the vertex information and is responsible for cleaning +it up. If the vectorpath is destroyed first, it will call the cleanup function. +if the engine dies first, we still require some hooks to clean up the cache +in the path. More to come. When VBO's are used, these will be a leaked if the +path is destroyed after the engine. + +Reviewed-by: Samuel +--- + src/gui/painting/qpaintengineex.cpp | 16 +++- + src/gui/painting/qvectorpath_p.h | 13 ++- + src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h | 2 + + .../gl2paintengineex/qpaintengineex_opengl2.cpp | 115 +++++++++++++++++++- + .../gl2paintengineex/qpaintengineex_opengl2_p.h | 4 + + 5 files changed, 139 insertions(+), 11 deletions(-) + +diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp +index 7d1c109..9a0e319 100644 +--- a/src/gui/painting/qpaintengineex.cpp ++++ b/src/gui/painting/qpaintengineex.cpp +@@ -56,6 +56,20 @@ QT_BEGIN_NAMESPACE + * class QVectorPath + * + */ ++QVectorPath::~QVectorPath() ++{ ++ if (m_hints & ShouldUseCacheHint) { ++ CacheEntry *e = m_cache; ++ while (e) { ++ if (e->data) ++ e->cleanup(e->engine, e->data); ++ CacheEntry *n = e->next; ++ delete e; ++ e = n; ++ } ++ } ++} ++ + + QRectF QVectorPath::controlPointRect() const + { +@@ -94,7 +108,7 @@ QRectF QVectorPath::controlPointRect() const + + + QVectorPath::CacheEntry *QVectorPath::addCacheData(QPaintEngineEx *engine, void *data, +- qvectorpath_cache_cleanup cleanup) { ++ qvectorpath_cache_cleanup cleanup) const{ + Q_ASSERT(!lookupCacheData(engine)); + if ((m_hints & IsCachedHint) == 0) { + m_cache = 0; +diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h +index ec27970..5eaddf4 100644 +--- a/src/gui/painting/qvectorpath_p.h ++++ b/src/gui/painting/qvectorpath_p.h +@@ -68,7 +68,7 @@ QT_MODULE(Gui) + + class QPaintEngineEx; + +-typedef void (*qvectorpath_cache_cleanup)(void *data); ++typedef void (*qvectorpath_cache_cleanup)(QPaintEngineEx *engine, void *data); + + struct QRealRect { + qreal x1, y1, x2, y2; +@@ -118,6 +118,8 @@ public: + { + } + ++ ~QVectorPath(); ++ + QRectF controlPointRect() const; + + inline Hint shape() const { return (Hint) (m_hints & ShapeMask); } +@@ -128,6 +130,7 @@ public: + inline bool hasImplicitClose() const { return m_hints & ImplicitClose; } + inline bool hasWindingFill() const { return m_hints & WindingFill; } + ++ inline void makeCacheable() const { m_hints |= ShouldUseCacheHint; m_cache = 0; } + inline uint hints() const { return m_hints; } + + inline const QPainterPath::ElementType *elements() const { return m_elements; } +@@ -146,9 +149,9 @@ public: + CacheEntry *next; + }; + +- CacheEntry *addCacheData(QPaintEngineEx *engine, void *data, qvectorpath_cache_cleanup cleanup); ++ CacheEntry *addCacheData(QPaintEngineEx *engine, void *data, qvectorpath_cache_cleanup cleanup) const; + inline CacheEntry *lookupCacheData(QPaintEngineEx *engine) const { +- Q_ASSERT(m_hints & IsCachedHint); ++ Q_ASSERT(m_hints & ShouldUseCacheHint); + CacheEntry *e = m_cache; + while (e) { + if (e->engine == engine) +@@ -162,14 +165,14 @@ public: + private: + Q_DISABLE_COPY(QVectorPath) + +- CacheEntry *m_cache; +- + const QPainterPath::ElementType *m_elements; + const qreal *m_points; + const int m_count; + + mutable uint m_hints; + mutable QRealRect m_cp_rect; ++ ++ mutable CacheEntry *m_cache; + }; + + Q_GUI_EXPORT const QVectorPath &qtVectorPathForPath(const QPainterPath &path); +diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h +index 03aec17..98eaa91 100644 +--- a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h ++++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h +@@ -112,6 +112,8 @@ public: + int stopCount() const { return vertexArrayStops.size(); } + QGLRect boundingRect() const; + ++ int vertexCount() const { return vertexArray.size(); } ++ + void lineToArray(const GLfloat x, const GLfloat y); + + private: +diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +index 6a708b4..3fce384 100644 +--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp ++++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +@@ -62,6 +62,8 @@ + and use the correct program when we really need it. + */ + ++// #define QT_OPENGL_CACHE_AS_VBOS ++ + #include "qpaintengineex_opengl2_p.h" + + #include <string.h> //for memcpy +@@ -344,6 +346,13 @@ extern QImage qt_imageForBrush(int brushStyle, bool invert); + QGL2PaintEngineExPrivate::~QGL2PaintEngineExPrivate() + { + delete shaderManager; ++ ++ while (pathCaches.size()) { ++ QVectorPath::CacheEntry *e = *(pathCaches.constBegin()); ++ e->cleanup(e->engine, e->data); ++ e->data = 0; ++ e->engine = 0; ++ } + } + + void QGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id) +@@ -846,6 +855,30 @@ void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode) + mode = newMode; + } + ++struct QGL2PEVectorPathCache ++{ ++#ifdef QT_OPENGL_CACHE_AS_VBOS ++ GLuint vbo; ++#else ++ float *vertices; ++#endif ++ int vertexCount; ++ GLenum primitiveType; ++ qreal iscale; ++}; ++ ++void qopengl2paintengine_cleanup_vectorpath(QPaintEngineEx *engine, void *data) ++{ ++ QGL2PEVectorPathCache *c = (QGL2PEVectorPathCache *) data; ++#ifdef QT_OPENGL_CACHE_AS_VBOS ++ QGL2PaintEngineExPrivate *d = QGL2PaintEngineExPrivate::getData((QGL2PaintEngineEx *) engine); ++ d->unusedVBOSToClean << c->vbo; ++#else ++ qFree(c->vertices); ++#endif ++ delete c; ++} ++ + // Assumes everything is configured for the brush you want to use + void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) + { +@@ -863,10 +896,74 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) + prepareForDraw(currentBrush->isOpaque()); + composite(rect); + } else if (path.isConvex()) { +- vertexCoordinateArray.clear(); +- vertexCoordinateArray.addPath(path, inverseScale, false); +- prepareForDraw(currentBrush->isOpaque()); +- drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN); ++ ++ if (path.isCacheable()) { ++ QVectorPath::CacheEntry *data = path.lookupCacheData(q); ++ QGL2PEVectorPathCache *cache; ++ ++ if (data) { ++ cache = (QGL2PEVectorPathCache *) data->data; ++ // Check if scale factor is exceeded for curved paths and generate curves if so... ++ if (path.isCurved()) { ++ qreal scaleFactor = cache->iscale / inverseScale; ++ if (scaleFactor < 0.5 || scaleFactor > 2.0) { ++#ifdef QT_OPENGL_CACHE_AS_VBOS ++ glDeleteBuffers(1, &cache->vbo); ++ cache->vbo = 0; ++#else ++ qFree(cache->vertices); ++#endif ++ cache->vertexCount = 0; ++ } ++ } ++ } else { ++ cache = new QGL2PEVectorPathCache; ++ cache->vertexCount = 0; ++ data = const_cast<QVectorPath &>(path).addCacheData(q, cache, qopengl2paintengine_cleanup_vectorpath); ++ } ++ ++ // Flatten the path at the current scale factor and fill it into the cache struct. ++ if (!cache->vertexCount) { ++ vertexCoordinateArray.clear(); ++ vertexCoordinateArray.addPath(path, inverseScale, false); ++ int vertexCount = vertexCoordinateArray.vertexCount(); ++ int floatSizeInBytes = vertexCount * 2 * sizeof(float); ++ cache->vertexCount = vertexCount; ++ cache->primitiveType = GL_TRIANGLE_FAN; ++ cache->iscale = inverseScale; ++#ifdef QT_OPENGL_CACHE_AS_VBOS ++ glGenBuffers(1, &cache->vbo); ++ glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); ++ glBufferData(GL_ARRAY_BUFFER, floatSizeInBytes, vertexCoordinateArray.data(), GL_STATIC_DRAW); ++#else ++ cache->vertices = (float *) qMalloc(floatSizeInBytes); ++ memcpy(cache->vertices, vertexCoordinateArray.data(), floatSizeInBytes); ++#endif ++ } ++ ++ prepareForDraw(currentBrush->isOpaque()); ++ glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR); ++#ifdef QT_OPENGL_CACHE_AS_VBOS ++ glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); ++ glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, false, 0, 0); ++#else ++ glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, false, 0, cache->vertices); ++#endif ++ glDrawArrays(cache->primitiveType, 0, cache->vertexCount); ++ ++ } else { ++ // printf(" - Marking path as cachable...\n"); ++ // Tag it for later so that if the same path is drawn twice, it is assumed to be static and thus cachable ++ // ### Remove before release... ++ static bool do_vectorpath_cache = qgetenv("QT_OPENGL_NO_PATH_CACHE").isEmpty(); ++ if (do_vectorpath_cache) ++ path.makeCacheable(); ++ vertexCoordinateArray.clear(); ++ vertexCoordinateArray.addPath(path, inverseScale, false); ++ prepareForDraw(currentBrush->isOpaque()); ++ drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN); ++ } ++ + } else { + // The path is too complicated & needs the stencil technique + vertexCoordinateArray.clear(); +@@ -1756,7 +1853,8 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) + d->device->beginPaint(); + + #if !defined(QT_OPENGL_ES_2) +- bool success = qt_resolve_version_2_0_functions(d->ctx); ++ bool success = qt_resolve_version_2_0_functions(d->ctx) ++ && qt_resolve_buffer_extensions(d->ctx); + Q_ASSERT(success); + Q_UNUSED(success); + #endif +@@ -1817,6 +1915,13 @@ bool QGL2PaintEngineEx::end() + delete d->shaderManager; + d->shaderManager = 0; + ++#ifdef QT_OPENGL_CACHE_AS_VBOS ++ if (!d->unusedVBOSToClean.isEmpty()) { ++ glDeleteBuffers(d->unusedVBOSToClean.size(), d->unusedVBOSToClean.constData()); ++ d->unusedVBOSToClean.clear(); ++ } ++#endif ++ + return false; + } + +diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +index b554f6d..0084476 100644 +--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h ++++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +@@ -221,6 +221,7 @@ public: + void restoreDepthRangeForRenderText(); + + static QGLEngineShaderManager* shaderManagerForEngine(QGL2PaintEngineEx *engine) { return engine->d_func()->shaderManager; } ++ static QGL2PaintEngineExPrivate *getData(QGL2PaintEngineEx *engine) { return engine->d_func(); } + + QGL2PaintEngineEx* q; + QGLPaintDevice* device; +@@ -294,6 +295,9 @@ public: + QScopedPointer<QPixmapFilter> fastBlurFilter; + QScopedPointer<QPixmapFilter> dropShadowFilter; + QScopedPointer<QPixmapFilter> fastDropShadowFilter; ++ ++ QSet<QVectorPath::CacheEntry *> pathCaches; ++ QVector<GLuint> unusedVBOSToClean; + }; + + QT_END_NAMESPACE +-- +1.6.5 + diff --git a/recipes/qt4/qt-4.6.0/0917-Better-check-for-EGL-extension-strings.patch b/recipes/qt4/qt-4.6.0/0917-Better-check-for-EGL-extension-strings.patch new file mode 100644 index 0000000000..9febe7553e --- /dev/null +++ b/recipes/qt4/qt-4.6.0/0917-Better-check-for-EGL-extension-strings.patch @@ -0,0 +1,34 @@ +From 108ab335537d20bc74aa9115d46cf91243223c4e Mon Sep 17 00:00:00 2001 +From: Rhys Weatherley <rhys.weatherley@nokia.com> +Date: Fri, 4 Dec 2009 17:03:41 +1000 +Subject: [PATCH 0917/1244] Better check for EGL extension strings + +The previous code might have failed if the desired extension name +was a prefix of another name: "EGL_foo" member of "EGL_foo_bar". +This change introduces a more precise check. + +Task-number: QTBUG-6454 +Reviewed-by: Sarah Smith +--- + src/gui/egl/qegl.cpp | 5 ++++- + 1 files changed, 4 insertions(+), 1 deletions(-) + +diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp +index cf28dc4..6ee4bfc 100644 +--- a/src/gui/egl/qegl.cpp ++++ b/src/gui/egl/qegl.cpp +@@ -429,7 +429,10 @@ QString QEglContext::extensions() + + bool QEglContext::hasExtension(const char* extensionName) + { +- return extensions().contains(QLatin1String(extensionName)); ++ QList<QByteArray> extensions = ++ QByteArray(reinterpret_cast<const char *> ++ (eglQueryString(QEglContext::defaultDisplay(0), EGL_EXTENSIONS))).split(' '); ++ return extensions.contains(extensionName); + } + + QEglContext *QEglContext::currentContext(QEgl::API api) +-- +1.6.5 + diff --git a/recipes/qt4/qt-4.6.0/0919-Rebind-window-surface-fbo-after-native-GL-rendering.patch b/recipes/qt4/qt-4.6.0/0919-Rebind-window-surface-fbo-after-native-GL-rendering.patch new file mode 100644 index 0000000000..f3dbdb57e7 --- /dev/null +++ b/recipes/qt4/qt-4.6.0/0919-Rebind-window-surface-fbo-after-native-GL-rendering.patch @@ -0,0 +1,95 @@ +From c0b81480b2909b18ac15bdd124a562ae005c2f41 Mon Sep 17 00:00:00 2001 +From: Rhys Weatherley <rhys.weatherley@nokia.com> +Date: Fri, 4 Dec 2009 17:17:00 +1000 +Subject: [PATCH 0919/1244] Rebind window surface fbo after native GL rendering + +If the user called QGLFramebufferObject::bind()/release() during a +beginNativePainting() callout, the release() would reset the context's +fbo to zero, not the actual window surface fbo. + +Task-number: QTBUG-6204 +Reviewed-by: Tom +--- + src/opengl/qgl.cpp | 1 + + src/opengl/qgl_p.h | 1 + + src/opengl/qglframebufferobject.cpp | 4 ++-- + src/opengl/qglpaintdevice.cpp | 10 ++++++++++ + 4 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp +index 5ada125..94b8aa5 100644 +--- a/src/opengl/qgl.cpp ++++ b/src/opengl/qgl.cpp +@@ -1495,6 +1495,7 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) + version_flags_cached = false; + version_flags = QGLFormat::OpenGL_Version_None; + current_fbo = 0; ++ default_fbo = 0; + active_engine = 0; + } + +diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h +index 8e472e5..ab72c9c 100644 +--- a/src/opengl/qgl_p.h ++++ b/src/opengl/qgl_p.h +@@ -328,6 +328,7 @@ public: + GLint max_texture_size; + + GLuint current_fbo; ++ GLuint default_fbo; + QPaintEngine *active_engine; + + static inline QGLContextGroup *contextGroup(const QGLContext *ctx) { return ctx->d_ptr->group; } +diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp +index d79283e..d0297c9 100644 +--- a/src/opengl/qglframebufferobject.cpp ++++ b/src/opengl/qglframebufferobject.cpp +@@ -899,8 +899,8 @@ bool QGLFramebufferObject::release() + #endif + + if (current) { +- current->d_ptr->current_fbo = 0; +- glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); ++ current->d_ptr->current_fbo = current->d_ptr->default_fbo; ++ glBindFramebuffer(GL_FRAMEBUFFER_EXT, current->d_ptr->default_fbo); + } + + return true; +diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp +index 2867de5..bcd90a5 100644 +--- a/src/opengl/qglpaintdevice.cpp ++++ b/src/opengl/qglpaintdevice.cpp +@@ -89,6 +89,12 @@ void QGLPaintDevice::beginPaint() + ctx->d_ptr->current_fbo = m_thisFBO; + glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO); + } ++ ++ // Set the default fbo for the context to m_thisFBO so that ++ // if some raw GL code between beginNativePainting() and ++ // endNativePainting() calls QGLFramebufferObject::release(), ++ // painting will revert to the window surface's fbo. ++ ctx->d_ptr->default_fbo = m_thisFBO; + } + + void QGLPaintDevice::ensureActiveTarget() +@@ -101,6 +107,8 @@ void QGLPaintDevice::ensureActiveTarget() + ctx->d_ptr->current_fbo = m_thisFBO; + glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO); + } ++ ++ ctx->d_ptr->default_fbo = m_thisFBO; + } + + void QGLPaintDevice::endPaint() +@@ -111,6 +119,8 @@ void QGLPaintDevice::endPaint() + ctx->d_ptr->current_fbo = m_previousFBO; + glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_previousFBO); + } ++ ++ ctx->d_ptr->default_fbo = 0; + } + + QGLFormat QGLPaintDevice::format() const +-- +1.6.5 + diff --git a/recipes/qt4/qt-4.6.0/0943-Fixed-OpenGL-graphicssystem-issues-for-OpenGL-ES-2.0.patch b/recipes/qt4/qt-4.6.0/0943-Fixed-OpenGL-graphicssystem-issues-for-OpenGL-ES-2.0.patch new file mode 100644 index 0000000000..5ef0b28822 --- /dev/null +++ b/recipes/qt4/qt-4.6.0/0943-Fixed-OpenGL-graphicssystem-issues-for-OpenGL-ES-2.0.patch @@ -0,0 +1,146 @@ +From 60be72310c0f9469b3201b250b257473184ccf2a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <sroedal@trolltech.com> +Date: Thu, 3 Dec 2009 11:53:31 +0100 +Subject: [PATCH 0943/1244] Fixed OpenGL graphicssystem issues for OpenGL ES 2.0 platforms. + +The format and internal_format parameters to glTexImage2D need to always +match on OpenGL ES 2.0. + +Reviewed-by: Tom Cooksey +--- + src/opengl/qgl_p.h | 3 ++- + src/opengl/qpixmapdata_gl.cpp | 38 ++++++++++++++++++++++++++++++-------- + src/opengl/qwindowsurface_gl.cpp | 9 ++++----- + 3 files changed, 36 insertions(+), 14 deletions(-) + +diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h +index ab72c9c..b2407ba 100644 +--- a/src/opengl/qgl_p.h ++++ b/src/opengl/qgl_p.h +@@ -518,7 +518,8 @@ bool qt_gl_preferGL2Engine(); + + inline GLenum qt_gl_preferredTextureFormat() + { +- return QSysInfo::ByteOrder == QSysInfo::BigEndian ? GL_RGBA : GL_BGRA; ++ return (QGLExtensions::glExtensions & QGLExtensions::BGRATextureFormat) && QSysInfo::ByteOrder == QSysInfo::LittleEndian ++ ? GL_BGRA : GL_RGBA; + } + + inline GLenum qt_gl_preferredTextureTarget() +diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp +index fb55097..ab17789 100644 +--- a/src/opengl/qpixmapdata_gl.cpp ++++ b/src/opengl/qpixmapdata_gl.cpp +@@ -321,25 +321,47 @@ void QGLPixmapData::ensureCreated() const + QGLShareContextScope ctx(qt_gl_share_widget()->context()); + m_ctx = ctx; + +- const GLenum format = qt_gl_preferredTextureFormat(); ++ const GLenum internal_format = m_hasAlpha ? GL_RGBA : GL_RGB; ++#ifdef QT_OPENGL_ES_2 ++ const GLenum external_format = internal_format; ++#else ++ const GLenum external_format = qt_gl_preferredTextureFormat(); ++#endif + const GLenum target = GL_TEXTURE_2D; + + if (!m_texture.id) { + glGenTextures(1, &m_texture.id); + glBindTexture(target, m_texture.id); +- GLenum format = m_hasAlpha ? GL_RGBA : GL_RGB; +- glTexImage2D(target, 0, format, w, h, 0, +- GL_RGBA, GL_UNSIGNED_BYTE, 0); ++ glTexImage2D(target, 0, internal_format, w, h, 0, external_format, GL_UNSIGNED_BYTE, 0); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + } + + if (!m_source.isNull()) { +- const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, format); ++ if (external_format == GL_RGB) { ++ QImage tx = m_source.convertToFormat(QImage::Format_RGB32); ++ ++ QVector<uchar> pixelData(w * h * 3); ++ uchar *p = &pixelData[0]; ++ QRgb *src = (QRgb *)tx.bits(); ++ ++ for (int i = 0; i < w * h; ++i) { ++ *p++ = qRed(*src); ++ *p++ = qGreen(*src); ++ *p++ = qBlue(*src); ++ ++src; ++ } + +- glBindTexture(target, m_texture.id); +- glTexSubImage2D(target, 0, 0, 0, w, h, format, +- GL_UNSIGNED_BYTE, tx.bits()); ++ glBindTexture(target, m_texture.id); ++ glTexSubImage2D(target, 0, 0, 0, w, h, external_format, ++ GL_UNSIGNED_BYTE, &pixelData[0]); ++ } else { ++ const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, external_format); ++ ++ glBindTexture(target, m_texture.id); ++ glTexSubImage2D(target, 0, 0, 0, w, h, external_format, ++ GL_UNSIGNED_BYTE, tx.bits()); ++ } + + if (useFramebufferObjects()) + m_source = QImage(); +diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp +index e353f5d..7194f9d 100644 +--- a/src/opengl/qwindowsurface_gl.cpp ++++ b/src/opengl/ |
