Running KWin with OpenGL ES 2.0

Today we expect the release of the KDE Plasma Workspaces in version 4.7 which is the first release including an OpenGL ES 2.0/EGL backend in KWin. This does not only allow us to run KWin on OpenGL ES powered devices (I am particular looking forward to see KWin on Tegra 2 devices), but also gives us a much better compositing experience on the desktop systems. Thanks to the work on OpenGL ES 2.0 our default compositing backend is now OpenGL 2.x based instead of OpenGL 1.x as it was till 4.6.

I want to thank all users who tested our beta version and release candidates and ensured by that a regression free update. I am very glad on how smooth this major transition of the compositor seems to work according to the very low number of bug reports in this cycle.
On Mesa enabled desktop systems there is also the possibility to go a step further and leave GLX completely behind by compiling KWin for OpenGL ES/EGL only. My personal experience is that it is often a much better experience to use the OpenGL ES build. If you compile KWin from sources ensure that the OpenGL ES 2.0 and EGL development libraries are around and enable the CMake option “KWIN_BUILD_WITH_OPENGLES”. If everything is setup correctly, CMake will tell you “Compiling KWin for mobile”.
Of course compiling from sources is not what most of our users do, so it needs distro help. Thanks to the awesome Kubuntu crew there will be a kwin_gles package available in Kubuntu 11.10. So users can switch to use this package.
But that’s still not perfect as users need to know that there is a better GLES variant. So today I pushed a change to master to build KWin twice: once with OpenGL and once with OpenGL ES. Thanks to our CMake Gods for all the help on getting this done :-). Now if OpenGL ES is available at buildtime a “kwin_gles” binary is compiled and can be used just like “kwin”. For all users of masters, do a git pull, recompile and run: kwin_gles –replace & and enjoy.
And that’s also just an intermediate step. Our GSoC student Arthur is currently working in close collaboration with me on decoupling our compositor from the window manager so that we can build just the compositor once with OpenGL and once with OpenGL ES. We will then put the compositor into a plugin and do a runtime check whether OpenGL ES is working and if it is we will load the OpenGL ES compositor. So if everything works fine, in 4.8 we will be able to offer and default to OpenGL ES 2.0 for most of our users.
This is also important for Phase 1 of Plasma on Wayland, which I will highlight in my talk at the Desktop Summit: Compositing after X – KWin on the road to Wayland. Hope to see you there.

