summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJani Hautakangas <jani.hautakangas@nokia.com>2011-10-14 13:00:15 +0300
committerJani Hautakangas <jani.hautakangas@nokia.com>2011-10-14 19:03:10 +0300
commit2543ed5b1b18864797b3a11c9bd13887c7567e86 (patch)
treeb8855990258d2af17a6528a00cb8f7fd67bf6643 /src
parent5dec90ff13cd96ca4f341cf5e8360037edf5eeb3 (diff)
Add new signals to indicate GPU resource usage.
QML elements that use GPU resources directly needs to know when Qt releases GPU resources and when they are available again. Task-number: QT-5310 Reviewed-by: Samuel Rødal
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qapplication.cpp28
-rw-r--r--src/gui/kernel/qapplication.h4
-rw-r--r--src/gui/kernel/qapplication_p.h3
-rw-r--r--src/gui/kernel/qapplication_s60.cpp24
-rw-r--r--src/s60installs/eabi/QtGuiu.def7
5 files changed, 66 insertions, 0 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 34ce9a8213..34decefba5 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -3389,7 +3389,35 @@ QString QApplication::sessionKey() const
}
#endif
+/*!
+ \since 4.7.4
+ \fn void QApplication::aboutToReleaseGpuResources()
+
+ This signal is emitted when application is about to release all
+ GPU resources accociated to contexts owned by application.
+
+ The signal is particularly useful if your application has allocated
+ GPU resources directly apart from Qt and needs to do some last-second
+ cleanup.
+
+ \warning This signal is only emitted on Symbian.
+
+ \sa aboutToUseGpuResources()
+*/
+/*!
+ \since 4.7.4
+ \fn void QApplication::aboutToUseGpuResources()
+
+ This signal is emitted when application is about to use GPU resources.
+
+ The signal is particularly useful if your application needs to know
+ when GPU resources are be available.
+
+ \warning This signal is only emitted on Symbian.
+
+ \sa aboutToFreeGpuResources()
+*/
/*!
\since 4.2
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index cbf0117f5b..32ff91bbb1 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -298,6 +298,10 @@ Q_SIGNALS:
void commitDataRequest(QSessionManager &sessionManager);
void saveStateRequest(QSessionManager &sessionManager);
#endif
+#ifdef Q_OS_SYMBIAN
+ void aboutToReleaseGpuResources();
+ void aboutToUseGpuResources();
+#endif
public:
QString styleSheet() const;
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 99822e27d1..abdee49966 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -523,6 +523,9 @@ public:
int symbianResourceChange(const QSymbianEvent *symbianEvent);
void _q_aboutToQuit();
+
+ void emitAboutToReleaseGpuResources();
+ void emitAboutToUseGpuResources();
#endif
#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC)
void sendSyntheticEnterLeave(QWidget *widget);
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index a53d273ec4..5c657a43a4 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -207,6 +207,9 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible)
if (QTLWExtra *topData = qt_widget_private(window)->maybeTopData()) {
QWidgetBackingStoreTracker &backingStore = topData->backingStore;
if (visible) {
+ QApplicationPrivate *d = QApplicationPrivate::instance();
+ d->emitAboutToUseGpuResources();
+
if (backingStore.data()) {
backingStore.registerWidget(widget);
} else {
@@ -216,6 +219,9 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible)
widget->repaint();
}
} else {
+ QApplicationPrivate *d = QApplicationPrivate::instance();
+ d->emitAboutToReleaseGpuResources();
+
// In certain special scenarios we may get an ENotVisible event
// without a previous EPartiallyVisible. The backingstore must
// still be destroyed, hence the registerWidget() call below.
@@ -2704,6 +2710,24 @@ void QApplicationPrivate::_q_aboutToQuit()
#endif
}
+void QApplicationPrivate::emitAboutToReleaseGpuResources()
+{
+#ifdef Q_SYMBIAN_SUPPORTS_SURFACES
+ Q_Q(QApplication);
+ QPointer<QApplication> guard(q);
+ emit q->aboutToReleaseGpuResources();
+#endif
+}
+
+void QApplicationPrivate::emitAboutToUseGpuResources()
+{
+#ifdef Q_SYMBIAN_SUPPORTS_SURFACES
+ Q_Q(QApplication);
+ QPointer<QApplication> guard(q);
+ emit q->aboutToUseGpuResources();
+#endif
+}
+
QS60ThreadLocalData::QS60ThreadLocalData()
{
CCoeEnv *env = CCoeEnv::Static();
diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def
index 6028a6df6e..723fcf65a7 100644
--- a/src/s60installs/eabi/QtGuiu.def
+++ b/src/s60installs/eabi/QtGuiu.def
@@ -12198,4 +12198,11 @@ EXPORTS
_ZNK11QPixmapData15toVolatileImageEv @ 12197 NONAME
_ZNK14QVolatileImage13constImageRefEv @ 12198 NONAME
_Z43qt_s60_setPartialScreenAutomaticTranslationb @ 12199 NONAME
+ _ZN11QTextEngine16getClusterLengthEPtPK17HB_CharAttributesiiiPi @ 12200 NONAME
+ _ZN11QTextEngine18positionInLigatureEPK11QScriptItemi6QFixedS3_ib @ 12201 NONAME
+ _ZN12QApplication22aboutToUseGpuResourcesEv @ 12202 NONAME
+ _ZN12QApplication26aboutToReleaseGpuResourcesEv @ 12203 NONAME
+ _ZN14QWidgetPrivate16_q_cleanupWinIdsEv @ 12204 NONAME
+ _ZN19QApplicationPrivate26emitAboutToUseGpuResourcesEv @ 12205 NONAME
+ _ZN19QApplicationPrivate30emitAboutToReleaseGpuResourcesEv @ 12206 NONAME