summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJani Hautakangas <jani.hautakangas@nokia.com>2011-02-28 20:48:12 (GMT)
committerJani Hautakangas <jani.hautakangas@nokia.com>2011-03-01 06:14:16 (GMT)
commit4e464f42d5933dcc8535f978e25eeb7fd8a57284 (patch)
treeea7c623055e2aa67be15f7f2df9db13fe9ff634d /src
parentae6bc1d824f5ae24a259be0c68241873cb96739f (diff)
downloadQt-4e464f42d5933dcc8535f978e25eeb7fd8a57284.zip
Qt-4e464f42d5933dcc8535f978e25eeb7fd8a57284.tar.gz
Qt-4e464f42d5933dcc8535f978e25eeb7fd8a57284.tar.bz2
Add internal function for releasing cached GPU resources.
Task-number: QTBUG-17849 Reviewed-by: Samuel Rødal
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qgraphicssystem.cpp5
-rw-r--r--src/gui/painting/qgraphicssystem_p.h2
-rw-r--r--src/openvg/qvgimagepool.cpp15
-rw-r--r--src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp6
-rw-r--r--src/plugins/graphicssystems/openvg/qgraphicssystem_vg_p.h2
-rw-r--r--src/s60installs/bwins/QtGuiu.def3
-rw-r--r--src/s60installs/eabi/QtGuiu.def1
7 files changed, 31 insertions, 3 deletions
diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp
index 770d947..5112019 100644
--- a/src/gui/painting/qgraphicssystem.cpp
+++ b/src/gui/painting/qgraphicssystem.cpp
@@ -84,4 +84,9 @@ QPixmapData *QGraphicsSystem::createPixmapData(QPixmapData *origin)
return createPixmapData(origin->pixelType());
}
+void QGraphicsSystem::releaseCachedResources()
+{
+ // Do nothing here
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h
index 76e9a8e..80e8959 100644
--- a/src/gui/painting/qgraphicssystem_p.h
+++ b/src/gui/painting/qgraphicssystem_p.h
@@ -72,6 +72,8 @@ public:
//### Remove this & change qpixmap.cpp & qbitmap.cpp once every platform is gaurenteed
// to have a graphics system.
static QPixmapData *createDefaultPixmapData(QPixmapData::PixelType type);
+
+ virtual void releaseCachedResources();
};
QT_END_NAMESPACE
diff --git a/src/openvg/qvgimagepool.cpp b/src/openvg/qvgimagepool.cpp
index a2b1c4e..35cf2f5 100644
--- a/src/openvg/qvgimagepool.cpp
+++ b/src/openvg/qvgimagepool.cpp
@@ -175,8 +175,19 @@ bool QVGImagePool::reclaimSpace(VGImageFormat format,
void QVGImagePool::hibernate()
{
- // Nothing to do here at the moment since the pool does not
- // retain VGImage's after they have been released.
+ Q_D(QVGImagePool);
+ QVGPixmapData *pd = d->lruLast;
+ while(pd) {
+ QVGPixmapData *prevLRU = pd->prevLRU;
+ pd->inImagePool = false;
+ pd->inLRU = false;
+ pd->nextLRU = 0;
+ pd->prevLRU = 0;
+ pd->hibernate();
+ pd = prevLRU;
+ }
+ d->lruFirst = 0;
+ d->lruLast = 0;
}
void QVGImagePool::moveToHeadOfLRU(QVGPixmapData *data)
diff --git a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp b/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp
index 0c107b5..1da58e1 100644
--- a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp
+++ b/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp
@@ -42,6 +42,7 @@
#include "qgraphicssystem_vg_p.h"
#include <QtOpenVG/private/qpixmapdata_vg_p.h>
#include <QtOpenVG/private/qwindowsurface_vg_p.h>
+#include <QtOpenVG/private/qvgimagepool_p.h>
#if defined(Q_OS_SYMBIAN) && !defined(Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE)
#include <QtGui/private/qwidget_p.h>
#endif
@@ -77,4 +78,9 @@ QWindowSurface *QVGGraphicsSystem::createWindowSurface(QWidget *widget) const
return new QVGWindowSurface(widget);
}
+void QVGGraphicsSystem::releaseCachedResources()
+{
+ QVGImagePool::instance()->hibernate();
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg_p.h b/src/plugins/graphicssystems/openvg/qgraphicssystem_vg_p.h
index d1bce28..9c9b3e2 100644
--- a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg_p.h
+++ b/src/plugins/graphicssystems/openvg/qgraphicssystem_vg_p.h
@@ -64,6 +64,8 @@ public:
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
QWindowSurface *createWindowSurface(QWidget *widget) const;
+
+ void releaseCachedResources();
};
QT_END_NAMESPACE
diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def
index 016acd2..8602d64 100644
--- a/src/s60installs/bwins/QtGuiu.def
+++ b/src/s60installs/bwins/QtGuiu.def
@@ -12934,5 +12934,6 @@ EXPORTS
?setAlphaChannel@QVolatileImage@@QAEXABVQPixmap@@@Z @ 12933 NONAME ; void QVolatileImage::setAlphaChannel(class QPixmap const &)
?byteCount@QVolatileImage@@QBEHXZ @ 12934 NONAME ; int QVolatileImage::byteCount(void) const
??0QVolatileImage@@QAE@ABV0@@Z @ 12935 NONAME ; QVolatileImage::QVolatileImage(class QVolatileImage const &)
- ?depth@QVolatileImage@@QBEHXZ @ 12936 NONAME ; int QVolatileImage::depth(void) const
+ ?depth@QVolatileImage@@QBEHXZ @ 12936 NONAME ; int QVolatileImage::depth(void) const
+ ?releaseCachedResources@QGraphicsSystem@@UAEXXZ @ 12937 NONAME ; void QGraphicsSystem::releaseCachedResources(void)
diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def
index b212448..615a65d 100644
--- a/src/s60installs/eabi/QtGuiu.def
+++ b/src/s60installs/eabi/QtGuiu.def
@@ -12141,4 +12141,5 @@ EXPORTS
_ZNK14QVolatileImage7toImageEv @ 12140 NONAME
_ZNK14QVolatileImage9byteCountEv @ 12141 NONAME
_ZNK14QVolatileImage9constBitsEv @ 12142 NONAME
+ _ZN15QGraphicsSystem22releaseCachedResourcesEv @ 12143 NONAME