Bug 449285

Summary: Monitors on Wayland gives unknown name
Product: [Applications] systemsettings Reporter: Gusted <postmaster+kde>
Component: kcm_kscreenAssignee: kscreen-bugs-null <kscreen-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: etienne, nate, plasma-bugs, xaver.hugl
Priority: NOR    
Version: 5.23.5   
Target Milestone: ---   
Platform: Archlinux   
OS: Linux   
Latest Commit: Version Fixed In: 5.24.7
Attachments: Screenshot of display settings on Wayland
Screenshot of display settings on X11
Output of drm_info
Samsung monitor ebin
Lenovo monitor ebin
edid for Dell U2715H

Description Gusted 2022-01-28 10:19:27 UTC
Created attachment 146012 [details]
Screenshot of display settings on Wayland

STEPS TO REPRODUCE
1. Have a NVIDIA GPU & latest driver 495.46 & Use wayland plasma session.
2. Go to System settings -> Display and Monitor -> Display configuration.

OBSERVED RESULT
Observer that the device's name gives "unknown" and not able to select primary(related?)

EXPECTED RESULT
Observer that the device's name have the correct monitor name and able to select a primary monitor.

SOFTWARE/OS VERSIONS
Linux: 5.16.2-arch1-1
(available in About System)
KDE Plasma Version: 5.23.5
KDE Frameworks Version:  5.90.0
Qt Version: 5.15.2


ADDITIONAL INFORMATION
This works correctly when using X11
Comment 1 Gusted 2022-01-28 10:21:14 UTC
Created attachment 146013 [details]
Screenshot of display settings on X11
Comment 2 Zamundaaa 2022-01-28 13:52:53 UTC
Please attach the output of drm_info
Comment 3 Gusted 2022-01-28 14:53:56 UTC
Created attachment 146015 [details]
Output of drm_info

Attached output of drm_info
Comment 4 Zamundaaa 2022-01-31 16:20:09 UTC
The driver does expose EDID blobs but they either contain invalid information or KWin fails to parse them. As KWins parsing code works with other GPUs I assume it's a driver bug
Comment 5 Zamundaaa 2022-02-19 02:03:24 UTC
I got some more information about this from people on Reddit having the same issue - it seems to work fine on other compositors. Making matters weirder, one of them sent me their edid (retrieved via the /sys interface) and KWin's code does parse it correctly.

Can you attach your edid as well, to check whether or not it's the same for you?
To get the edid you first search for paths with "find /sys | grep -i edid" (ignore the "permission denied" bits). Some of these paths should be of the format of "[...]/drm/card0/card0-[...]/edid". Then you can copy the path that should be relevant for your monitor and do "cat path > edid.bin" to extract the file
Comment 6 Gusted 2022-02-19 13:25:35 UTC
Created attachment 146934 [details]
Samsung monitor ebin

edid bin of the Samsung monitor(see X11 screenshot), connected via `card0-DP-3`
Comment 7 Gusted 2022-02-19 13:26:37 UTC
Created attachment 146935 [details]
Lenovo monitor ebin

The ebin of the Lenovo monitor(See X11 screenshot). If needed I can upload the ebin's when using X11
Comment 8 Etienne Bruines 2022-03-29 08:11:24 UTC
Created attachment 147811 [details]
edid for Dell U2715H

It alsos happens for me on one of my (identical) Dell monitors (always the same one, DP-4). 

Attached the `edid` file for it. 

According to `parse-edid`, the file itself is correct.
Comment 9 Zamundaaa 2022-04-04 18:22:33 UTC
I think this is caused by a subtle but important part of how the drm interface works with data blobs, which KWin did not handle correctly.
https://invent.kde.org/plasma/kwin/-/merge_requests/2203 should fix it, can someone test?
Comment 10 Zamundaaa 2022-04-07 13:09:17 UTC
Git commit 34616520c2ef09382d1bb74ed4876a97b372875e by Xaver Hugl.
Committed on 07/04/2022 at 12:53.
Pushed by zamundaaa into branch 'master'.

