[platformx/x11] Add a freeze protection against OpenGL

Authored by graesslin on Oct 21 2016, 11:07 AM.


Group Reviewers

With nouveau driver it can happen that KWin gets frozen when first trying
to render with OpenGL. This results in a freeze of the complete desktop
as the compositor is non functional.

Our OpenGL breakage detection is only able to detect crashes, but not
freezes. This change improves it by also added a freeze protection.

In the PreInit stage a thread is started with a QTimer of 15 sec. If the
timer fires, qFatal is triggered to terminate KWin. This can only happen
if the creation of the OpenGL compositor takes longer than said 15 sec.

In the PostInit stage the timer gets deleted and the thread stopeed

Thus if a freeze is detected the OpenGL unsafe protection is written into
the config. KWin aborts and gets restarted by DrKonqui. The new KWin
instance will no longer try to activate the freezing OpenGL as the
protection is set.

If KWin doesn't freeze the protection is removed from the config as
we are used to.

Diff Detail

R108 KWin
No Linters Available
No Unit Test Coverage
graesslin updated this revision to Diff 7588.Oct 21 2016, 11:07 AM
graesslin retitled this revision from to [platformx/x11] Add a freeze protection against OpenGL.
graesslin updated this object.
graesslin edited the test plan for this revision. (Show Details)
graesslin added reviewers: KWin, Plasma.
Restricted Application added a project: KWin. · View Herald TranscriptOct 21 2016, 11:07 AM
Restricted Application added subscribers: kwin, plasma-devel. · View Herald Transcript
davidedmundson accepted this revision.Oct 21 2016, 11:19 AM
davidedmundson added a reviewer: davidedmundson.
davidedmundson added a subscriber: davidedmundson.

You could just parent the timer to the thread instead of needing a member var and a manual delete.

FYI, I should have one of these supposedly freezing cards arrive in the post later this afternoon.

This revision is now accepted and ready to land.Oct 21 2016, 11:19 AM

You could just parent the timer to the thread

Edit: no you couldn't. This is fine as-is.

graesslin updated this revision to Diff 7591.Oct 21 2016, 12:19 PM
graesslin edited edge metadata.

Added two new opengl safe points to protect the first frame being rendered.

Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptOct 21 2016, 12:19 PM

I tested this patch but it didn't work at detecting the freeze. Fortunately, after debugging kwin for a bit I worked on this and made a version that detects the freezes correctly.

I think I cannot add commits here, so I created a new phab at https://phabricator.kde.org/D3132 with this commit and the changes I made. I hope that's ok.

graesslin abandoned this revision.Oct 22 2016, 7:49 AM

Abandoned for newer revision