Friday, June 15, 2007

KWin performance and shadows

After publishing my last KWin video, the biggest critique was that KWin is slow. Most of that could be attributed to the video recording which naturally makes things slower, but e.g. Beryl still felt smoother than KWin. I decided to investigate it and one thing I found out was that TFP (texture from pixmap) mode was actually slower than SHM (shared memory) mode. A lot slower even, especially when just part of a window changed. I still haven't figured out why exactly it happens (I'm using NVidia drivers, don't know if that's related) or if it's same with Compiz/Beryl, but if you want to switch to SHM mode, this command does that:

kwriteconfig --file kwinrc --group Translucency --key GLMode SHM

After executing that you can restart kwin by executing kwin --replace
Additionally, turning off vsync might also make it feel a bit better, but be warned that you might experience some tearing in this case:

kwriteconfig --file kwinrc --group Translucency --key GLVSync false

About KWin development, it has gotten some compositing fixes & improvements lately, and I have a new eyecandy screenshot to show as well. I implemented soft shadows for windows. They still suck a bit (especially at the corners), but less than before and it should be possible to improve the corners with some more work as well.