Bug 442603

Summary: Crash in EglGbmBackend::resetOutput()
Product: [Plasma] kwin Reporter: Matej Mrenica <matejm98mthw>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: matejm98mthw, nate, xaver.hugl
Priority: NOR    
Version: 5.22.90   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.23
Attachments: log
Screenshot

Description Matej Mrenica 2021-09-17 14:52:03 UTC
Created attachment 141651 [details]
log

SUMMARY
After waking up from sleep, new session is created, some apps that were running before are reopened, also some that were not.
And some apps are not restarted at all, like Firefox.

Also panel(s) are missing, even though Plasma shell is running. Logging out and back in doesn't bring panels back. One has to log into X.org session to bring them back.

Crash is caused by kwin_wayland (log attached). Panel disappearing might be a separate issue.

STEPS TO REPRODUCE
1. Suspend your PC and wake it up

SOFTWARE/OS VERSIONS
KDE Frameworks Version: 5.86
Qt Version: 5.15.2

ADDITIONAL INFORMATION
This happens only on wayland, external monitor is connected and used.
Comment 1 Zamundaaa 2021-09-21 09:01:48 UTC
> This happens only on wayland, external monitor is connected and used.

Do you have the internal screen disabled / the lid closed?
Comment 2 Matej Mrenica 2021-09-21 12:17:54 UTC
The lid is open but the screen is disabled.
Comment 3 Matej Mrenica 2021-09-21 12:26:28 UTC
Created attachment 141764 [details]
Screenshot

Closing the lid makes no difference, setting screen mode to "clone" prevents this issue from happening, but produces another separate issue (Screenshot). Both my screens are 1080p but my laptop screen is set to 125% scale.
Comment 4 Bug Janitor Service 2021-09-21 12:46:02 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1445
Comment 5 Nate Graham 2021-09-28 17:32:53 UTC
Git commit 6bbda88ab5a64810605cce1471f9a0de365acdef by Nate Graham, on behalf of Vlad Zahorodnii.
Committed on 28/09/2021 at 17:31.
Pushed by ngraham into branch 'master'.

platforms/drm: Avoid making real commits while searching for output config

This change limits the brute force output configuration search routine
to test only commits, it's way more efficient than real commits.

M  +2    -2    src/plugins/platforms/drm/drm_gpu.cpp

https://invent.kde.org/plasma/kwin/commit/6bbda88ab5a64810605cce1471f9a0de365acdef
Comment 6 Nate Graham 2021-09-28 17:33:10 UTC
Git commit eb1daa0aadcbae3f4be8ca7450f648040a52013c by Nate Graham, on behalf of Vlad Zahorodnii.
Committed on 28/09/2021 at 17:31.
Pushed by ngraham into branch 'master'.

platforms/drm: Avoid re-using blobs

Blobs are not reference counted if used by other drm master, if kwin
re-uses a deleted blob in an atomic commit, it will fail. For example,
on my computer, this happens when kwin starts after xorg.

Besides that, kwin may try to destroy blobs that it doesn't own, which
is not fatal but it's strange to do so.
Related: bug 439873

M  +12   -56   src/plugins/platforms/drm/drm_object.cpp
M  +1    -3    src/plugins/platforms/drm/drm_object.h
M  +8    -5    src/plugins/platforms/drm/drm_object_connector.cpp
M  +20   -17   src/plugins/platforms/drm/drm_object_plane.cpp

https://invent.kde.org/plasma/kwin/commit/eb1daa0aadcbae3f4be8ca7450f648040a52013c
Comment 7 Zamundaaa 2021-09-28 18:07:53 UTC
Git commit 6e3c3936dc3924105c49f8e0b41bf789883d173b by Xaver Hugl, on behalf of Vlad Zahorodnii.
Committed on 28/09/2021 at 18:05.
Pushed by zamundaaa into branch 'Plasma/5.23'.

platforms/drm: Avoid re-using blobs

Blobs are not reference counted if used by other drm master, if kwin
re-uses a deleted blob in an atomic commit, it will fail. For example,
on my computer, this happens when kwin starts after xorg.

Besides that, kwin may try to destroy blobs that it doesn't own, which
is not fatal but it's strange to do so.
Related: bug 439873

M  +12   -56   src/plugins/platforms/drm/drm_object.cpp
M  +1    -3    src/plugins/platforms/drm/drm_object.h
M  +8    -5    src/plugins/platforms/drm/drm_object_connector.cpp
M  +20   -17   src/plugins/platforms/drm/drm_object_plane.cpp

https://invent.kde.org/plasma/kwin/commit/6e3c3936dc3924105c49f8e0b41bf789883d173b
Comment 8 Zamundaaa 2021-09-28 18:08:01 UTC
Git commit 8b977d3e98255dac7226de0b77faab9454342c2b by Xaver Hugl, on behalf of Vlad Zahorodnii.
Committed on 28/09/2021 at 18:06.
Pushed by zamundaaa into branch 'Plasma/5.23'.

platforms/drm: Avoid making real commits while searching for output config

This change limits the brute force output configuration search routine
to test only commits, it's way more efficient than real commits.

M  +2    -2    src/plugins/platforms/drm/drm_gpu.cpp

https://invent.kde.org/plasma/kwin/commit/8b977d3e98255dac7226de0b77faab9454342c2b
Comment 9 Zamundaaa 2021-10-01 08:53:51 UTC
Git commit d55011ae86246c47b65a150cc5f5a2baa9f3c16c by Xaver Hugl.
Committed on 01/10/2021 at 08:53.
Pushed by zamundaaa into branch 'master'.

platforms/drm: handle disabled outputs better

M  +12   -3    src/plugins/platforms/drm/drm_gpu.cpp
M  +0    -1    src/plugins/platforms/drm/drm_gpu.h
M  +3    -6    src/plugins/platforms/drm/drm_pipeline.cpp
M  +1    -2    src/plugins/platforms/drm/drm_pipeline.h

https://invent.kde.org/plasma/kwin/commit/d55011ae86246c47b65a150cc5f5a2baa9f3c16c
Comment 10 Zamundaaa 2021-10-01 08:56:41 UTC
Git commit 0e45a723d31917257daa81ab6c5776fb8a79157d by Xaver Hugl.
Committed on 01/10/2021 at 08:56.
Pushed by zamundaaa into branch 'Plasma/5.23'.

platforms/drm: handle disabled outputs better
(cherry picked from commit d55011ae86246c47b65a150cc5f5a2baa9f3c16c)

M  +12   -3    src/plugins/platforms/drm/drm_gpu.cpp
M  +3    -6    src/plugins/platforms/drm/drm_pipeline.cpp
M  +1    -2    src/plugins/platforms/drm/drm_pipeline.h

https://invent.kde.org/plasma/kwin/commit/0e45a723d31917257daa81ab6c5776fb8a79157d
Comment 11 Matej Mrenica 2021-10-02 07:34:18 UTC
I have seen this bug being mentioned in "Adventures in Linux and KDE" (https://pointieststick.com/2021/10/01/this-week-in-kde-getting-plasma-5-23-ready-for-release/) and it says:

"In the Plasma Wayland session, KWin no longer crashes when waking up the system for users of NVIDIA GPUs (Vlad Zahorodnii, Plasma 5.23)"

But I made this report, and I have an AMD GPU. Does this mean it should say AMD (or AMD and Nvidia) or does Kwin, for some reason, use code for Nvidia GPUs on my AMD GPU, which would be more concerning?