APR
1
2008

On KWin's composite performance

As every year, one can see all kinds of articles related to today's date everywhere, ranging from quite amusing ones (it's a pity I knew what day it was when visiting dot.kde.org) to really old boring ones without anything interesting in them. I guess many people are running out of ideas or something. Rather that doings things like that, I think such people should simply stay serious. Like myself, I'm a pretty boring person usually, so I won't join the crowd, but I'll rather try to fight back by trying to be serious.

People who have tried KWin's compositing have different views on how well it performs. I have seen comments starting from "it's so unusably slow, and Compiz runs fine here" to "it runs so great, unlike Compiz". I guess it really depends on one's luck and the gfx card, X version and drivers in use. Here KWin runs comparably to Compiz, and that's with several different setups (and gfx cards, and drivers). Quite hard to do something for people where it's bad for some reason, really. My crystal ball refuses to work whenever I try to use it on compositing problems, and here compositing works for me (TM).

Actually, that's only with either the development version of KWin or the to-be-4.0.3 version. Some days back I found and fixed some inefficiencies in KWin that were way too often causing pixmap-to-texture conversions, slowing it down, or other problems (see the 4.0.3 changelog when it's out). These fixes also allowed me to again enable KWIN_NVIDIA_HACK trick (i.e. __GL_YIELD=NOTHING, see Nvidia's README), making KWin actually seem to perform even better there.

Update: Saying that one is not going to fool anybody does not necessarily mean this saying is just not part of the fooling. It was for a reason why the first paragraph and the very last sentence were somewhat ambiguous. It seemed funny at that point for some reason. But I guess I took it a bit too far with pretending all of this is serious, most people probably don't have the knowledge to know that, since compositing is an additional pass, it cannot make things faster in general. Although, and that should be the lesson, things rarely in practice magically become five times faster. Glxgears is not going to actually get more work done just because you postprocess it. So yes, sorry, the part below and the video are a fake.

However, the parts above are not, they are true. I really have recently done some optimizations in KWin and it runs here comparably to Compiz (on some setups slightly faster, one some somewhat slower, but it's not a significant difference). And, with the Nvidia trick, the perceived performance for some users in some cases actually may seem to be five times better. And, this time unfortunately, the parts about it mostly working for me and it being difficult to do something about problems other have that I don't see are true as well.

End of update. The video that follows is a fake.

And, speaking of tricks, as a result of seeing and fixing those problem, in my local version I've tried some more performance improvements based on that. By applying even more optimizations to KWin's handling of pixmaps and OpenGL textures, KWin now can avoid even more unnecessary redraws or pixmap-to-texture conversions, leading to a rather noticeable difference. In fact, since it's an accelerated desktop, glxgears running with KWin's compositing now even runs faster than without compositing (I know glxgears is not that great a benchmark, but it's good enough for some uses). You can see it for yourself here, or if you've found out that Flash sucks, then you can download the video here (you'll probably need to set the video to fullscreen to see the FPS numbers in Konsole). As you can see, the gfx card is not very fast, and the recording of the whole screen for the video makes it appear even worse (throughout the whole video, unfortunately, that's why some parts are quite choppy).

That's all, the usual old boring stuff ;).

Comments

Thanks for the serious post, all those jokes were getting kinda boring :p

I really wonder at how an opengl app can be faster running under a compositing WM. Is it avoiding some internal conversions ? Is it sending 1000fps to the compositing manager, which then displays only a usefull fraction ? Is the opengl-on-plain-x11 codepath ridiculously unoptimized ? Would you see the same difference with [real_high-end_3d_app_or_game] as you saw with glxgears ?


By moltonel at Tue, 04/01/2008 - 18:10

Is there much room anywhere to improve the performance of the Blur plugin? Perhaps a less accurate, less smooth blur? Or perhaps only generating the blur effect for translucent parts of the window, instead of the whole window (I believe compiz has an option to do this).


By Joseph Kowalski at Tue, 04/01/2008 - 18:33

Hi!

I have experienced both slow and fast KWin. I'm running Mandriva 2008, and my KWin performance was terrible after configuring my display in the Mandriva Linux Control Center (NVidia Quadro FX Go1400). Re-visiting the Control Center I saw the "RENDER acceleration" option was not selected. After selecting "RENDER acceleration" KWin performed as expected. Apparently it is not selected by default because it may cause problems when rendering text.

Sorry if any named references aren't entirely correct, but someone translated all my KDE applications to Norwegian and forgot to give me an option to view the original English text. This is especially irritating when you have error-messages and you feel like Googling for some answers. Somehow there just don't seem to be as many error reports with Norwegian error-messages in them as there are reports with English error-messages... :-/


By sjaddow at Tue, 04/01/2008 - 21:46

It could be very useful to have a wiki page on techbase with the optimal settings for KWin4 compositing, both in Xorg.conf and in "Desktop effects" systemconfig module, for different gfx cards and drivers.

I searched a lot, but I didn't found anything like that (a part from KWIN_COMPOSITE_HOWTO, but it's quite general).


By baxeico at Wed, 04/02/2008 - 07:51

You are welcome to start it. I don't know anything about it, what's in COMPOSITE_HOWTO is just what is required.


By Lubos Lunak at Wed, 04/02/2008 - 14:12

Ok, I will start that wiki page on techbase as soon as I have some time.

I have a Nvidia GeForce 8400M GS, but I'm not sure at all that my configurations are optimal (that's why I looked for such wiki page :) ), but maybe starting the page I will receive some suggestions for possible improvements.

I will reply to this post when the wiki page will be online, so if you want you can give some visibility to it in your blog.


By baxeico at Thu, 04/03/2008 - 09:28

It should be rather wiki.kde.org than techbase, assuming it will be a "random" collection of things from various people. Techbase is for technical and "reliable" things directly related to KDE, presumably neither of which this page will be.


By Lubos Lunak at Thu, 04/03/2008 - 15:18