Bug 475922 - kwin_wayland freeze loop on DisplayLink connection
Summary: kwin_wayland freeze loop on DisplayLink connection
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: multi-screen (show other bugs)
Version: 5.27.8
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: multiscreen, wayland
Depends on:
Blocks:
 
Reported: 2023-10-21 12:54 UTC by Norbert
Modified: 2024-05-02 09:16 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
without the dock connected (8.35 KB, text/plain)
2024-02-06 11:08 UTC, Norbert
Details
with the dock connected (8.35 KB, text/plain)
2024-02-06 11:08 UTC, Norbert
Details
drm_info when the docking station(lenovo dud9011d1) is pluged in on tthe plasma6 kwin wayland session (81.98 KB, application/octet-stream)
2024-02-13 10:31 UTC, Norbert
Details
drm_info when the docking station(lenovo dud9011d1) is pluged in on tthe plasma6 kwin x11 session (80.55 KB, application/octet-stream)
2024-02-13 10:32 UTC, Norbert
Details
drm_info on the plasma6 kwin wayland session without a dock (73.07 KB, application/octet-stream)
2024-02-13 10:33 UTC, Norbert
Details
drm_info when the docking station(lenovo dud9011d1) is pluged in on the plasma6 kwin wayland session and the session is working (84.22 KB, application/octet-stream)
2024-02-13 10:43 UTC, Norbert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Norbert 2023-10-21 12:54:01 UTC
SUMMARY
Kwin_wayland freezes if Monitors are plugged in over a DisplayLink connection.
It sometimes works for a second then freezes and sometimes reinitialize the monitors in loop.

The laptop in Use is a Lenovo ThinkBook 14 G3 with an AMD GPU, the Monitors are connected to a Lenovo Docking station, that connects over USB-C and the DisplayLink protocol to the laptop.

The following kernel drivers were needed on X11 "evdi" and "displaylink"

This matter is important since Plasma 6 is coming and many Users utilize DisplayLink docks in a Work environment.

I have two monitors:
1. 1920x1080 75hz Scaling 100% (Main)
2. 1920x1080 75hz Scaling 100%

STEPS TO REPRODUCE
1. Start Plasma Wayland Session
2. Connect Monitors with the Docking Station
3. Plug in the Docking station to the laptop using DisplayLink

OBSERVED RESULT
Display turn on, and sometimes work for 1-2 seconds, then the image gets static.
Laptop Screen still responsive, but most of the time the session freezes.
Sometime 

SOFTWARE/OS VERSIONS
Kernel: 6.5.8 or 6.1.59
Linux/KDE Plasma:  ArchLinux (21.10.2023)
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.11

ADDITIONAL INFORMATION
Some time ago, it worked with this Bug that was fixed in this issue:
https://bugs.kde.org/show_bug.cgi?id=414626

I was not able to produce a crash, so there is no traceback or dump

