PDA

View Full Version : Huge performance hit using QPainter in QGLWidget on N900's Maemo



dragly
3rd May 2010, 18:59
I have a huge performance problem when I'm using QPainter's drawRect function in a QGLWidget on Maemo on the Nokia N900. The FPS drops to ~2-3 and the device is completely unusable. The performance hit is quite strange, as it does not appear all the time, but just most of the times I run the application on the device. Other times it runs fine, with an FPS of ~40-50.

The error is directly connected to the QPainter class, as I have a button in my application to activate the QPainter drawing of rectangles (used for menus and windows). Also, if I comment out the drawRect functions, but leave everything else as-is, it runs smoothly. QPainter's drawText function does run smoothly, however.

Running the application in Ubuntu or on Windows does not show a performance hit at all (not even slightly), so this is strictly related to the Maemo device. The device is running the libqt4-maemo5-* libraries.

Do you guys happen to know how I could try to debug this? I'm kind of stuck between wondering if there is something wrong with my mobile or Qt's drawRect-function - or my own code, of course.

wysota
4th May 2010, 22:25
Could you post a minimal compilable example reproducing the problem?

dragly
4th May 2010, 23:01
I don't have a small example, but you could of course try to download the full source of our project and compile it yourself. There should be no other dependencies but Qt's.

The project is hosted here:
http://github.com/dragly/loose_cannon
And here is a direct link to a zip-ball:
http://github.com/dragly/loose_cannon/zipball/master

wysota
5th May 2010, 02:15
So where is the slowdown? The application runs for me at ~50fps all the time.

dragly
5th May 2010, 13:24
So where is the slowdown? The application runs for me at ~50fps all the time.

Sorry, I forgot to mention that you have to remove
#ifndef Q_WS_MAEMO_5 from glwidget.cpp's paintGL function to run it with the code that slows down the device. It was commented out so we could continue testing while trying to work out the UI problem. The ifndef is found here:
http://github.com/dragly/loose_cannon/blob/master/glwidget.cpp#L660-689

The device should slow down if you hit the "Unit" or "Radar" keys to the right, but if it doesn't it might be something faulty with my device.