From 0e647aeb6a49a0fc9b5605031f246bb79dd6a6fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Tue, 15 Sep 2015 18:17:06 +0200 Subject: Blacklist PowerVR Rogue G6200 (v1.3) from supporting BGRA. The drivers for PowerVR Rogue G6200 reports BGRA support, but reading from the FBO does not produce the correct result. Initially reported here: http://launchpad.net/bugs/1436074 Change-Id: Ia173817d557446818d08609d943eb3573b900cc3 Reviewed-by: Gunnar Sletta --- src/gui/opengl/qopenglframebufferobject.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/gui/opengl/qopenglframebufferobject.cpp') diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 8d298496df..1cf748d15f 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -43,6 +43,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -1141,9 +1142,19 @@ static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool includ #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN // Without GL_UNSIGNED_INT_8_8_8_8_REV, GL_BGRA only makes sense on little endian. - const bool supports_bgra = context->isOpenGLES() - ? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra")) - : context->hasExtension(QByteArrayLiteral("GL_EXT_bgra")); + const bool has_bgra_ext = context->isOpenGLES() + ? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra")) + : context->hasExtension(QByteArrayLiteral("GL_EXT_bgra")); + + const char *renderer = reinterpret_cast(funcs->glGetString(GL_RENDERER)); + const char *ver = reinterpret_cast(funcs->glGetString(GL_VERSION)); + + // Blacklist PowerVR Rogue G6200 as it has problems with its BGRA support. + const bool blackListed = (qstrcmp(renderer, "PowerVR Rogue G6200") == 0 + && ::strstr(ver, "1.3") != 0); + + const bool supports_bgra = has_bgra_ext && !blackListed; + if (supports_bgra) { QImage img(size, include_alpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32); funcs->glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, img.bits()); -- cgit v1.2.3