OUTPUT of systemctl --user status plasma-kwin_wayland.service
```
● plasma-kwin_wayland.service - KDE Window Manager
     Loaded: loaded (/usr/lib/systemd/user/plasma-kwin_wayland.service; static)
     Active: active (running) since Tue 2023-10-17 11:06:13 CEST; 4min 0s ago
   Main PID: 1094 (kwin_wayland_wr)
      Tasks: 24 (limit: 4217)
     Memory: 69.1M
        CPU: 11.231s
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/plasma-kwin_wayland.service
             ├─1094 /usr/bin/kwin_wayland_wrapper --xwayland
             ├─1098 /usr/bin/kwin_wayland --wayland-fd 7 --socket wayland-0 --xwayland-fd 8 --xwayland-fd 9 --xwayland-display :1 --xwayland-xauthority /run/user/1000/xauth_vhLxZV --xwayland
             └─1147 /usr/bin/Xwayland :1 -auth /run/user/1000/xauth_vhLxZV -listen 50 -listen 51 -displayfd 42 -rootless -wm 45

Oct 17 11:10:04 NMO-14G3 kwin_wayland_wrapper[1098]: MESA-LOADER: failed to retrieve device information
Oct 17 11:10:04 NMO-14G3 kwin_wayland_wrapper[1098]: MESA-LOADER: failed to retrieve device information
Oct 17 11:10:04 NMO-14G3 kwin_wayland_wrapper[1098]: kmsro: driver missing
Oct 17 11:10:07 NMO-14G3 kwin_wayland[1098]: QMetaProperty::read: Unable to handle unregistered datatype 'KWin::Output*' for property 'KWin::XdgToplevelWindow::output'
Oct 17 11:10:07 NMO-14G3 kwin_wayland[1098]: QMetaProperty::read: Unable to handle unregistered datatype 'QVector<KWin::VirtualDesktop*>' for property 'KWin::XdgToplevelWindow::desktops'
Oct 17 11:10:07 NMO-14G3 kwin_wayland[1098]: js: alwaysopenonactivescreen: window {
                                               "objectName": "",
                                               "bufferGeometry": {
                                                 "x": 96,
                                                 "y": 0,
                                                 "width": 1728,
                                                 "height": 815,
                                                 "left": 96,
                                                 "right": 1824,
                                                 "top": 0,
                                                 "bottom": 815
                                               },
                                               "pos": {
                                                 "x": 96,
                                                 "y": 0
                                               },
                                               "size": {
                                                 "width": 1728,
                                                 "height": 815
                                               },
                                               "x": 96,
                                               "y": 0,
                                               "width": 1728,
                                               "height": 815,
                                               "opacity": 1,
                                               "screen": 0,
                                               "rect": {
                                                 "x": 0,
                                                 "y": 0,
                                                 "width": 1728,
                                                 "height": 815,
                                                 "left": 0,
                                                 "right": 1728,
                                                 "top": 0,
                                                 "bottom": 815
                                               },
                                               "resourceName": "yakuake",
                                               "resourceClass": "org.kde.yakuake",
                                               "windowRole": "",
                                               "desktopWindow": false,
                                               "dock": false,
                                               "toolbar": false,
                                               "menu": false,
                                               "normalWindow": true,
                                               "dialog": false,
                                               "splash": false,
                                               "utility": false,
                                               "dropdownMenu": false,
                                               "popupMenu": false,
                                               "tooltip": false,
                                               "notification": false,
                                               "criticalNotification": false,
                                               "appletPopup": false,
                                               "onScreenDisplay": false,
                                               "comboBox": false,
                                               "dndIcon": false,
                                               "windowType": 0,
                                               "managed": true,
                                               "deleted": false,
                                               "shaped": false,
                                               "skipsCloseAnimation": false,
                                               "popupWindow": false,
                                               "outline": false,
                                               "internalId": "{4ed73103-0453-4b3b-a5e3-af5b74719d39}",
                                               "pid": 1441,
                                               "stackingOrder": 6,
                                               "fullScreen": false,
                                               "fullScreenable": true,
                                               "active": true,
                                               "desktop": 1,
                                               "onAllDesktops": false,
                                               "activities": [
                                                 "535a359f-438d-4fc1-9834-b3c2137c4a1a"
                                               ],
                                               "x11DesktopIds": [
                                                 1
                                               ],
                                               "skipTaskbar": true,
                                               "skipPager": false,
                                               "skipSwitcher": true,
                                               "closeable": true,
                                               "icon": "",
                                               "keepAbove": false,
                                               "keepBelow": false,
                                               "shadeable": false,
                                               "shade": false,
                                               "minimizable": true,
                                               "minimized": false,
                                               "iconGeometry": {
                                                 "x": 0,
                                                 "y": 0,
                                                 "width": 0,
                                                 "height": 0,
                                                 "left": 0,
                                                 "right": 0,
                                                 "top": 0,
                                                 "bottom": 0
                                               },
                                               "specialWindow": false,
                                               "demandsAttention": false,
                                               "caption": "~ : fish — Yakuake",
                                               "minSize": {
                                                 "width": 0,
                                                 "height": 0
                                               },
                                               "maxSize": {
                                                 "width": 2147483647,
                                                 "height": 2147483647
                                               },
                                               "wantsInput": true,
                                               "transient": false,
                                               "transientFor": null,
                                               "modal": false,
                                               "geometry": {
                                                 "x": 96,
                                                 "y": 0,
                                                 "width": 1728,
                                                 "height": 815,
                                                 "left": 96,
                                                 "right": 1824,
                                                 "top": 0,
                                                 "bottom": 815
                                               },
                                               "frameGeometry": {
                                                 "x": 96,
                                                 "y": 0,
                                                 "width": 1728,
                                                 "height": 815,
                                                 "left": 96,
                                                 "right": 1824,
                                                 "top": 0,
                                                 "bottom": 815
                                               },
                                               "move": false,
                                               "resize": false,
                                               "decorationHasAlpha": false,
                                               "noBorder": false,
                                               "providesContextHelp": false,
                                               "maximizable": true,
                                               "moveable": true,
                                               "moveableAcrossScreens": true,
                                               "resizeable": true,
                                               "desktopFileName": "org.kde.yakuake",
                                               "hasApplicationMenu": false,
                                               "applicationMenuActive": false,
                                               "unresponsive": false,
                                               "colorScheme": "kdeglobals",
                                               "layer": 2,
                                               "hidden": false,
                                               "tile": null
                                             }
Oct 17 11:10:07 NMO-14G3 kwin_wayland[1098]: QMetaProperty::read: Unable to handle unregistered datatype 'XwaylandCrashPolicy' for property 'KWin::Options::xwaylandCrashPolicy'
Oct 17 11:10:07 NMO-14G3 kwin_wayland[1098]: QMetaProperty::read: Unable to handle unregistered datatype 'PlacementPolicy' for property 'KWin::Options::placement'
Oct 17 11:10:07 NMO-14G3 kwin_wayland[1098]: QMetaProperty::read: Unable to handle unregistered datatype 'LatencyPolicy' for property 'KWin::Options::latencyPolicy'
Oct 17 11:10:07 NMO-14G3 kwin_wayland[1098]: QMetaProperty::read: Unable to handle unregistered datatype 'RenderTimeEstimator' for property 'KWin::Options::renderTimeEstimator'
```
Comment 1 Norbert 2023-12-23 18:47:47 UTC
Plasma 6 Beta 2 no improvements.
Comment 2 Zamundaaa 2024-01-24 21:36:53 UTC
Please attach the output of drm_info when the external screen is not frozen, and then again when it is frozen.
Comment 3 Norbert 2024-02-06 11:08:22 UTC
I was not able to get the information in an unfrozen state in plasma6, I will attach two logs, once without the dock connected, and the second with the dock connected display enabled but frozen.

