On the Road to Modern OpenGL (ES)

With KWin GLES shortly before the merge into workspace master (after git transition), it’s time to look back what I promised to deliver half a year ago, when I first talked about the idea of porting KWin to OpenGL ES at Akademy.

At the time of Akademy I had not yet started to write any code as I considered 4.5 more important and waited for the git transition. Obviously I stopped waiting for git or there would not be any code written ­čśë My schedule presented at Akademy looked like that:

  • Remove deprecated OpenGL code
  • Remove unused code in Scene and E?ects Lib
  • Drop XGL support
  • Port to OpenGL ES 1.1 till 4.6
  • Port to OpenGL 3 and ES 2.0 till 4.7

Removal of deprecated OpenGL code is mostly done. With GLES KWin has a forward compatible code path, though we still have OpenGL 1.x code for legacy systems and that won’t be dropped in the near future. Considering deprecated OpenGL 1.x code it’s looking quite good, e.g. glBegin/glEnd is removed in the GLES branch. Rendering of geometries is abstracted and the backend performs a runtime check whether legacy or modern rendering is invoked.

For 4.6 I started to port some effects to newer functionality which allowed to drop some then unused code. The remaining functions have been marked as deprecated, but are not yet removed in the GLES branch as they are still used by the Shadow effect (though unavailable in OpenGL ES and broken with OpenGL 2 backend). Given that Shadow is difficult to port, in general broken and unmaintained I consider to just drop it. I am already gathering ideas for a new replacement effect.

The XGL code (XGL was needed to run Compiz before AIGLX was integrated) is still in KWin and should really be dropped. It has been removed from X git tree for quite some time and I doubt anybody has ever run KWin with XGL. There are more things we can now consider to remove: shared memory and "fallback" compositing. Together this will mean a requirement to Texture from Pixmap. That’s pretty well supported nowadays on all drivers and anything else cannot be recommended.

The next bullet point is OpenGL ES 1.1. Well I noticed that it would really clutter the code, so I stopped working on it and switched to going to ES 2.0 directly. My initial plan was to provide 1.1 support at the time of the 4.6 release. Instead we now have ES 2.0 support at the time of 4.6 ­čśÇ

In 4.7 we will not only have an OpenGL ES 2.0 backend available, it will be integrated into the release. As a side effect it gives us a complete OpenGL 2.x backend which should benefit all users having decent drivers. I’ll soon integrate an option to the advanced settings tab to choose between OpenGL 1.x, 2.x and 3.x. With the 2.x code there, it’s really easy to go to 3.x. We won’t default to it, we will hardly use it (I want to experiment with Geometry Shaders in MagicLamp effect), but I hope that the drivers supporting OpenGL 3 (that’s for us only the NVIDIA blob at the moment, fglrx is only usable with OpenGL 1.x in the composited case) are more efficient if run in a forward compatible profile.

There is still lots to do and I want to concentrate on improving the rendering stack throughout the 4.7 release cycle. It’s quite fortunate that the new rendering stack can be integrated directly after the git transition. So I hope that lots of developers will be using it and can provide feedback for various hardware.

Powered by Blogilo

Bug Statistics for KWin 4.6 Cycle

Once again I used Bugzilla to get some statistics on how many bugs are opened, closed in KWin during the last development cycle (statistics are from Final Tagging 4.5 till today). Overall 437 new bugs have been reported and 425 bugs have been "closed". Many thanks again to the bug day – without it the numbers would look worse. So this means that each day 2.4 bugs are reported. Assuming that we spent 10 minutes on each bug (in general Thomas L├╝bking and I are reading and responding to each bug comment), we spent 8 days just on bug managing. That sounds reasonable, but is very bad as it’s time spent managing and not fixing the bugs. This can be seen in the table below.

Like in my previous reports about 40 % (165) of the new bugs are duplicates. But this time we also faced the problem of the drivers: 12.8 % (56) of all new bugs have been marked as upstream. I also took the time to go through all duplicate crash reports and found another 52 duplicate driver crashes. About 50 % (213) of all bugs are crashes, but only 3 crashes are confirmed and only 9 have been fixed. 24 of the crashes have not been confirmed yet, meaning that the way to reproduce is not clear. Altogether 21.5 % (94) bugs have not been confirmed yet. Apart from the driver bugs our worst problem has been in Desktop Grid and those crashes were fixed early in the cycle.

Category # New Bugs/% to All # New Crashes/% to New Bugs Overall Closed
Unconfirmed: 94/21.5 24/25.5
New: 17/3.9 3/17.6
Needsinfo: 37/8.4 27/75 55
Fixed: 34/7.8 9/27.3 71
Invalid: 24/5.4 3/12.5 26
Wontfix: 2/0.5 3
Duplicate: 165 (-52)/37.8 110 (-52)/66.6 185 (-52)
Worksforme: 5/1.1 19
Upstream (driver): 56 (+52)/12.8 36 (+52)/64.3 63 (+52)
Downstream: 3/0.7 1/33.3 3
Sum: 437 213/48.7 425

Powered by Blogilo

Down to Five KWin Effects

Today I ported another bunch of effects to GLES which leaves just five more effects to be ported:

  • Blur
  • Logout
  • Explosion
  • Invert
  • Snow

Blur, Logout and Snow are the more difficult ones as they have quite some custom code. Snow especially is calling for a rewrite (it was my first effect and I can clearly see how much my coding improved). Additionally to those effects Shadow and Sharpen are not yet ported and won’t be ported. I want to replace Shadow with BeShadowed or with something completely new to support Oxygen shadows also for menus. The Sharpen effect will be removed for various reasons.

But there is also some work left in other effects. Flip/Cover Switch are missing the multi-monitor adjustments and in Cube effect Sphere and Cylinder are not yet supported. Those knowing a little bit about KWin internals will notice, that mostly effects using Shaders are left. The shader files need to be adjusted due to the fact that the existing ones were emulating fixed-functionality. This is not available in GLES, so the shaders need to be rewritten to not use the emulation parts. I did that today with the Looking Glass effect.

I did a screencast of KWin GLES with the nouveau driver. It shows that resizing is much faster and effects are more smooth than our existing rendering stack. The quality of the video is not so good (I still have problems getting recordmydesktop to work properly) that’s why I do not include it in this post. If you don’t mind it, you can find it on blip.tv.

Powered by Blogilo