summaryrefslogtreecommitdiffstats
path: root/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-08-24 15:34:08 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-08-25 19:15:08 (GMT)
commit6a546cadf18b2c73d32868d84a8e3edc4455d508 (patch)
tree5494bf4c3c1018954e0b7218a6934ac4d97fc53f /src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
parentdc4e9f4bb91237b26b82e27310eda6808786ce36 (diff)
downloadQt-6a546cadf18b2c73d32868d84a8e3edc4455d508.zip
Qt-6a546cadf18b2c73d32868d84a8e3edc4455d508.tar.gz
Qt-6a546cadf18b2c73d32868d84a8e3edc4455d508.tar.bz2
Implement support for keeping image provider alive
If you define QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE we make sure atleast one IDirectFBImageProvider is alive at all times. Apparently this is refcounted by DirectFB on atleast one implementation and there's considerable overhead involved when releasing the last/creating the first image provider. Reviewed-by: TrustMe
Diffstat (limited to 'src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index ecd4aba..3911178 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -87,6 +87,9 @@ public:
#ifndef QT_NO_DIRECTFB_KEYBOARD
QDirectFBKeyboardHandler *keyboard;
#endif
+#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
+ IDirectFBImageProvider *imageProvider;
+#endif
QColor backgroundColor;
QDirectFBScreen *q;
};
@@ -109,6 +112,9 @@ QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr)
#ifndef QT_NO_DIRECTFB_KEYBOARD
, keyboard(0)
#endif
+#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
+ , imageProvider(0)
+#endif
, q(qptr)
{
#ifndef QT_NO_QWS_SIGNALHANDLER
@@ -128,6 +134,10 @@ QDirectFBScreenPrivate::~QDirectFBScreenPrivate()
#ifndef QT_NO_DIRECTFB_KEYBOARD
delete keyboard;
#endif
+#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
+ if (imageProvider)
+ imageProvider->Release(imageProvider);
+#endif
for (QSet<IDirectFBSurface*>::const_iterator it = allocatedSurfaces.begin(); it != allocatedSurfaces.end(); ++it) {
(*it)->Release(*it);
@@ -1097,6 +1107,10 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
void QDirectFBScreen::disconnect()
{
+#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
+ if (d_ptr->imageProvider)
+ d_ptr->imageProvider->Release(d_ptr->imageProvider);
+#endif
#ifdef QT_NO_DIRECTFB_WM
d_ptr->primarySurface->Release(d_ptr->primarySurface);
d_ptr->primarySurface = 0;
@@ -1375,4 +1389,15 @@ void QDirectFBScreen::flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags
}
}
+#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
+void QDirectFBScreen::setDirectFBImageProvider(IDirectFBImageProvider *provider)
+{
+ Q_ASSERT(provider);
+ if (d_ptr->imageProvider)
+ d_ptr->imageProvider->Release(d_ptr->imageProvider);
+ d_ptr->imageProvider = provider;
+}
+#endif
+
+