kwin/effects
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
..
blur And we got rid of KDebug 2013-09-02 13:14:39 +02:00
coverswitch KIntSpinBox -> QSpinBox in kwin/effects configs 2013-09-09 07:38:30 +02:00
cube Better handling for making the compositing OpenGL context current 2013-11-23 10:54:41 +01:00
dashboard Merge branch 'master' into frameworks-scratch 2013-09-24 11:28:38 +02:00
desktopgrid Only react on own shortcut changed in desktopgrid 2013-09-09 09:02:19 +02:00
dialogparent Hook modalChanged signal for DialogParent script 2013-06-26 12:42:09 +02:00
diminactive Merge branch 'master' into frameworks-scratch 2013-09-24 11:28:38 +02:00
dimscreen Fix no cast to/from ASCII intrduced issues 2013-07-24 09:58:33 +02:00
fade workaround bug #321897 by multiplying fadeout time 2013-09-26 19:43:10 +02:00
fadedesktop
fallapart Port KWin/Effects from KDebug to QDebug 2013-09-02 11:03:29 +02:00
flipswitch KIntSpinBox -> QSpinBox in kwin/effects configs 2013-09-09 07:38:30 +02:00
glide Avoids unnecessary searchs for info of the window 2013-11-19 09:49:17 -02:00
highlightwindow Fix reading of window properties from effects 2013-09-25 09:12:31 +02:00
invert Merge branch 'master' into frameworks-scratch 2013-09-24 11:28:38 +02:00
kscreen SVN_SILENT made messages (.desktop file) 2013-11-23 03:52:00 +00:00
login
logout Remove some no longer needed includes 2013-09-05 10:39:47 +02:00
lookingglass KIntSpinBox -> QSpinBox in kwin/effects configs 2013-09-09 07:38:30 +02:00
magiclamp foo.moc -> moc_foo.cpp in KWin effects config 2013-08-07 13:04:01 +02:00
magnifier Better handling for making the compositing OpenGL context current 2013-11-23 10:54:41 +01:00
maximize SVN_SILENT made messages (.desktop file) 2013-08-13 04:19:10 +00:00
minimizeanimation SVN_SILENT made messages (.desktop file) 2013-06-10 03:46:39 +00:00
mouseclick Merge branch 'KDE/4.11' 2013-10-20 19:40:48 +02:00
mousemark KIntSpinBox -> QSpinBox in kwin/effects configs 2013-09-09 07:38:30 +02:00
presentwindows Fix rendering errors of close window button in Present Windows 2013-10-25 12:57:34 +02:00
resize foo.moc -> moc_foo.cpp in KWin effects config 2013-08-07 13:04:01 +02:00
scalein ignore minimized windows in scalein effect 2013-09-08 23:43:13 +02:00
screenedge Better handling for making the compositing OpenGL context current 2013-11-23 10:54:41 +01:00
screenshot Port from KTemporaryFile to QTemporaryFile 2013-09-24 08:07:41 -03:00
sheet
showfps Merge branch 'KDE/4.11' 2013-10-20 19:40:48 +02:00
showpaint
slide
slideback SVN_SILENT made messages (.desktop file) 2013-11-23 03:52:00 +00:00
slidingpopups Fix reading of window properties from effects 2013-09-25 09:12:31 +02:00
snaphelper SVN_SILENT made messages (.desktop file) 2013-06-10 03:46:39 +00:00
startupfeedback Better handling for making the compositing OpenGL context current 2013-11-23 10:54:41 +01:00
taskbarthumbnail [kwin] Window -> xcb_window_t or WId 2013-11-18 13:57:46 +01:00
thumbnailaside KIntSpinBox -> QSpinBox in kwin/effects configs 2013-09-09 07:38:30 +02:00
trackmouse Better handling for making the compositing OpenGL context current 2013-11-23 10:54:41 +01:00
translucency
windowgeometry Merge branch 'master' into frameworks-scratch 2013-09-24 11:28:38 +02:00
wobblywindows KIntSpinBox -> QSpinBox in kwin/effects configs 2013-09-09 07:38:30 +02:00
zoom Better handling for making the compositing OpenGL context current 2013-11-23 10:54:41 +01:00
CMakeLists.txt [kwin/effects] Do not link Qt::Quick for the config modules 2013-11-19 12:20:21 +01:00
configs_builtins.cpp Remove K_EXPORT_PLUGIN macros 2013-08-08 13:47:25 +02:00
kwineffect.desktop SVN_SILENT made messages (.desktop file) 2013-06-10 03:46:39 +00:00
Messages.sh