Allow the user to rearm OpenGLIsUnsafe KWIn autocrash protection

Review Request #101061 - Created April 8, 2011 and submitted

Thomas Lübking
- Allow the user to rearm OpenGLIsUnsafe KWIn autocrash protection
- Add a usable "doesn't work why" info
- WARN! the user about clicking the rearm button.
- Merge "OpenGLIsUnsafe" and "CheckIsSafe" (they did the same for the compositor and the active screen edges), picking the less generic term.
- Move the entire checking into CompositingPrefs, which now knows that "openGLIsBroken()" and doesn't require external protection for "detect()"

About distinguishing between "crashes kwin" and "crashes X11": I'm not even sure whether this makes sense (if the user has a new driver he may want to rearm things, expecting that X11 won't crash again - maybe because we told him so...) or it's worth it but a possible way to do it could be to
a) make OpenGLIsUnsafe a tenary setting (0,1,2)
b) add a parameter to the kwin binary (eg. "--checkBrokenGL")
c) initially set OpenGLIsUnsafe = 2; and launch "kwin --checkBrokenGL"
d) have "kwin --checkBrokenGL" sleep a short time, then check the value and if it's "2" (because kwin/compositing kcm crashed) set it down to "1"
e) => OpenGLIsUnsafe == 2 means that we successfully killed X11 with glXQuery() ...
Yes, i broke my driver (interesting sidenote: "int n = 0; int m = 1/n; n = m;" does not crash your code, gcc is a little smarter than this ;-) and tried to
- set the opengl backend (crash)
a) rearm (crash), then fix my driver and rearm (works)
b) change to XRender, change back to GL (get a warning, reamr, crash), then fix my driver, change to GL and rearm (works)
Martin Gräßlin
Martin Gräßlin
Thomas Lübking
Review request changed
Martin Gräßlin
I just tried it and it allways starts with the rearm screen and the setting OpenGLIsUnsafe is written to the file even if it was not. Some test code still included?

Apart from that I like it and please commit before hard freeze
  1. Doesn't look like and doesn't happen here - i suppose there's some issue in the GLES defines that makes the test fail.
    I'll have a close look on it before the commit (but will commit nevertheless at last tonight)
  2. yes likely it is GLES related. In that case I will cleanup after your commit :-)
Thomas Lübking

kwin/compositingprefs.cpp (Diff revision 2)
Close look strategy succeeded ;-)

This needs to be outside the inner #else.
I expect the commit to work on your side.