From 8fb90ce32dde5d4045c23ff44f29d19054db0d9b Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Mon, 30 May 2011 14:02:15 +0300 Subject: Fix for BCM2727 chip detection on Symbian QSymbianGraphcisSystemEx::hasBCM2727() uses bool QApplicationPrivate::useTranslucentEGLSurfaces to decide if Symbian is running on BCM2727 chip which is not entirely correct. bool QApplicationPrivate::useTranslucentEGLSurfaces should be assigned according to QSymbianGraphcisSystemEx::hasBCM2727() and QSymbianGraphcisSystemEx::hasBCM2727() should be also static function. Task-number: QTBUG-19578 Reviewed-by: Laszlo Agocs --- src/gui/kernel/qapplication_s60.cpp | 23 ++++------------ src/gui/painting/qgraphicssystemex_symbian.cpp | 36 +++++++++++++++++++++----- src/gui/painting/qgraphicssystemex_symbian_p.h | 3 ++- src/opengl/qgl_symbian.cpp | 4 +-- 4 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 96ac6f4..6d1b96f 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -74,6 +74,7 @@ # include # include "qs60mainappui.h" # include "qinputcontext.h" +# include #endif #if defined(Q_WS_S60) @@ -1835,26 +1836,12 @@ void qt_init(QApplicationPrivate * /* priv */, int) #ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE QApplicationPrivate::instance()->useTranslucentEGLSurfaces = true; - const TUid KIvePropertyCat = {0x2726beef}; - enum TIvePropertyChipType { - EVCBCM2727B1 = 0x00000000, - EVCBCM2763A0 = 0x04000100, - EVCBCM2763B0 = 0x04000102, - EVCBCM2763C0 = 0x04000103, - EVCBCM2763C1 = 0x04000104, - EVCBCMUnknown = 0x7fffffff - }; - - TInt chipType = EVCBCMUnknown; - if (RProperty::Get(KIvePropertyCat, 0 /*chip type*/, chipType) == KErrNone) { - if (chipType == EVCBCM2727B1) { - // We have only 32MB GPU memory. Use raster surfaces - // for transparent TLWs. - QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; - } - } else { + if (QSymbianGraphicsSystemEx::hasBCM2727()) { + // We have only 32MB GPU memory. Use raster surfaces + // for transparent TLWs. QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; } + if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; #else diff --git a/src/gui/painting/qgraphicssystemex_symbian.cpp b/src/gui/painting/qgraphicssystemex_symbian.cpp index 980f72c..dc4dd92 100644 --- a/src/gui/painting/qgraphicssystemex_symbian.cpp +++ b/src/gui/painting/qgraphicssystemex_symbian.cpp @@ -45,10 +45,39 @@ #include "private/qapplication_p.h" #include "qwidget_p.h" -#include +#include QT_BEGIN_NAMESPACE +static bool bcm2727Initialized = false; +static bool bcm2727 = false; + +bool QSymbianGraphicsSystemEx::hasBCM2727() +{ + if (bcm2727Initialized) + return bcm2727; + + const TUid KIvePropertyCat = {0x2726beef}; + enum TIvePropertyChipType { + EVCBCM2727B1 = 0x00000000, + EVCBCM2763A0 = 0x04000100, + EVCBCM2763B0 = 0x04000102, + EVCBCM2763C0 = 0x04000103, + EVCBCM2763C1 = 0x04000104, + EVCBCMUnknown = 0x7fffffff + }; + + TInt chipType = EVCBCMUnknown; + if (RProperty::Get(KIvePropertyCat, 0, chipType) == KErrNone) { + if (chipType == EVCBCM2727B1) + bcm2727 = true; + } + + bcm2727Initialized = true; + + return bcm2727; +} + void QSymbianGraphicsSystemEx::releaseCachedGpuResources() { // Do nothing here @@ -65,11 +94,6 @@ void QSymbianGraphicsSystemEx::releaseAllGpuResources() } } -bool QSymbianGraphicsSystemEx::hasBCM2727() -{ - return !QApplicationPrivate::instance()->useTranslucentEGLSurfaces; -} - void QSymbianGraphicsSystemEx::forceToRaster(QWidget *window) { if (window && window->isWindow()) { diff --git a/src/gui/painting/qgraphicssystemex_symbian_p.h b/src/gui/painting/qgraphicssystemex_symbian_p.h index c1d1bdf..1f2a7c6 100644 --- a/src/gui/painting/qgraphicssystemex_symbian_p.h +++ b/src/gui/painting/qgraphicssystemex_symbian_p.h @@ -62,9 +62,10 @@ class QWidget; class Q_GUI_EXPORT QSymbianGraphicsSystemEx : public QGraphicsSystemEx { public: + static bool hasBCM2727(); + virtual void releaseCachedGpuResources(); virtual void releaseAllGpuResources(); - virtual bool hasBCM2727(); virtual void forceToRaster(QWidget *window); }; diff --git a/src/opengl/qgl_symbian.cpp b/src/opengl/qgl_symbian.cpp index 91904d0..86176c9 100644 --- a/src/opengl/qgl_symbian.cpp +++ b/src/opengl/qgl_symbian.cpp @@ -183,9 +183,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // almost same as d->ownsEglContext = true; d->eglContext->setApi(QEgl::OpenGL); - QGraphicsSystemEx *ex = QApplicationPrivate::graphicsSystem()->platformExtension(); - QSymbianGraphicsSystemEx *symex = static_cast(ex); - if (symex && !symex->hasBCM2727()) { + if (!QSymbianGraphicsSystemEx::hasBCM2727()) { // Most likely we have hw support for multisampling // so let's enable it. d->glFormat.setSampleBuffers(1); -- cgit v0.12