From 4e464f42d5933dcc8535f978e25eeb7fd8a57284 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Mon, 28 Feb 2011 22:48:12 +0200 Subject: Add internal function for releasing cached GPU resources. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-17849 Reviewed-by: Samuel Rødal --- src/gui/painting/qgraphicssystem.cpp | 5 +++++ src/gui/painting/qgraphicssystem_p.h | 2 ++ src/openvg/qvgimagepool.cpp | 15 +++++++++++++-- src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp | 6 ++++++ src/plugins/graphicssystems/openvg/qgraphicssystem_vg_p.h | 2 ++ src/s60installs/bwins/QtGuiu.def | 3 ++- src/s60installs/eabi/QtGuiu.def | 1 + 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 #include +#include #if defined(Q_OS_SYMBIAN) && !defined(Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE) #include #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 -- cgit v0.12