Bug 471819 - kwin hangs when there is no render node e.g. in qemu
Summary: kwin hangs when there is no render node e.g. in qemu
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: git master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2023-07-01 07:18 UTC by Jos van den Oever
Modified: 2024-02-12 15:11 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jos van den Oever 2023-07-01 07:18:45 UTC
SUMMARY

When there is no render node in kwin_wayland, no rendering is done. In QEmu, when no opengl is available the rendering falls back to a primary node:
`kwin_scene_opengl: No render nodes have been found, falling back to primary node`
kwin continues executing, but freezes at some point without rendering anything.

A solution might be to have an early check for that and automatically fall back to CPU rendering if there are not any render nodes.

STEPS TO REPRODUCE
1. install kwin in a qemu image and 
2. start kwin

OBSERVED RESULT

kwin hangs without showing any input. 

EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: master kwin: b23d707e0cc12156b0eb9613bb791365d1217f25
(available in About System)
KDE Plasma Version:  master
KDE Frameworks Version: master
Qt Version: 6.5

ADDITIONAL INFORMATION

I ran this in qemu with

```
nixos-rebuild build-vm --flake 'git+https://invent.kde.org/vandenoever/kde-nix-flake/?ref=kf6-qt6&rev=44a978ee14f0f776113369780dca10fecd7d3629#test-x86_64-linux'
result/bin/run-nixos-vm
```
This boots a qemu with a recent (~2023-06-20) git version of KDE software.

When booted, kwin_wayland is started from a user account (user tester, pwd test)
```
qt.dbus.integration: Could not connect "org.freedesktop.login1.Session" to handleResumeDevice(uint, uint, QDBusUnixFileDescriptor)
pci id for fd 17: 1234:1111, driver (null)
MESA-LOADER: failed to open bochs-drm: /run/opengl-driver/lib/dri/bochs-drm_dri.so: cannot open shared object file: No such file or directory (search paths /run/opengl-driver/lib/dri, suffix _dri)
pci id for fd 18: 1234:1111, driver (null)
kmsro: driver missing
OpenGL vendor string:                   Mesa
OpenGL renderer string:                 llvmpipe (LLVM 15.0.7, 256 bits)
OpenGL version string:                  4.5 (Core Profile) Mesa 23.0.3
OpenGL shading language version string: 4.50
Driver:                                 LLVMpipe
GPU class:                              Unknown
OpenGL version:                         4.5
GLSL version:                           4.50
Mesa version:                           23.0.3
Linux kernel version:                   6.1.31
Requires strict binding:                no
GLSL shaders:                           yes
Texture NPOT support:                   yes
Virtual Machine:                        no
kwin_scene_opengl: No render nodes have been found, falling back to primary node
kwin_core: kwin-dmabuf-feedback-table: mmap failed: Invalid argument
kwin_core: Failed to create RamFile for LinuxDmaBufV1FormatTable
kwin_wayland_drm: DPMS has unrecognized enum 'On'
kwin_wayland_drm: DPMS has unrecognized enum 'Standby'
kwin_wayland_drm: DPMS has unrecognized enum 'Suspend'
kwin_wayland_drm: DPMS has unrecognized enum 'Off'
gbm_bo_get_fd_for_plane() failed: Function not implemented
kwin_wayland_drm: Checking test buffer failed for (1)
kwin_wayland_drm: Failed to find a working setup for new outputs!
gbm_bo_get_fd_for_plane() failed: Function not implemented
kwin_wayland_drm: Checking test buffer failed for (1)
kwin_core: Applying output config failed!
kf.coreaddons: The plugin "/nix/store/zdmvxgsb36biv1lrs4jg13vvyzs6lvac-kwin-6-20230626gitb23d707/lib/qt-6/plugins/kwin/plugins/StickyKeysPlugin.so" explicitly states an Id in the embedded metadata, which is different from the one derived from the filename The Id field from the KPlugin object in the metadata should be removed
error marshalling arguments for format_table: dup failed: Bad file descriptor
error in client communication (pid 1201)
qt.qpa.wayland: Creating a fake screen in order for Qt not to crash
kf.package: Invalid metadata for package structure "Plasma/Wallpaper"
kf.package: Invalid metadata for package structure "Plasma/LookAndFeel"
kscreenlocker_greet: Lockscreen QML outdated, falling back to default
kf.package: Cannot set a path in a package without structure "org.kde.breeze.desktop"
kf.package: Cannot set a path in a package without structure "org.kde.image"
```
Comment 1 Zamundaaa 2023-07-17 08:23:27 UTC
With the nomodeset kernel parameter, simpledrm is used and I also get no render node. KWin still works with llvmpipe though, so this might be a driver side problem
Comment 2 Jos van den Oever 2023-08-12 17:30:21 UTC
I tried again today with kwin_wayland for kf5 and kf6 compiled from today's git repositories.

weston works fine in the same setup, but kwin_wayland from kf5 gives this output:

```
No backend specified, automatically choosing drm
pci id for fd 19: 1234:1111, driver (null)
MESA-LOADER: failed to open bochs-drm: /run/opengl-driver/lib/dri/bochs-drm_dri.so: cannot open shared object file: No such file or directory (search paths /run/opengl-driver/lib/dri, suffix _dri)
pci id for fd 17: 1234:1111, driver (null)
kmsro: driver missing
OpenGL vendor string:                   Mesa
OpenGL renderer string:                 llvmpipe (LLVM 15.0.7, 256 bits)
OpenGL version string:                  4.5 (Core Profile) Mesa 23.0.3
OpenGL shading language version string: 4.50
Driver:                                 LLVMpipe
GPU class:                              Unknown
OpenGL version:                         4.5
GLSL version:                           4.50
Mesa version:                           23.0.3
Linux kernel version:                   6.1.31
Requires strict binding:                no
GLSL shaders:                           yes
Texture NPOT support:                   yes
Virtual Machine:                        no
kwin_wayland_drm: Failed to create gamma blob! Invalid argument
```
Comment 3 Vlad Zahorodnii 2023-08-30 12:57:59 UTC
> gbm_bo_get_fd_for_plane() failed: Function not implemented

This is the culprit. It looks like a driver issue. kwin needs to export dmabuf file descriptors to work correctly, otherwise it's not going to work correctly.
Comment 4 Nate Graham 2023-08-30 16:31:33 UTC
Hmm, which is it? Is it a driver issue, or does KWin needs to export dmabuf file descriptors?

If the former, this should be RESOLVED UPSTREAM.

If the latter, then this should remain open until KWin is changed.
Comment 5 Zamundaaa 2024-02-12 15:11:13 UTC
This is a driver issue, gbm_bo_get_fd_for_plane needs to be implemented by the driver.