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.

14 comments:

Bernhard said...

wow.. thx so much for the tip with tfp with nvidia cards.. my tower only has got a geforce 6200TC and it was really horrible before.. after i've used the command it runs much smoother.. the only thing which really lags is blur (but that's ok) and some other effects like flame or explosion are simply ugly :-( is that to only show off the possibilities of kwin or are there better burn effects possible like those in beryl?

Anonymous said...

Thank you for all you do on kwin :)

Rivo Laks said...

bernhard: yeah, 6200 is probably too slow for blur. I might add some performance/quality setting later, but I wouldn't count on it making it usable for you.
About flame: as Seli put it, it's a flame effect without fire since nobody has implemented particle system or anything else which would create the flames. Also keep it mind that some effects have indeed only been made to show off or test a specific KWin's feature and hasn't been meant for actual use.

Anonymous said...

Actually, as far as the flame effect is concerned, I think it would be even sufficient just to paint a flame animation in the areas where the window is disappearing. But somebody still has to do that, and given that I consider flame to lack any real usefulness, that's not going to be me (besides, I'm lame at graphics, so I can't anyway).

Anonymous said...

Thanks for tip!
I have Geforce 4 MX 440 and KWin now runs indeed much faster!

You should consider setting this automatically if appropriate.

Oh, and great work you all have done in KWin!

Anonymous said...

What I don't understand is if Beryl does flames so well then why don't you integrate the ideas that make Beryl do it so well. I mean open source is all about not reinventing the wheel if at all possible. I know Beryl is very much alpha quality (to put it politely) but you might as well use what makes it good (albeit flames are clearly vulgar in taste).

The one thing I would like seeing implemented that does have taste is when an item flashes on the taskbar small short lived ripples come from it (the reason this is useful is that colour blind people aren't as likely to notice colour changes as they are motion (motion sensing being a natural imperative for avoiding danger so everyone with sight will notice that) and it looks so nice in a subtle way).

Bernhard said...

ok.. thx for your reply. first i'd like to say that I really admit the work you all do with kde4.

it would be really cool if there'll be a wobbly effect in kwin.. it makes the desktop just more fun to work with ^^

Anonymous said...

ej, i thought that wobbly windows are just stupid for many months. But i didn't ever tried beryl/compiz on my own. Just web news and screenshots + youtube.
Yesterday i've installed feisty and turn on "Effects" from menu and turn on wobbly It is very nice indeed, for me and i really love it ;]

wobbly windows as an option +1

Rivo Laks said...

dave: we just don't consider the flames effect a priority (like Lubos said, it doesn't really do anything useful) and there's just 3 of us. If somebody really wants to do this, there's the Beryl effect as well as tons of tutorials on particle effects and such, so it shouldn't be very difficult task.
The ripples thingy is interesting though.

Anonymous said...

Just pointing out the obvious: you guys rock. There will be many improvements in KDE4, but one underestimated is the improved Kwin. It already works very good and it just becomes ever better.

Anonymous said...

Nice shadows, a decent open/close
windows animation and maybe sticky
windows option, no more is needed to start....

Anonymous said...

Ok, I think I've found the bugger, so after I fix it the part about TFP vs SHM performance should no longer be true.

Anonymous said...

Wow when you see shadows like that you begin to respect the smoothly clean round shadows of Beryl/Compiz/Mac OSX/Vista. Best wishes for the beautiful, stable, fast and functional KWin!

Anonymous said...

Hello, Rivo.
I think you are doing a great job on KWin4. It is great to see that we are catching up to compiz/beryl.

I have a suggestion, though I do not know if it is possible to implement at this point. The Compiz Fusion guys have many effects which Kwin doesn't have (and IMHO doesn't need). However there are 2 effects which have caught my eye:
1.) the Ring-Switcher effect
2.) the Group/Tabs plugin
You can eventually see these effects at the following link if you watch the whole video:
http://www.youtube.com/watch?v=E4Fbk52Mk1w