Bug 462214 - "kwin_wayland_drm: Failed to find a working setup for new outputs!" "Atomic modeset test failed! Invalid argument" with external display (Qualcomm GPU)
Summary: "kwin_wayland_drm: Failed to find a working setup for new outputs!" "Atomic m...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: platform-drm (show other bugs)
Version: 5.26.3
Platform: Debian testing Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-24 19:45 UTC by Leonard Lausen
Modified: 2022-12-14 22:49 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.26.5


Attachments
startplasma-wayland debug log (99.27 KB, text/x-log)
2022-11-24 19:45 UTC, Leonard Lausen
Details
startplasma-wayland debug log based on a new test user (111.78 KB, text/x-log)
2022-11-24 19:45 UTC, Leonard Lausen
Details
dmesg with verbose DRM logging (303.10 KB, text/plain)
2022-11-25 02:11 UTC, Leonard Lausen
Details
drm_info.txt (28.42 KB, text/plain)
2022-12-10 21:33 UTC, Leonard Lausen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Leonard Lausen 2022-11-24 19:45:03 UTC
Created attachment 154000 [details]
startplasma-wayland debug log

KWin Wayland session is currently broken on ARM devices such as Acer Spin 513 Chromebook with Qualcomm Snapdragon 7c [1] if an external display is used. There are no issues with using the KWin X11 session in this setting with external display, nor any issues with the KWin Wayland session as long as no external display is connected.