The Logs are nearly identical, and it looks like it does not load the display at all.
Comment 4 Norbert 2024-02-06 11:08:44 UTC
Created attachment 165604 [details]
without the dock connected
Comment 5 Norbert 2024-02-06 11:08:59 UTC
Created attachment 165605 [details]
with the dock connected
Comment 6 Zamundaaa 2024-02-06 16:15:13 UTC
I think you got a wrong version of drm_info - it doesn't just not show the output, it doesn't show the DisplayLink adapter at all. Could you try again with https://gitlab.freedesktop.org/emersion/drm_info?
Comment 7 Norbert 2024-02-06 18:33:08 UTC
Thank you, I will.
Unfortunately I have access to the dock only once a week, I will be back on next Tuesday.
Comment 8 Norbert 2024-02-13 10:31:45 UTC
Created attachment 165800 [details]
drm_info when the docking station(lenovo dud9011d1) is pluged in on tthe plasma6 kwin wayland session

I could not find a difference between Wayland with and without the dock, but there is more on the kwin session.
Displaylink is using the evdi module to work.
Comment 9 Norbert 2024-02-13 10:32:29 UTC
Created attachment 165801 [details]
drm_info when the docking station(lenovo dud9011d1) is pluged in on tthe plasma6 kwin x11 session
Comment 10 Norbert 2024-02-13 10:33:01 UTC
Created attachment 165802 [details]
drm_info on the plasma6 kwin wayland session without a dock
Comment 11 Norbert 2024-02-13 10:37:55 UTC
(In reply to Norbert from comment #8)
> Created attachment 165800 [details]
> drm_info when the docking station(lenovo dud9011d1) is pluged in on tthe
> plasma6 kwin wayland session
> 
> I could not find a difference between Wayland with and without the dock, but
> there is more on the kwin session.
> Displaylink is using the evdi module to work.

I wanted to say, that there are more outputs visible on the kwin x11 sessions output.
Which is weird because kscreen in the Wayland session is able to detect the DisplayLink Monitors.

I will attach the kscreen output as well
Comment 12 Norbert 2024-02-13 10:43:10 UTC
Created attachment 165803 [details]
drm_info when the docking station(lenovo dud9011d1) is pluged in on the plasma6 kwin wayland session and the session is working

This time, I've managed to get the drm_info output when the session is in an unfrozen state.
It froze after 2 seconds again.
Comment 13 Norbert 2024-02-13 10:45:06 UTC
This time I did not manage to get kscreen to detect the outputs.
I hope the drm_info from the unfrozen state helps.
Comment 14 Zamundaaa 2024-02-13 17:11:37 UTC
Okay, the drm_info output shows no difference between KWin driving the output when it works vs when it doesn't.
Something weird is that drm_info doesn't show the output being driven at all in the X11 session - but that might just be the X11 driver doing weird stuff outside of KMS.

As there's no difference between it working and not working from KWin's perspective, I'm confident to say that this is a driver bug, which you can report at https://github.com/DisplayLink/evdi/issues.

Maybe we can look at some workarounds though. It looks like KWin us choosing the ABGR8888 format for the output; Xorg is likely using XRGB8888. If you use `KWIN_DRM_NO_AMS=1` to make KWin do the same, does the issue go away?
Comment 15 Norbert 2024-02-27 11:04:45 UTC
Hi, with `KWIN_DRM_NO_AMS=1` 
It works now without any issues, I noticed since the latest kwin update even without Variable, kwin does not freeze anymore on the working display outputs.

It works even better than with xorg because the input latency is noticeably lower.
Comment 16 Norbert 2024-02-27 12:43:34 UTC
To clear up my bad English.

1. With the `KWIN_DRM_NO_AMS=1` Variable, all Displays work correctly and does not freeze or reconnect anymore.
    This includes using all DP and HDMI ports on the docking station and the in build Laptop HDMI at once.
2. Some times ago(~Plasma6 Beta 2), one frozen Display would freeze the whole session, now only the causing Display is frozen.
Comment 17 Zamundaaa 2024-02-29 14:11:12 UTC
That's interesting, so ARGB8888 vs XRGB8888 does seem to cause the difference. Please create an issue about this at https://github.com/DisplayLink/evdi/issues, and link this bug report for more information.
Comment 18 Norbert 2024-02-29 17:10:18 UTC
Thank you for your help, i am now able to work properly again.
I have created an Issue on Evdi Github: https://github.com/DisplayLink/evdi/issues/459
Comment 19 Kai Uwe Broulik 2024-03-22 21:00:39 UTC
Possible workaround: https://invent.kde.org/plasma/kwin/-/merge_requests/5513
Comment 20 Kai Uwe Broulik 2024-05-02 09:16:57 UTC
If anyone experiencing this bug could test the above merge request that would be appreciated. I cannot reproduce the issue on my DisplayLink docking station so I’m wary of merging it without having verified it actually fixes the issue (and doesn’t make things worse)