Skip to content

Commit 2543ed5

Browse files
author
Jani Hautakangas
committed
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
1 parent 5dec90f commit 2543ed5

File tree

5 files changed

+66
-0
lines changed

5 files changed

+66
-0
lines changed

src/gui/kernel/qapplication.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3389,7 +3389,35 @@ QString QApplication::sessionKey() const
33893389
}
33903390
#endif
33913391

3392+
/*!
3393+
\since 4.7.4
3394+
\fn void QApplication::aboutToReleaseGpuResources()
3395+
3396+
This signal is emitted when application is about to release all
3397+
GPU resources accociated to contexts owned by application.
3398+
3399+
The signal is particularly useful if your application has allocated
3400+
GPU resources directly apart from Qt and needs to do some last-second
3401+
cleanup.
3402+
3403+
\warning This signal is only emitted on Symbian.
3404+
3405+
\sa aboutToUseGpuResources()
3406+
*/
33923407

3408+
/*!
3409+
\since 4.7.4
3410+
\fn void QApplication::aboutToUseGpuResources()
3411+
3412+
This signal is emitted when application is about to use GPU resources.
3413+
3414+
The signal is particularly useful if your application needs to know
3415+
when GPU resources are be available.
3416+
3417+
\warning This signal is only emitted on Symbian.
3418+
3419+
\sa aboutToFreeGpuResources()
3420+
*/
33933421

33943422
/*!
33953423
\since 4.2

src/gui/kernel/qapplication.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,10 @@ class Q_GUI_EXPORT QApplication : public QCoreApplication
298298
void commitDataRequest(QSessionManager &sessionManager);
299299
void saveStateRequest(QSessionManager &sessionManager);
300300
#endif
301+
#ifdef Q_OS_SYMBIAN
302+
void aboutToReleaseGpuResources();
303+
void aboutToUseGpuResources();
304+
#endif
301305

302306
public:
303307
QString styleSheet() const;

src/gui/kernel/qapplication_p.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,9 @@ class Q_GUI_EXPORT QApplicationPrivate : public QCoreApplicationPrivate
523523
int symbianResourceChange(const QSymbianEvent *symbianEvent);
524524

525525
void _q_aboutToQuit();
526+
527+
void emitAboutToReleaseGpuResources();
528+
void emitAboutToUseGpuResources();
526529
#endif
527530
#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC)
528531
void sendSyntheticEnterLeave(QWidget *widget);

src/gui/kernel/qapplication_s60.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible)
207207
if (QTLWExtra *topData = qt_widget_private(window)->maybeTopData()) {
208208
QWidgetBackingStoreTracker &backingStore = topData->backingStore;
209209
if (visible) {
210+
QApplicationPrivate *d = QApplicationPrivate::instance();
211+
d->emitAboutToUseGpuResources();
212+
210213
if (backingStore.data()) {
211214
backingStore.registerWidget(widget);
212215
} else {
@@ -216,6 +219,9 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible)
216219
widget->repaint();
217220
}
218221
} else {
222+
QApplicationPrivate *d = QApplicationPrivate::instance();
223+
d->emitAboutToReleaseGpuResources();
224+
219225
// In certain special scenarios we may get an ENotVisible event
220226
// without a previous EPartiallyVisible. The backingstore must
221227
// still be destroyed, hence the registerWidget() call below.
@@ -2704,6 +2710,24 @@ void QApplicationPrivate::_q_aboutToQuit()
27042710
#endif
27052711
}
27062712

2713+
void QApplicationPrivate::emitAboutToReleaseGpuResources()
2714+
{
2715+
#ifdef Q_SYMBIAN_SUPPORTS_SURFACES
2716+
Q_Q(QApplication);
2717+
QPointer<QApplication> guard(q);
2718+
emit q->aboutToReleaseGpuResources();
2719+
#endif
2720+
}
2721+
2722+
void QApplicationPrivate::emitAboutToUseGpuResources()
2723+
{
2724+
#ifdef Q_SYMBIAN_SUPPORTS_SURFACES
2725+
Q_Q(QApplication);
2726+
QPointer<QApplication> guard(q);
2727+
emit q->aboutToUseGpuResources();
2728+
#endif
2729+
}
2730+
27072731
QS60ThreadLocalData::QS60ThreadLocalData()
27082732
{
27092733
CCoeEnv *env = CCoeEnv::Static();

src/s60installs/eabi/QtGuiu.def

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12198,4 +12198,11 @@ EXPORTS
1219812198
_ZNK11QPixmapData15toVolatileImageEv @ 12197 NONAME
1219912199
_ZNK14QVolatileImage13constImageRefEv @ 12198 NONAME
1220012200
_Z43qt_s60_setPartialScreenAutomaticTranslationb @ 12199 NONAME
12201+
_ZN11QTextEngine16getClusterLengthEPtPK17HB_CharAttributesiiiPi @ 12200 NONAME
12202+
_ZN11QTextEngine18positionInLigatureEPK11QScriptItemi6QFixedS3_ib @ 12201 NONAME
12203+
_ZN12QApplication22aboutToUseGpuResourcesEv @ 12202 NONAME
12204+
_ZN12QApplication26aboutToReleaseGpuResourcesEv @ 12203 NONAME
12205+
_ZN14QWidgetPrivate16_q_cleanupWinIdsEv @ 12204 NONAME
12206+
_ZN19QApplicationPrivate26emitAboutToUseGpuResourcesEv @ 12205 NONAME
12207+
_ZN19QApplicationPrivate30emitAboutToReleaseGpuResourcesEv @ 12206 NONAME
1220112208

0 commit comments

Comments
 (0)