STEPS TO REPRODUCE
1.  Obtain a laptop with Qualcomm Snapdragon chipset
2. From a tty run `export QT_LOGGING_RULES="kwin_*.debug=true"; startplasma-wayland > ~/startplasma-wayland.log 2>&1 `
3. Wait a minute and `killall startplasma-wayland` from the serial console (as kwin took over the tty and can't be interrupted)

OBSERVED RESULT
The tty continues to be displayed and kwin fails to start a graphical session and hangs indefinitely.

EXPECTED RESULT
kwin successfully starts a plasma session.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Linux 6.0.8
KDE Plasma Version:  5.26.3
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.6

ADDITIONAL INFORMATION
Full startplasma-wayland.log attached. Also attached is startplasma-wayland-newuser.log which contains the debug log upon reproducing with a fresh user (sudo adduser test). Both logs are substantially similar, but have small differences in the debug messages regarding Drm objects.

Relevant excerpt:

No backend specified, automatically choosing drm
kwin_wayland_drm: Skipping KMS incapable drm device node at "/dev/dri/card0"
kwin_wayland_drm: drmModeAddFB2WithModifiers is supported on GPU "/dev/dri/card1"
kwin_wayland_drm: Using Atomic Mode Setting on gpu "/dev/dri/card1"
kwin_wayland_drm: Number of planes on GPU "/dev/dri/card1" : 4
kwin_wayland_drm: Plane 41 has properties "type"="Primary", "SRC_X"=0, "SRC_Y"=0, "SRC_W"=125829120, "SRC_H"=70778880, "CRTC_X"=0, "CRTC_Y"=0, "CRTC_W"=1920, "CRTC_H"=1080, "FB_ID"=68, "CRTC_ID"=65, "rotation"=invalid value: 1, "IN_FORMATS"=42
kwin_wayland_drm: Plane 47 has properties "type"="Primary", "SRC_X"=0, "SRC_Y"=0, "SRC_W"=125829120, "SRC_H"=70778880, "CRTC_X"=0, "CRTC_Y"=0, "CRTC_W"=1920, "CRTC_H"=1080, "FB_ID"=68, "CRTC_ID"=66, "rotation"=invalid value: 1, "IN_FORMATS"=48
kwin_wayland_drm: Plane 53 has properties "type"="Cursor", "SRC_X"=0, "SRC_Y"=0, "SRC_W"=0, "SRC_H"=0, "CRTC_X"=0, "CRTC_Y"=0, "CRTC_W"=0, "CRTC_H"=0, "FB_ID"=0, "CRTC_ID"=0, "rotation"=invalid value: 1, "IN_FORMATS"=54
kwin_wayland_drm: Plane 59 has properties "type"="Cursor", "SRC_X"=0, "SRC_Y"=0, "SRC_W"=0, "SRC_H"=0, "CRTC_X"=0, "CRTC_Y"=0, "CRTC_W"=0, "CRTC_H"=0, "FB_ID"=0, "CRTC_ID"=0, "rotation"=invalid value: 1, "IN_FORMATS"=60
kwin_wayland_drm: Crtc 65 has properties "MODE_ID"=69, "ACTIVE"=1, "VRR_ENABLED"=0, "GAMMA_LUT" not found, "GAMMA_LUT_SIZE" not found
kwin_wayland_drm: Crtc 66 has properties "MODE_ID"=71, "ACTIVE"=1, "VRR_ENABLED"=0, "GAMMA_LUT" not found, "GAMMA_LUT_SIZE" not found
[...]
kwin_core: KGlobalAcceld inited
kwin_core: Attempting to load the OpenGL scene
kwin_scene_opengl: Egl Initialize succeeded
kwin_scene_opengl: EGL version:  1 . 5
kwin_scene_opengl: Created EGL context with attributes: 
Version requested:	true
Version:	3.1
Robust:	true
Reset on video memory purge:	false
Forward compatible:	false
Core profile:	false
Compatibility profile:	false
High priority:	true
kwin_scene_opengl: Created EGL context with attributes: 
Version requested:	true
Version:	3.1
Robust:	true
Reset on video memory purge:	false
Forward compatible:	false
Core profile:	false
Compatibility profile:	false
High priority:	true
OpenGL vendor string:                   freedreno
OpenGL renderer string:                 FD618
OpenGL version string:                  3.3 (Core Profile) Mesa 22.2.4
OpenGL shading language version string: 3.30
Driver:                                 Unknown
GPU class:                              Unknown
OpenGL version:                         3.3
GLSL version:                           3.30
Mesa version:                           22.2.4
Linux kernel version:                   6.0.8
Requires strict binding:                no
GLSL shaders:                           yes
Texture NPOT support:                   yes
Virtual Machine:                        no
kwin_scene_opengl: Filter multi-plane format 961959257
kwin_scene_opengl: Filter multi-plane format 825316697
kwin_scene_opengl: Filter multi-plane format 842093913
kwin_scene_opengl: Filter multi-plane format 909202777
kwin_scene_opengl: Filter multi-plane format 875713881
kwin_scene_opengl: Filter multi-plane format 961893977
kwin_scene_opengl: Filter multi-plane format 825316953
kwin_scene_opengl: Filter multi-plane format 842094169
kwin_scene_opengl: Filter multi-plane format 909203033
kwin_scene_opengl: Filter multi-plane format 875714137
kwin_scene_opengl: Filter multi-plane format 842094158
kwin_scene_opengl: Filter multi-plane format 909203022
kwin_scene_opengl: EGL driver advertises 30 supported dmabuf formats with modifiers
kwin_core: OpenGL compositing has been successfully initialized
kwin_wayland_drm: Connector 32 has properties "CRTC_ID"=65, "non-desktop"=0, "DPMS"=0, "EDID"=67, "overscan" not found, "vrr_capable" not found, "underscan" not found, "underscan vborder" not found, "underscan hborder" not found, "Broadcast RGB" not found, "max bpc" not found, "link-status"="Good"
kwin_wayland_drm: Connector 34 has properties "CRTC_ID"=66, "non-desktop"=0, "DPMS"=0, "EDID"=72, "overscan" not found, "vrr_capable" not found, "underscan" not found, "underscan vborder" not found, "underscan hborder" not found, "Broadcast RGB" not found, "max bpc" not found, "link-status"="Good"
kwin_wayland_drm: New output on GPU /dev/dri/card1: eDP-1-unknown
kwin_wayland_drm: New output on GPU /dev/dri/card1: DELL U2722DE/7R9MR83
kwin_wayland_drm: Atomic modeset test failed! Invalid argument
kwin_wayland_drm: Drm objects:
kwin_wayland_drm: "connector" 32
kwin_wayland_drm: 	"CRTC_ID": 65
kwin_wayland_drm: 	"non-desktop": 0
kwin_wayland_drm: 	"DPMS": 0
kwin_wayland_drm: 	"EDID": 67
kwin_wayland_drm: 	"link-status": 0
kwin_wayland_drm: "crtc" 65
kwin_wayland_drm: 	"MODE_ID": 69->74
kwin_wayland_drm: 	"ACTIVE": 1
kwin_wayland_drm: 	"VRR_ENABLED": 0
kwin_wayland_drm: "plane" 47
kwin_wayland_drm: 	"type": 1
kwin_wayland_drm: 	"SRC_X": 0
kwin_wayland_drm: 	"SRC_Y": 0
kwin_wayland_drm: 	"SRC_W": 1920
kwin_wayland_drm: 	"SRC_H": 1080
kwin_wayland_drm: 	"CRTC_X": 0
kwin_wayland_drm: 	"CRTC_Y": 0
kwin_wayland_drm: 	"CRTC_W": 1920
kwin_wayland_drm: 	"CRTC_H": 1080
kwin_wayland_drm: 	"FB_ID": 68->73
kwin_wayland_drm: 	"CRTC_ID": 66->65
kwin_wayland_drm: 	"rotation": 1
kwin_wayland_drm: 	"IN_FORMATS": 48
kwin_wayland_drm: "plane" 53
kwin_wayland_drm: 	"type": 2
kwin_wayland_drm: 	"SRC_X": 0
kwin_wayland_drm: 	"SRC_Y": 0
kwin_wayland_drm: 	"SRC_W": 0->64
kwin_wayland_drm: 	"SRC_H": 0->64
kwin_wayland_drm: 	"CRTC_X": 0
kwin_wayland_drm: 	"CRTC_Y": 0
kwin_wayland_drm: 	"CRTC_W": 0->64
kwin_wayland_drm: 	"CRTC_H": 0->64
kwin_wayland_drm: 	"FB_ID": 0
kwin_wayland_drm: 	"CRTC_ID": 0
kwin_wayland_drm: 	"rotation": 1
kwin_wayland_drm: 	"IN_FORMATS": 54
kwin_wayland_drm: Drm objects:
[...]
Comment 1 Leonard Lausen 2022-11-24 19:45:41 UTC
Created attachment 154001 [details]
startplasma-wayland debug log based on a new test user
Comment 2 Leonard Lausen 2022-11-25 02:10:55 UTC
Attaching kernel log with verbose DRM logging, which may help determining why KWin is issuing an invalid command and which. KWin is started at [17471.518135] and killed at [17510.700261].
Comment 3 Leonard Lausen 2022-11-25 02:11:41 UTC
Created attachment 154013 [details]
dmesg  with verbose DRM logging
Comment 4 Leonard Lausen 2022-11-27 02:56:08 UTC
The verbose DRM dmesg log shows that all configurations tried by kwin fail the kernel drm_atomic_plane_check, specifically the plane_switching_crtc sanity check [1], meaning that kwin triggers unsupported direct switching of CRTCs. Any ideas why that may happen?

msm_dpu ae01000.display-controller: [drm:drm_atomic_check_only] [PLANE:41:plane-0] switching CRTC directly
msm_dpu ae01000.display-controller: [drm:drm_atomic_check_only] [PLANE:41:plane-0] atomic core check failed

I also noticed that above kwin_wayland_drm output says `"rotation": 1` and `"rotation"=invalid value: 1`. @vladz uploaded a log containing `"rotation": 1` at  https://invent.kde.org/-/snippets/1976 Any ideas if that is the root-cause?

[1]: https://github.com/torvalds/linux/blob/faf68e3523c21d07c5f7fdabd0daf6301ff8db3f/drivers/gpu/drm/drm_atomic.c#L565-L581
Comment 5 Leonard Lausen 2022-12-10 21:33:11 UTC
Created attachment 154487 [details]
drm_info.txt
Comment 6 Bug Janitor Service 2022-12-10 21:46:34 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3294
Comment 7 Zamundaaa 2022-12-11 15:15:51 UTC
Git commit ffad2dd7ada98249ec1f15bd0ca6cf7d89dbfdd5 by Xaver Hugl.
Committed on 11/12/2022 at 15:01.
Pushed by zamundaaa into branch 'master'.

backends/drm: don't break crtc<->plane connections

The kernel rejects such commits without the crtc being completely turned
off first.

M  +27   -10   src/backends/drm/drm_gpu.cpp

https://invent.kde.org/plasma/kwin/commit/ffad2dd7ada98249ec1f15bd0ca6cf7d89dbfdd5
Comment 8 Zamundaaa 2022-12-11 15:17:30 UTC
Git commit 54a1858316b350b8ee3767d756f516f30b4a5b04 by Xaver Hugl.
Committed on 11/12/2022 at 15:17.
Pushed by zamundaaa into branch 'cherry-pick-ffad2dd7'.

backends/drm: don't break crtc<->plane connections

The kernel rejects such commits without the crtc being completely turned
off first.


(cherry picked from commit ffad2dd7ada98249ec1f15bd0ca6cf7d89dbfdd5)

M  +27   -10   src/backends/drm/drm_gpu.cpp

https://invent.kde.org/plasma/kwin/commit/54a1858316b350b8ee3767d756f516f30b4a5b04