Bug 433145 - Kwin crashes on selecting Wayland in Optimus laptop
Summary: Kwin crashes on selecting Wayland in Optimus laptop
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.21.0
Platform: Arch Linux Linux
: NOR grave
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-18 09:22 UTC by Chandradeep Dey
Modified: 2021-02-25 22:18 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.21.1


Attachments
kwin crash log (1.46 KB, text/x-log)
2021-02-18 09:22 UTC, Chandradeep Dey
Details
kwin crash log (14.29 KB, text/x-log)
2021-02-19 16:24 UTC, Chandradeep Dey
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chandradeep Dey 2021-02-18 09:22:39 UTC
Created attachment 135821 [details]
kwin crash log

SUMMARY
Selecting Plasma (Wayland) in SDDM and logging in brings me back to SDDM immediately after a second of UEFI firmware logo. 5.20.90 beta worked fine.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.10.17-1
KDE Plasma Version: 5.21.0
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Intel Core i7-7700HQ (HD Graphics 630)
mesa: 20.3.4-1
Nvidia GeForce GTX 1050 Ti
nvidia: 1:460.39-11

nvidia-drm.modeset=1
Comment 1 Chandradeep Dey 2021-02-18 09:33:36 UTC
Disabling Nvidia DRM KMS works. But 5.20.90 beta worked fine with KMS enabled for both GPUs.

P.S. - Someone please change the importance since a workaround exists.
Comment 2 Bug Janitor Service 2021-02-19 12:01:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/714
Comment 3 Zamundaaa 2021-02-19 12:29:07 UTC
Git commit 79ccfaddf074f5e72bc9cb5f0bce2b7666328244 by Xaver Hugl.
Committed on 19/02/2021 at 12:19.
Pushed by zamundaaa into branch 'master'.

Properly clean up DrmGpu

M  +7    -23   src/plugins/platforms/drm/drm_backend.cpp
M  +19   -1    src/plugins/platforms/drm/drm_gpu.cpp
M  +2    -0    src/plugins/platforms/drm/drm_gpu.h

https://invent.kde.org/plasma/kwin/commit/79ccfaddf074f5e72bc9cb5f0bce2b7666328244
Comment 4 Zamundaaa 2021-02-19 12:31:34 UTC
Once you test the patch (either in 5.21.1 or by compiling it yourself) close the bug report or complain again, depending on the result :)
Comment 5 Zamundaaa 2021-02-19 13:35:21 UTC
Git commit d3c3d8c2f640b5a3be3c3bbb1bfbb689266e1e3b by Xaver Hugl.
Committed on 19/02/2021 at 13:34.
Pushed by zamundaaa into branch 'Plasma/5.21'.

Properly clean up DrmGpu
(cherry picked from commit 79ccfaddf074f5e72bc9cb5f0bce2b7666328244)

M  +7    -23   plugins/platforms/drm/drm_backend.cpp
M  +19   -1    plugins/platforms/drm/drm_gpu.cpp
M  +2    -0    plugins/platforms/drm/drm_gpu.h

https://invent.kde.org/plasma/kwin/commit/d3c3d8c2f640b5a3be3c3bbb1bfbb689266e1e3b
Comment 6 Nate Graham 2021-02-19 15:00:26 UTC
Is this fully fixed now?
Comment 7 Zamundaaa 2021-02-19 15:36:58 UTC
Without a backtrace of the crash or confirmation that the patch works I wouldn't consider it fixed just yet
Comment 8 Chandradeep Dey 2021-02-19 16:24:56 UTC
Created attachment 135908 [details]
kwin crash log

now it takes a little while before the password box and enter icon are unlocked again after pressing enter and the firmware logo doesn't show up.
Comment 9 Zamundaaa 2021-02-19 16:28:13 UTC
Could you get a backtrace?
Comment 10 Chandradeep Dey 2021-02-19 17:04:13 UTC
I just created a debug build (5.21.0, no patch) and no crashes happen there. ;-;
Comment 11 Chandradeep Dey 2021-02-19 17:08:55 UTC
And of course no crashes in the original release build either :/
I guess fixed.
Comment 12 Zamundaaa 2021-02-19 17:25:23 UTC
Are you sure you added nvidia-drm.modeset=1 again before testing (and did a reboot)?
Comment 13 Chandradeep Dey 2021-02-19 17:39:59 UTC
Yep
Comment 14 Chandradeep Dey 2021-02-23 22:16:41 UTC
The patch breaks it in 5.21.1. I will try to get a debug build running tomorrow.

