Android: use fbo read back workaround with specific GPUs.

Namely, the Mali 400 and the Adreno 200. We used to enable this
workaround only for the Samsung Galaxy Tab 3, which has a Mali
400. The same problem was confirmed with the Samsung Galaxy
Note N7000 (Mali 400) and the ZTE Blade (Adreno 200).

Task-number: QTBUG-33951
Task-number: QTBUG-34984
Change-Id: Ic624962986f718285b98ab4ca48e22f9aa110753
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
Yoann Lopes 2014-03-25 17:31:09 +01:00 committed by The Qt Project
parent e7270b68fe
commit b3f201b8af
4 changed files with 22 additions and 4 deletions

View File

@ -132,7 +132,7 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &para
m_androidSystemLocale = new QAndroidSystemLocale; m_androidSystemLocale = new QAndroidSystemLocale;
} }
bool QAndroidPlatformIntegration::needsWorkaround() bool QAndroidPlatformIntegration::needsBasicRenderloopWorkaround()
{ {
static bool needsWorkaround = static bool needsWorkaround =
QtAndroid::deviceName().compare(QStringLiteral("samsung SM-T211"), Qt::CaseInsensitive) == 0 QtAndroid::deviceName().compare(QStringLiteral("samsung SM-T211"), Qt::CaseInsensitive) == 0
@ -150,7 +150,7 @@ bool QAndroidPlatformIntegration::hasCapability(Capability cap) const
case OpenGL: return true; case OpenGL: return true;
case ForeignWindows: return true; case ForeignWindows: return true;
case ThreadedOpenGL: case ThreadedOpenGL:
if (needsWorkaround()) if (needsBasicRenderloopWorkaround())
return false; return false;
else else
return true; return true;

View File

@ -120,9 +120,9 @@ public:
QTouchDevice *touchDevice() const { return m_touchDevice; } QTouchDevice *touchDevice() const { return m_touchDevice; }
void setTouchDevice(QTouchDevice *touchDevice) { m_touchDevice = touchDevice; } void setTouchDevice(QTouchDevice *touchDevice) { m_touchDevice = touchDevice; }
static bool needsWorkaround();
EGLDisplay m_eglDisplay; EGLDisplay m_eglDisplay;
private: private:
static bool needsBasicRenderloopWorkaround();
QTouchDevice *m_touchDevice; QTouchDevice *m_touchDevice;

View File

@ -62,6 +62,22 @@ void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface)
static_cast<QAndroidPlatformOpenGLWindow *>(surface)->checkNativeSurface(eglConfig()); static_cast<QAndroidPlatformOpenGLWindow *>(surface)->checkNativeSurface(eglConfig());
} }
bool QAndroidPlatformOpenGLContext::needsFBOReadBackWorkaroud()
{
static bool set = false;
static bool needsWorkaround = false;
if (!set) {
const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
needsWorkaround =
qstrcmp(rendererString, "Mali-400 MP") == 0
|| qstrcmp(rendererString, "Adreno (TM) 200") == 0;
set = true;
}
return needsWorkaround;
}
bool QAndroidPlatformOpenGLContext::makeCurrent(QPlatformSurface *surface) bool QAndroidPlatformOpenGLContext::makeCurrent(QPlatformSurface *surface)
{ {
bool ret = QEGLPlatformContext::makeCurrent(surface); bool ret = QEGLPlatformContext::makeCurrent(surface);
@ -71,7 +87,7 @@ bool QAndroidPlatformOpenGLContext::makeCurrent(QPlatformSurface *surface)
if (rendererString != 0 && qstrncmp(rendererString, "Android Emulator", 16) == 0) if (rendererString != 0 && qstrncmp(rendererString, "Android Emulator", 16) == 0)
ctx_d->workaround_missingPrecisionQualifiers = true; ctx_d->workaround_missingPrecisionQualifiers = true;
if (!ctx_d->workaround_brokenFBOReadBack && QAndroidPlatformIntegration::needsWorkaround()) if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaroud())
ctx_d->workaround_brokenFBOReadBack = true; ctx_d->workaround_brokenFBOReadBack = true;
return ret; return ret;

View File

@ -56,6 +56,8 @@ public:
private: private:
virtual EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface); virtual EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface);
static bool needsFBOReadBackWorkaroud();
}; };
QT_END_NAMESPACE QT_END_NAMESPACE