How to drastically boost up your KDE 4 performance by using the Qt raster rendering engine

The release of the KDE SC version 4 series hasn’t been a success story in the first place. The first versions of KDE 4 are known to be buggy and slow. But the situation is constantly getting better. And since the release of KDE SC 4.3, it may be stated that the KDE software collection is quite useful in a productive environment. However, although the performance of KDE is constantly improving, it has never reached a state so far where it felt completely fast to me (such as GNOME, KDE 3, or lightweight desktop environments like XFCE, LXDE, or fluxbox do). A little bit of bubble gum always remained.

Until I found the »raster engine« of Qt. Qt can use different ways of painting widgets on your screen. On GNU/Linux and other Unix-like operating systems, Qt normally uses the X11/XRender method for that. But since Qt version 4.5, you can also instruct Qt to use the raster engine on X11 instead. The raster engine is the reference rendering engine of Qt 4, and it is used as the native painting method on Windows. Roughly speaking, instead of asking the X server to paint some lines, some circles, etc., the raster engine only takes a raw shared memory image buffer from the X server and paints all the stuff it needs on its own into this buffer. Theoretically, the X11/XRender method shouldn’t necessarily be slower, but it is. I won’t get further into the details here, but you can get some deeper information about the Qt raster engine for example here or here.

You can start a Qt program using the raster engine directly by adding the -graphicssystem raster parameter on the command line. And as you can see, this may have a strong impact on the applications performance. But, as far as I know, there is currently no way of changing the Qt rendering engine globally without recompiling it. There are some workarounds (BTW: You need to add the /usr/share/autostart/*.desktop directory to the goraster.sh script posted there for the script to have an effect at system startup), but imho they aren’t very satisfying.

Therefore, I created a PPA repository for Ubuntu Lucid containg Qt compiled with the raster engine enabled. If you have added the Kubuntu backports PPA repository to your software sources to get newer versions of KDE SC, you should use this repository, because the Kubuntu backports PPA provides a newer version of Qt.

With the help of the Debian package versioning scheme, I guarantee that my packages only supersede the corresponding Qt packages of the same version, but not newer ones. This is necessary to keep the package dependencies consistent. I try to update my repositories as soon as a new version appears in the Ubuntu repository or the Kubuntu backports PPA, but I can’t promise to be always fast ;).

Some known issues at the end: The rastering engine can slow down the process of X-forwarding your Qt programs to another desktop, because with raster, complete images need to be transfered through the network instead of (more or less) only X commands. Furthermore, the rastering engine may break the OpenOffice.org KDE integration. Use the openoffice.org-gtk package instead or start OpenOffice.org with -graphicssystem native.

Have fun! ;)

UPDATE: Since Qt version 4.7, you can globally set the graphicssystem to raster via the QT_GRAPHICSSYSTEM environment variable. See here. Thanks lelamal for the comment.

UPDATE2: BTW: The easiest way I found to switch to the rastering engine with Qt 4.7 is adding export QT_GRAPHICSSYSTEM="raster"; to your .profile.

6 comments to How to drastically boost up your KDE 4 performance by using the Qt raster rendering engine

  • Very interesting! Even with KDE SC 4.5 I still feel that the computer is freezing every now and then, even though the processor isn’t really working. I have NVIDIA card, so I sort of just accepted that that was the problem. Would be great if something like this could improve the experience! I hope the packagers try out this tip!

  • lelamal

    Interesting article. However, there may be an easier way to achieve this, without having to maintain a dedicated PPA – take a look at this: http://apachelog.wordpress.com/2010/09/05/qt-graphics-system-kcm/

  • lelamal

    I’m afraid so. Here you can find some exchange on this in the comments: http://kde-apps.org/content/show.php/KCM+Qt+Graphics+System?content=129817.

  • Johas

    Qt raster is definitely the only way for me to run Kubuntu on my NVIDIA Quadro NVS 140M (Thinkpad T61). Without the raster option set, the accelerated graphics performance is unbelievably slow — especially KDE apps such as kile, kmail, dolphin and kate behave like running on a PentiumII with 256MB RAM. Even typing few words and opening a “save”-dialog takes literally minutes.
    Now, after switching back to Qt raster as described in the previous comment by micu, and using Compiz instead of kwin, my KDE feels fast and beautiful just as Gnome 3. I am of course using the proprietary nvidia driver; nouveau does not work yet with the Quadro NVS 140M. But that will, hopefully, change soon…

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>