backends/drm: fetch immutable blobs in DrmProperty

If the blob is fetched while there is no kernel-visible reference to it,
the driver may re-use the blob ID. When DrmProperty is created or updated,
KWin holds a reference on the blob via drmModeObjectProperties, so this
should prevent any possible issues.

M  +4    -9    src/backends/drm/drm_object_connector.cpp
M  +18   -21   src/backends/drm/drm_object_plane.cpp
M  +26   -1    src/backends/drm/drm_property.cpp
M  +6    -1    src/backends/drm/drm_property.h

https://invent.kde.org/plasma/kwin/commit/34616520c2ef09382d1bb74ed4876a97b372875e
Comment 11 Zamundaaa 2022-04-07 13:36:15 UTC
Git commit 82c2324b5675ea2d5e3b962f270bda1d186e7326 by Xaver Hugl.
Committed on 07/04/2022 at 13:33.
Pushed by zamundaaa into branch 'Plasma/5.24'.

backends/drm: fetch immutable blobs in DrmProperty

If the blob is fetched while there is no kernel-visible reference to it,
the driver may re-use the blob ID. When DrmProperty is created or updated,
KWin holds a reference on the blob via drmModeObjectProperties, so this
should prevent any possible issues.

M  +4    -9    src/backends/drm/drm_object_connector.cpp
M  +18   -21   src/backends/drm/drm_object_plane.cpp
M  +26   -1    src/backends/drm/drm_property.cpp
M  +6    -1    src/backends/drm/drm_property.h

https://invent.kde.org/plasma/kwin/commit/82c2324b5675ea2d5e3b962f270bda1d186e7326
Comment 12 Bug Janitor Service 2022-05-17 11:47:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2203
Comment 13 Bug Janitor Service 2022-08-04 13:46:23 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2777
Comment 14 Zamundaaa 2022-08-04 17:58:48 UTC
Git commit 97939ceae864aef2f50e117496f548555877b4ea by Xaver Hugl.
Committed on 04/08/2022 at 15:48.
Pushed by zamundaaa into branch 'master'.

backends/drm: fix blob updating

Two things about the code were wrong:
1. m_current is used in updateBlob() but was only updated afterwards
2. the assumption that the property having the same ID means it has the
same blob contents is not always true

M  +2    -4    src/backends/drm/drm_property.cpp

https://invent.kde.org/plasma/kwin/commit/97939ceae864aef2f50e117496f548555877b4ea
Comment 15 Zamundaaa 2022-08-04 18:38:58 UTC
Git commit 9a81567777f94e2e6c1a121f1d86dd2bdea83adf by Xaver Hugl.
Committed on 04/08/2022 at 18:38.
Pushed by zamundaaa into branch 'Plasma/5.25'.

backends/drm: fix blob updating

Two things about the code were wrong:
1. m_current is used in updateBlob() but was only updated afterwards
2. the assumption that the property having the same ID means it has the
same blob contents is not always true


(cherry picked from commit 97939ceae864aef2f50e117496f548555877b4ea)

M  +2    -4    src/backends/drm/drm_property.cpp

https://invent.kde.org/plasma/kwin/commit/9a81567777f94e2e6c1a121f1d86dd2bdea83adf
Comment 16 Zamundaaa 2022-08-04 18:39:27 UTC
Git commit 3af37c8a29af36eb773b0684237d61b2bd6b81f9 by Xaver Hugl.
Committed on 04/08/2022 at 18:39.
Pushed by zamundaaa into branch 'Plasma/5.24'.

backends/drm: fix blob updating

Two things about the code were wrong:
1. m_current is used in updateBlob() but was only updated afterwards
2. the assumption that the property having the same ID means it has the
same blob contents is not always true


(cherry picked from commit 97939ceae864aef2f50e117496f548555877b4ea)

M  +2    -4    src/backends/drm/drm_property.cpp

https://invent.kde.org/plasma/kwin/commit/3af37c8a29af36eb773b0684237d61b2bd6b81f9