kwin/libkwineffects
Martin Gräßlin b7be3cb621 Better handling for making the compositing OpenGL context current
With QtQuick2 it's possible that the scene graph rendering context either
lives in an own thread or uses the main GUI thread. In the latter case
it's the same thread as our compositing OpenGL context lives in. This
means our basic assumption that between two rendering passes the context
stays current does not hold.

The code already ensured that before we start a rendering pass the
context is made current, but there are many more possible cases. If we
use OpenGL in areas not triggered by the rendering loop but in response
to other events the context needs to be made current. This includes the
loading and unloading of effects (some effects use OpenGL in the static
effect check, in the ctor and dtor), background loading of texture data,
lazy loading after first usage invoked by shortcut, etc. etc.

To properly handle these cases new methods are added to EffectsHandler
to make the compositing OpenGL context current. These calls delegate down
into the scene. On non-OpenGL scenes they are noop, but on OpenGL they go
into the backend and make the context current. In addition they ensure
that Qt doesn't think that it's QOpenGLContext is current by calling
doneCurrent() on the QOpenGLContext::currentContext(). This unfortunately
causes an additional call to makeCurrent with a null context, but there
is no other way to tell Qt - it doesn't notice when a different context
is made current with low level API calls. In the multi-threaded
architecture this doesn't matter as ::currentContext() returns null.

A short evaluation showed that a transition to QOpenGLContext doesn't
seem feasible. Qt only supports either GLX or EGL while KWin supports
both and when entering the transition phase for Wayland, it would become
extremely tricky if our native platform is X11, but we want a Wayland
EGL context. A future solution might be to have a "KWin-QPA plugin" which
uses either xcb or Wayland and hides everything from Qt.

The API documentation is extended to describe when the effects-framework
ensures that an OpenGL context is current. The effects are changed to
make the context current in cases where it's not guaranteed. This has
been done by looking for creation or deletion of GLTextures and Shaders.
If there are other OpenGL usages outside the rendering loop, ctor/dtor
this needs to be changed, too.
2013-11-23 10:54:41 +01:00
..
anidata.cpp Port libkwineffects away from KDebug 2013-09-02 10:43:55 +02:00
anidata_p.h add effect debug interface and dbus export 2013-03-28 20:31:02 +01:00
CMakeLists.txt [libkwineffects] Improving linking of kwinglutils library 2013-11-19 12:12:57 +01:00
kwinanimationeffect.cpp fix mismatched struct/class forward declaration 2013-09-13 16:52:25 +02:00
kwinanimationeffect.h Fix no cast to/from ASCII intrduced issues 2013-07-24 09:58:33 +02:00
kwinconfig.h.cmake
kwineffects.cpp Drop the GlobalShortcutsEditor from libkwineffects 2013-09-09 07:10:08 +02:00
kwineffects.h Better handling for making the compositing OpenGL context current 2013-11-23 10:54:41 +01:00
kwinglcolorcorrection.cpp Make everything use org.kde.kded5 for now 2013-11-21 11:51:38 +01:00
kwinglcolorcorrection.h Use Q_SLOTS and Q_SIGNALS instead of slots and signals 2013-07-24 09:46:54 +02:00
kwinglcolorcorrection_p.h Use Q_SLOTS and Q_SIGNALS instead of slots and signals 2013-07-24 09:46:54 +02:00
kwinglobals.h Remove XLib dependency from kwinglobals 2013-09-05 09:56:50 +02:00
kwinglplatform.cpp Merge branch 'master' into frameworks-scratch 2013-09-24 11:28:38 +02:00
kwinglplatform.h kwin: Add GLPlatform::preferBufferSubData() 2013-07-08 01:23:37 +02:00
kwingltexture.cpp Merge branch 'master' into frameworks-scratch 2013-09-24 11:28:38 +02:00
kwingltexture.h introduce GLTexture::clear and use it from paintredirector 2013-09-24 00:50:55 +02:00
kwingltexture_p.h introduce GLTexture::clear and use it from paintredirector 2013-09-24 00:50:55 +02:00
kwinglutils.cpp Merge branch 'master' into frameworks-scratch 2013-09-24 11:28:38 +02:00
kwinglutils.h reset custom cube shaders on screen change 2013-08-27 07:53:02 +02:00
kwinglutils_funcs.cpp Merge branch 'master' into frameworks-scratch 2013-08-07 10:10:06 +02:00
kwinglutils_funcs.h Fix many color correction problems with OpenGL ES 2013-07-28 17:44:06 +03:00
kwinxrenderutils.cpp Merge branch 'master' into frameworks-scratch 2013-09-24 11:28:38 +02:00
kwinxrenderutils.h Merge branch 'master' into frameworks-scratch 2013-09-24 11:28:38 +02:00
Mainpage.dox
Messages.sh