Bug 462625

Summary: Black screen on non-primary mux-switched gpu displays (usb adapters and iGPU + dGPU)
Product: [Plasma] kwin Reporter: raffarti
Component: platform-drmAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: major CC: nate, xaver.hugl
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: journalctl log
drm_info
drm info with kwin from repos (black screen)
Logging for multi gpu stuff
journal with working kwin
journal with broken kwin + logging

Description raffarti 2022-12-04 09:56:33 UTC
SUMMARY
When connecting a monitor to a secondary gpu with a wayland session, it results in a black screen with laggy mouse. The mouse changes based on what it would hoover (text, resize handles, ...). 

journalctl shows a lot of lines like this:
`kwin_wayland_drm: failed to import gbm_bo for multi-gpu usage: Function not implemented`

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:  OpenSUSE Tumbleweed with KDE unstable repos (bug not present on system repos 5.26.4)
(available in About System)
KDE Plasma Version: 5.26.80
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.7

ADDITIONAL INFORMATION
Observed on 6800H + 6600M (with mux switch). The bug only occurs while using the integrated gpu as primary or an usb to hdmi adapter is used.
X11 works fine.
Comment 1 raffarti 2022-12-04 10:40:45 UTC
Forgot to specify:
only the external display is black, the display of the laptop keeps working normally.
Comment 2 Zamundaaa 2022-12-04 18:00:11 UTC
Please attach the output of "journalctl --user-unit plasma-kwin_wayland --boot 0" and drm_info (https://gitlab.freedesktop.org/emersion/drm_info).

If you can build KWin yourself, can you check out commit cd6a21996135d4ac40c0eee1b5d283e1bc844797 and see if the issue was present there already?
Comment 3 raffarti 2022-12-04 22:06:31 UTC
(In reply to Zamundaaa from comment #2)
> Please attach the output of "journalctl --user-unit plasma-kwin_wayland
> --boot 0" and drm_info (https://gitlab.freedesktop.org/emersion/drm_info).
> 
> If you can build KWin yourself, can you check out commit
> cd6a21996135d4ac40c0eee1b5d283e1bc844797 and see if the issue was present
> there already?

cd6a21996135d4ac40c0eee1b5d283e1bc844797 works, next one (b3d0698126ac7bd992d253fc3db344bb3137bf6f) indeed does not.
Comment 4 raffarti 2022-12-04 22:07:34 UTC
Created attachment 154315 [details]
journalctl log
Comment 5 raffarti 2022-12-04 22:07:59 UTC
Created attachment 154316 [details]
drm_info
Comment 6 raffarti 2022-12-04 22:35:09 UTC
Created attachment 154318 [details]
drm info with kwin from repos (black screen)

the previous drm_info was taken with the working commit
Comment 7 Zamundaaa 2022-12-05 17:36:53 UTC
Created attachment 154338 [details]
Logging for multi gpu stuff

Can you upload the journalctl output again, once for the working commit, and once for the failing one with the attached patch on top?
Comment 8 raffarti 2022-12-05 21:02:20 UTC
Created attachment 154346 [details]
journal with working kwin
Comment 9 raffarti 2022-12-05 21:03:16 UTC
Created attachment 154347 [details]
journal with broken kwin + logging
Comment 10 Bug Janitor Service 2022-12-06 16:50:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3280
Comment 11 Zamundaaa 2022-12-06 16:51:46 UTC
Can you test the MR?
Comment 12 raffarti 2022-12-06 18:10:34 UTC
(In reply to Zamundaaa from comment #11)
> Can you test the MR?

Hello, it works fine with the iGPU + dGPU configuration, but sadly I cannot test the USB-to-HDMI dongle until tomorrow evening (for the sake of completeness).

Cheers
Comment 13 Zamundaaa 2022-12-06 20:46:08 UTC
Git commit 3d9ccaf74269285d6dcd76e34bc9a8e040672886 by Xaver Hugl.
Committed on 06/12/2022 at 19:55.
Pushed by zamundaaa into branch 'master'.

backends/drm: fix modifier check

If we force a linear modifier, the modifier list can't match up with the
display, which causes the surface to be recreated every frame.

M  +3    -2    src/backends/drm/drm_egl_layer_surface.cpp
M  +1    -0    src/backends/drm/drm_egl_layer_surface.h

https://invent.kde.org/plasma/kwin/commit/3d9ccaf74269285d6dcd76e34bc9a8e040672886
Comment 14 raffarti 2022-12-07 19:54:50 UTC
Tested with the USB-to-HDMI dongle and that's working too.