It has passed quite some time since my last blog post about optimizing KWin’s performance, so I felt the need to write a new one In the meantime KDE SC 4.8 including KWin 4.8 got released with all the features I had described in that blog post, but there are already new optimizations that have landed in the kde-workspace git repository, which I just want to explain shortly:
- The first thing isn’t even new, it is already part of KWin 4.8 It is a window property called _NET_WM_OPAQUE_REGION that allows an application with a translucent window to give the window manager a hint which parts of a window are still opaque. Hence KWin has more room for optimizations. It is part of the ewmh spec and I hope that more applications/styles will adopt it. So far the only style, that I’m aware of, which is using this feature is oxygen-transparent.
- I ported the TaskbarThumbnail, SlidingPopups and WobblyWindows effects to the faster code path that uses paintSimpleScreen. This was a long overdue step, which I really would like to have had in 4.8, but it needed some nontrivial changes to paintSimpleScreen. The actual painting is now done only in one pass instead of two, such that more window-transforming effects can be ported to utilize this function.
- In the spirit of optimizing paintSimpleScreen I also tried to cut down the number of all OpenGL calls. E.g. now KWin does no longer emit a single OpenGL call if the damaged part of the window is fully occluded. To achieve this I used apitrace, which by the way really rocks.
- These days there has finally been added faster repaint support for move/resize events in combination with oxygen-transparent. Before this patch KWin always had to invalidate the blur texture cache of a window if it overlapped with the area of a moving window, although the blurry window might have been below the moving one, which is usually the case. For several blurry windows stacked on top of each other, this meant that moving a window could considerably slow down KWin. At the moment I’m working on porting several window-transforming effects (e.g. WobblyWindows) to use this new and faster method.
That’s it for now For all the other cool new features in KWin I may refer you to Martin’s blog.
You mention several optimizations for oxygen-transparent, could they be ported to the normal oxygen? Is oxygen-transparent now the recomended theme if one wants the fastest possible desktop?
Keep up the great work
Let me clarify this, point one and four are only necessary for oxygen-transparent, the normal oxygen does already mark the whole window as opaque and the new move/resize event handling with respect to what has to be repainted improves the oxygen performance only in corner cases (e.g. you don’t move the topmost window and this window is partially hidden). Point two and three are general optimizations. The biggest impact on performance for the normal user will probably be point 2.
kwin just keeps getting better and better
The question everyone makes:
Can we have this for KDE 4.8.1? Will we have to wait until KDE 4.9? You mention that the changes you made are not intrusive…
Changing paintSimpleScreen is something I consider as very invasive It’s like playing with pandora’s box, might be that some effect you haven’t thought of does not like this change.
KWin has evolved nicely and by my opinion, is far most usable window manager what is available (even with small usability problems on context menu what is opened from right clicking window title) and its future just seems to get better and better.
Because of your blog entry, I again installed oxygen-transparent and noticed that it is still little buggy one (makes some drawing errors, what can be caused by Dolphin but is more likely the theme itself) and must say that transparent+blur is best with KWin and KDE apps themes when compared to others.
And now when KWin gets even faster, I can only say there is nice polishing happening…
Speaking of a oxygen-transparent, there is a reason why it is part of the KDE Playground. But in case you are experiencing http://bugs.kde.org/show_bug.cgi?id=293574 I recommend to wait for the 4.8.1 update.
Optimizations! Optimizations! Optimizations! I love that words especially in case of kwin thanks and keep on improving what we have, there was to many new things that didn’t work (and still need a lot of work) with introduced in kde4, now wee need to polish everything up