39 Replies to “Running KWin with OpenGL ES 2.0”

  1. > (I am particular looking forward to see KWin on Tegra 2 devices)

    Will do !
    But I don’t know if you remember, but i’ve already tried, without much success. It was a problem with double buffering. At that point I think you said that you were relying on some wrong behaviour of mesa’s EGL/GLES, have you fixed it ?

    1. I hope that this issue is now improved in the NVIDIA drivers after their release of drivers for MeeGo.

  2. Happy gentoo user, open source radeon and kwin on OpenGL ES. Although i didn’t have any performance problems with kwin i might have noticed a better performance on OpenGL ES but it might be my imagination.

    I love the future kwin, choosing OpenGL ES at runtime will be great and it will lower the burden for distro maintainers (but not coders or will it ease your life too?).

    Thank You Martin, Thank You Arthur and everyone else that i don’t know but works on kwin and KDE. Without You it wouldn’t be possible to have the best DE like KDE (*hides under the table foreseeing a GNOME vs KDE flame war but briefly mumbling that it’s my personal opinion)…

  3. If you’re working on modularization and cleanup anyway, may I suggest an option to make KWin non-KDE-dependent and completely usable standalone? A lot of non-DE users may get happy, including me. KWin is currently the most featureful WM, I would like to use it, but huge KDE dependencies do not fit well in a stand-alone environment.

    1. you can always use kwin without a Plasma environment though we have no interest in removing KDE Libs dependencies

  4. I’m looking forward to see kwin on tegra devices too. I used to be a compiz lover and user but last year kwin has my love so i should say Thank you Martin and everyone else involved in this for making Kwin a great compositor!

  5. Thanks for driving my poor GeForce 6150 towards graphics nirvana. Blur works amazingly here, effects are smooth and I can still see my graphics chip throttling down to 100 MHz.

    Thanks also for enabling me to use the Lanczos shader with my GeForce 8500 GT. I never saw that feature running so smoothly in a computer.

    Now, with KDE 4.7, I can pump more effects, get more performance and, in some cases, use even less CPU than never before. Thank you, KWin performance in KDE 4.7 is, for the first time, GREAT.

  6. It seems great progress for kwin, it’s a pity that netbooks can’t enjoy any of this, or will llvm-pipe help?, I remember raster backend being 100% cpu and working better than oepengl (for plasma).
    Any idea of how would this work on llvm-pipe?

  7. thanks Martin! 🙂

    but i don’t get it, if Open GL ES is for embedded systems how come is better for desktop? and what about ES driver support in ati/nvidia?

    but I’m very happy hearing about modularization, clean ups and performance boost! thanks again, can’t wait to see 4.7 in repos!

  8. So, on a vanilla desktop install without OpenGL ES, there is still improvement from the jump to OpenGL 2.0 right?

  9. Do you know, it it supposed to work on Intel gfx (Mobile 4 Series, 0x8086:0x2a42) with mesa >= 7.10.3, as it fails here.
    Or in general, what the hw and sw requirements for gles enables kwin?

    1. I would recommend at least Mesa 7.11 and hardware, well it has to be OpenGL ES 2 capable (yeah I know that answer sucks but there is just no better)

  10. Thanks for that great work. I got some questions though, as i dont understand the post exactly, if you can answer some i would be pleased:

    I am running a kubuntu 11.10 on a Nvidia 7600GT with nvidia-blob (and may try nouveau at some point)

    1. You write GL ES should be better. Is this correct for my desktop, and i wont lose any functionality?
    2. Simply installing kwin_gles and running “kwin_gles –replace &” or will kwin_gles replace the normal kwin, so i dont need to run the replace command?
    3. If i have to run the replace command, how could i make it default?

    1. 1. You write GL ES should be better. Is this correct for my desktop, and i wont lose any functionality?

      As you are using the NVIDIA blob and would need to use the nouveau driver we get in an area where we compare apples with pears. The OpenGL ES kwin has a slight rendering issue with blur in combination with other effects and logout effect is not yet ported. Apart from that everything I know of should work.

      2. Simply installing kwin_gles and running “kwin_gles –replace &” or will kwin_gles replace the normal kwin, so i dont need to run the replace command?

      It is the normal way to switch window managers by using the –replace switch. E.g. you can start Compiz when KWin is running through compiz –replace. If you start kwin without the –replace and another window manager is running you will be presented with an error message.

      3. If i have to run the replace command, how could i make it default?

      Currently there is not yet any way to make this default. As written the aim is to have automagic runtime selection, which makes the current way in master an intermediate solution.

  11. KUBUNTU 11.10

    ~$ kwin_gles –replace
    bash: kwin_gles: command not found

    ~$ kde4-config -v
    Qt: 4.7.3
    KDE: 4.7.00 (4.7.0)
    kde4-config: 1.0

    Why?

  12. Hi Martin,

    First of all, I must really thank You for Your devotion to Kwin development. I would like to see such activity in other parts of kde…

    I am a gentoo user, nouveau on GF6150SE (theoretically OpenGL-3.0 compliant). I compiled Kwin with gles USE flag which enables KWIN_BUILD_WITH_OPENGLES.
    I have also mesa-7.11-rc4 with egl and gles use enabled.

    Nevertheless, I get following error while running kwin –replace:
    penGL renderer string: Gallium 0.4 on NV4E
    OpenGL version string: OpenGL ES 2.0 Mesa 7.11-rc4
    OpenGL shading language version string: OpenGL ES GLSL ES 1.0.16
    Driver: Nouveau
    GPU class: NV40/G70
    OpenGL version: 2.0
    GLSL version: 1.0.16
    Mesa version: 7.11
    X server version: 1.10.3
    Linux kernel version: 3.0
    Direct rendering: yes
    Requires strict binding: yes
    GLSL shaders: limited
    Texture NPOT support: yes
    kwin(20091): Shaders are not supported
    kwin(20091): Shaders not valid, ES compositing not possible
    kwin(20091): Failed to initialize compositing, compositing disabled

    Is it possible to enable GLES in kwin on my hardware? (seems so, since someone above succeeded)
    If so can You give me a hint what may be wrong in my configuration?

    Cheers

    1. GLSL shaders: limited

      This says that the GPU is most likely not fully OpenGL 2 compatible. I do not know how kwin with OpenGL ES behaves in such a situation as it was designed around the assumption that nobody uses it on hardware not supporting OpenGL ES.

        1. The hardware is certainly capable, it’s the driver that may not have the proper support. The Nouveau driver is experimental and reverse-engineered. I’m pretty sure hardware as old as yours is not being worked on in that driver very much, which means you are likely to run into bugs.

  13. 2-3 months ago all work fine and much faster that opengl , now i can’t run kwin with GLES

    kwin_gles –replace
    r300: DRM version: 2.10.0, Name: ATI RS480, ID: 0x5975, GB: 4, Z: 1
    r300: GART size: 509 MB, VRAM size: 256 MB
    r300: AA compression RAM: YES, Z compression RAM: YES, HiZ RAM: NO
    OpenGL vendor string: X.Org R300 Project
    OpenGL renderer string: Gallium 0.4 on ATI RS480
    OpenGL version string: OpenGL ES 2.0 Mesa 7.12-devel
    OpenGL shading language version string: OpenGL ES GLSL ES 1.0.16
    Driver: R300G
    GPU class: R400
    OpenGL version: 2.0
    GLSL version: 1.0.16
    Mesa version: 7.12
    X server version: 1.10.99
    Linux kernel version: 3.0
    Direct rendering: yes
    Requires strict binding: yes
    GLSL shaders: limited
    Texture NPOT support: limited
    r300: DRM version: 2.10.0, Name: ATI RS480, ID: 0x5975, GB: 4, Z: 1
    r300: GART size: 509 MB, VRAM size: 256 MB
    r300: AA compression RAM: YES, Z compression RAM: YES, HiZ RAM: NO
    kwin(3718): Shaders are not supported
    kwin(3718): Shaders not valid, ES compositing not possible
    kwin(3718): Failed to initialize compositing, compositing disabled
    kwin(3718): Consult http://techbase.kde.org/Projects/KWin/4.0-release-notes#Setting_up

    1. First of all: there are, all mesa drivers provide also a GLES implementation. Second of all: why should we not add an implementation if there were only proprietary drivers?

  14. Hi Martin,

    Thanks for all the great work you have done with KWin!

    Slightly off-topic, but is there any news with porting your remaining desktop effects to GLES? I’m thinking in particular of the “Snow” plugin – many of us miss the fun snowflakes in KDE SC 4.7 and, well, its nearly that time of year again! 🙂

    Best Wishes,

    itsjustarumour

    1. No I am not going to reimplement the snow effect and it’s too late for the winter time anyway

Comments are closed.