I’m very excited about a change I have been working on for KWin since yesterday and which has entered the review process today. The result of it can be seen in this debug output of KWin:
kwin(17876) KWin::Compositor::slotCompositingOptionsInitialized: Initializing OpenGL compositing kwin(17876) KWin::SceneOpenGL::createScene: Forcing EGL Windowing System through environment variable kwin(17876) KWin::EglOnXBackend::initRenderingContext: EGL version: 1 . 4 OpenGL vendor string: X.Org OpenGL renderer string: Gallium 0.4 on AMD TURKS OpenGL version string: 2.1 Mesa 8.0.4 OpenGL shading language version string: 1.20 Driver: R600G GPU class: NI OpenGL version: 2.1 GLSL version: 1.20 Mesa version: 8.0.4 X server version: 1.12.3 Linux kernel version: 3.2 Direct rendering: yes Requires strict binding: no GLSL shaders: yes Texture NPOT support: yes kwin(17876) KWin::ShaderManager::initShaders: Ortho Shader is valid kwin(17876) KWin::ShaderManager::initShaders: Generic Shader is valid kwin(17876) KWin::ShaderManager::initShaders: Color Shader is valid kwin(17876) KWin::SceneOpenGL2::SceneOpenGL2: OpenGL 2 compositing successfully initialized
Everything looks quite normal. OpenGL 2 based compositing, everything works fine, all effects load. But still there is something very exciting going on. Instead of GLX, the EGL backend is used, which has been written for the OpenGL ES 2.0 compositor. But this is the normal KWin, not the kwin_gles. We run OpenGL over EGL. To do so the current patch uses an environment variable KWIN_OPENGL_WS which can be set to egl. By default we still use GLX as that’s the safest what we can get at the moment with the available driver collection (and our egl backend needs some more love to be honest). It shows how important the refactoring which I have blogged about last week has been: without it this change would not have been possible.
This is a very exciting change as it means we have one backend to serve both OpenGL and OpenGL ES 2.0, it is also very exciting as it means that KWin is already prepared for the proposed new OpenGL ABI, which will deprecate GLX. The current OpenGL ABI pulls in GLX even if you don’t want GLX at all. I’m very happy that we have this EGL backend as this can turn out to be very important for the adoption of the new OpenGL ABI. It has been noted during the discussion at XDC that there is a chicken and the egg problem by distributions not providing EGL and software therefore not using EGL which means distros do not provide EGL. We can help here as we are a component which most distributions ship and which now requires (currently still optionally) EGL.
As a free software user I’m also excited that this is a change fully built on top of the free OpenGL stack. For a long time quite some functionality of KWin had only been available with proprietary drivers. Now not only the free OpenGL stack provides all we need, it also allows us to move into areas where the proprietary drivers are not yet. With my KWin developer hat on, I of course hope that the proprietary drivers will start to provide EGL, too.
Last but not least I am excited about this change as it is another small step on our long road through the country. It means that changes which will need to happen in the future can also be provided to the OpenGL version of KWin even if we do no longer use GLX as the primary backend.