https://bugs.kde.org/show_bug.cgi?id=433145#c8
Comment 15 rafael.oliveira2 2021-02-24 17:22:46 UTC
Even with Plasma 5.21.1 I cannot log into a wayland session with nvidia-drm.modeset=1 active
Comment 16 Chandradeep Dey 2021-02-24 18:31:03 UTC
I tried but it's always "Failed to attach to process because it terminated with SIGSEGV, the program is not running" or something like that.
Comment 17 Zamundaaa 2021-02-24 18:51:34 UTC
If you're lucky then "coredumpctl debug kwin_wayland" to debug the last crash works (sadly often doesn't). Also please upload ~/.local/share/sddm/wayland-session.log again, with the environment variable
QT_LOGGING_RULES="kwin_*.debug=true;kwin_libinput.debug=false"
Comment 18 rafael.oliveira2 2021-02-25 10:43:02 UTC
coredumpctl debug kwin_wayland:
https://pastebin.com/tgbrtzEc

wayland-session.log:
https://pastebin.com/QFRjSeGB
Comment 19 Bug Janitor Service 2021-02-25 18:16:22 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/738
Comment 20 Zamundaaa 2021-02-25 18:18:02 UTC
To get the full backtrace you need to input "bt" after the coredumpctl command. However the source of the crash was very obvious without it now, too; I'm pretty sure it should work now. Could you test?
Comment 21 rafael.oliveira2 2021-02-25 20:40:24 UTC
I'm trying to test this solution, but kwin is getting in the way ...
Can you help?

https://pastebin.com/v9Ry1cNq
Comment 22 Zamundaaa 2021-02-25 20:45:54 UTC
You're hitting incompatibilities with the version of KWaylandServer in your system, so you need to either compile that yourself, too, or use the Plasma/5.21 branch and apply the patch (https://invent.kde.org/plasma/kwin/-/commit/1f7e794b82c65eef7f863e7bcc9802e82ce1bc30.diff) on top of that instead
Comment 23 rafael.oliveira2 2021-02-25 22:00:50 UTC
Ok, now I managed to enter the wayland session, but the external monitor was not recognized
Is this expected?
Comment 24 Zamundaaa 2021-02-25 22:14:34 UTC
Yes, multi-gpu support for the proprietary driver isn't there. That problem is tracked at https://bugs.kde.org/show_bug.cgi?id=431062, both for Noveau (that appears to not work either for some reason) and for the proprietary driver (where I do have an idea on how to implement it now, it's just not yet done).

Thanks for testing!
Comment 25 Zamundaaa 2021-02-25 22:14:59 UTC
Git commit 1f7e794b82c65eef7f863e7bcc9802e82ce1bc30 by Xaver Hugl.
Committed on 25/02/2021 at 18:14.
Pushed by zamundaaa into branch 'master'.

DrmGpu: add gbm device nullptr check

M  +3    -1    src/plugins/platforms/drm/drm_gpu.cpp

https://invent.kde.org/plasma/kwin/commit/1f7e794b82c65eef7f863e7bcc9802e82ce1bc30
Comment 26 Zamundaaa 2021-02-25 22:18:57 UTC
Git commit c2b2127f3ae0da05b9bc7f4968f7c6292c54de51 by Xaver Hugl.
Committed on 25/02/2021 at 22:18.
Pushed by zamundaaa into branch 'Plasma/5.21'.

DrmGpu: add gbm device nullptr check
(cherry picked from commit 1f7e794b82c65eef7f863e7bcc9802e82ce1bc30)

M  +3    -1    plugins/platforms/drm/drm_gpu.cpp

https://invent.kde.org/plasma/kwin/commit/c2b2127f3ae0da05b9bc7f4968f7c6292c54de51