summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-04-04 00:34:09 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-04-04 00:36:10 (GMT)
commit11fdefebdd26e5cef4736384f2f3ad0cafc2db1e (patch)
treef6136beaf51e1327431c1e29a114012f000135b9 /src
parent3cfa6a8b5338c2490dda498ba4a27a2917675b72 (diff)
downloadQt-11fdefebdd26e5cef4736384f2f3ad0cafc2db1e.zip
Qt-11fdefebdd26e5cef4736384f2f3ad0cafc2db1e.tar.gz
Qt-11fdefebdd26e5cef4736384f2f3ad0cafc2db1e.tar.bz2
Add some timing capabilities
Add some frames-per-second output for debugging when QT_DIRECTFB_TIMING is defined. Reviewed-by: Donald <qt-info@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/gfxdrivers/directfb/directfb.pro1
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp18
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbsurface.h8
3 files changed, 26 insertions, 1 deletions
diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro
index 96eb536..399044e 100644
--- a/src/plugins/gfxdrivers/directfb/directfb.pro
+++ b/src/plugins/gfxdrivers/directfb/directfb.pro
@@ -12,6 +12,7 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers
#DEFINES += QT_NO_DIRECTFB_PREALLOCATED
#DEFINES += QT_NO_DIRECTFB_MOUSE
#DEFINES += QT_NO_DIRECTFB_KEYBOARD
+#DEFINES += QT_DIRECTFB_TIMING
target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers
INSTALLS += target
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp
index c495805..ef208af 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp
@@ -58,6 +58,10 @@ QDirectFBSurface::QDirectFBSurface(QDirectFBScreen* scr)
, engine(0)
{
setSurfaceFlags(Opaque | Buffered);
+#ifdef QT_DIRECTFB_TIMING
+ frames = 0;
+ timer.start();
+#endif
}
QDirectFBSurface::QDirectFBSurface(QDirectFBScreen* scr, QWidget *widget)
@@ -72,6 +76,10 @@ QDirectFBSurface::QDirectFBSurface(QDirectFBScreen* scr, QWidget *widget)
setSurfaceFlags(Opaque | RegionReserved);
else
setSurfaceFlags(Opaque | Buffered);
+#ifdef QT_DIRECTFB_TIMING
+ frames = 0;
+ timer.start();
+#endif
}
QDirectFBSurface::~QDirectFBSurface()
@@ -307,7 +315,6 @@ inline bool isWidgetOpaque(const QWidget *w)
return false;
}
-
void QDirectFBSurface::flush(QWidget *widget, const QRegion &region,
const QPoint &offset)
{
@@ -350,6 +357,15 @@ void QDirectFBSurface::flush(QWidget *widget, const QRegion &region,
dfbSurface->Flip(dfbSurface, &dfbReg, DSFLIP_ONSYNC);
}
#endif
+#ifdef QT_DIRECTFB_TIMING
+ enum { Secs = 3 };
+ ++frames;
+ if (timer.elapsed() >= Secs * 1000) {
+ qDebug("%d fps", int(double(frames) / double(Secs)));
+ frames = 0;
+ timer.restart();
+ }
+#endif
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.h
index a9cdb7d..9e2791c 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.h
@@ -50,6 +50,10 @@
#include <private/qwindowsurface_qws_p.h>
#include <directfb.h>
+#ifdef QT_DIRECTFB_TIMING
+#include <qdatetime.h>
+#endif
+
QT_BEGIN_HEADER
QT_MODULE(Gui)
@@ -95,6 +99,10 @@ private:
bool onscreen;
QList<QImage*> bufferImages;
+#ifdef QT_DIRECTFB_TIMING
+ int frames;
+ QTime timer;
+#endif
};
QT_END_HEADER