Bug 396272 - wayland: kwin crashes after energy saving turns monitors off and i try to wake them on with a mouse
Summary: wayland: kwin crashes after energy saving turns monitors off and i try to wak...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: platform-drm (show other bugs)
Version: 5.13.2
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-07 08:24 UTC by Miroslav Spehar
Modified: 2018-07-19 08:42 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
mspehar: Wayland+


Attachments
gdb backtrace (17.95 KB, text/plain)
2018-07-07 08:24 UTC, Miroslav Spehar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miroslav Spehar 2018-07-07 08:24:42 UTC
Created attachment 113814 [details]
gdb backtrace

- What I was doing when the application crashed:
Every time after resume from screen energy saving mode, plasma is wither non-responsive or just turns on the backlight of monitors without picture showing.

Reproducible: Always

Steps to Reproduce:
1. From System settings-> power management, set the "Screen energy saving" to 10 mins
2. Leave the screen to go blank and wait around 10 more mins (sometimes more)
3. Move the mouse so screen gets back


There are two related bugs reported
https://bugs.kde.org/show_bug.cgi?id=364526
https://bugs.kde.org/show_bug.cgi?id=348487
Comment 1 David Edmundson 2018-07-07 22:09:31 UTC
Not convinced the other two are related.

Backtrace makes total sense, drmPageFlip/drmHandleEvent is effectively async and our user_data pointer we supply (the DrmOuptut) can get deleted.

We can try to make sure we never delete the output when we have a pending flip. 

Alternatively I once did a clever trick in kwayland of putting a QPointer on the heap and using that as our user data. Kinda safer, kinda just avoiding the problem.
Comment 2 Martin Flöser 2018-07-08 06:38:36 UTC
Holding the Output till the pageFlip returned sounds like the more robust solution to me.
Comment 3 Roman Gilg 2018-07-08 07:38:24 UTC
One could also hand over a pointer to a struct referencing DrmBackend* backend and DrmOutput* output. Then check if output is still in backend->outputs().
Comment 4 Miroslav Spehar 2018-07-08 16:52:18 UTC
is this connected?

https://bugs.kde.org/show_bug.cgi?id=385743
Comment 5 David Edmundson 2018-07-18 15:04:39 UTC
>385743

it is not, sorry.
Comment 6 David Edmundson 2018-07-19 08:41:28 UTC
Git commit a362a67989f1cea4606f9a564d9a51144a51c719 by David Edmundson.
Committed on 19/07/2018 at 08:41.
Pushed by davidedmundson into branch 'Plasma/5.13'.

Don't remove outputs during page flip

Summary:
To do so leaves a dangling pointer on our pageFlipHandler

Test Plan: Wobbled a window whilst plugging a monitor in and out

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: anthonyfieroni, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D14210

M  +1    -1    plugins/platforms/drm/drm_backend.cpp
M  +17   -0    plugins/platforms/drm/drm_output.cpp
M  +6    -1    plugins/platforms/drm/drm_output.h

https://commits.kde.org/kwin/a362a67989f1cea4606f9a564d9a51144a51c719
Comment 7 David Edmundson 2018-07-19 08:42:02 UTC
Git commit 9f2f6d96577dd4aba878e53259e20bde72d752d1 by David Edmundson.
Committed on 18/07/2018 at 15:05.
Pushed by davidedmundson into branch 'master'.

Don't remove outputs during page flip

Summary:
To do so leaves a dangling pointer on our pageFlipHandler

Test Plan: Wobbled a window whilst plugging a monitor in and out

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D14210

M  +1    -1    plugins/platforms/drm/drm_backend.cpp
M  +17   -0    plugins/platforms/drm/drm_output.cpp
M  +6    -1    plugins/platforms/drm/drm_output.h

https://commits.kde.org/kwin/9f2f6d96577dd4aba878e53259e20bde72d752d1