Bug 478301 - Log spam "drmPrimeHandleToFD() failed: No such file or directory" (Wayland, virtualization)
Summary: Log spam "drmPrimeHandleToFD() failed: No such file or directory" (Wayland, v...
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: core (other bugs)
Version First Reported In: git master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 473887 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-12-09 12:37 UTC by Stefan Hoffmeister
Modified: 2025-10-17 10:43 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Hoffmeister 2023-12-09 12:37:25 UTC
SUMMARY

On every single change of cursor shape (e.g. caret to pointer), log spam is created when run under Wayland, under virtualized graphics (VMware Workstation):
```
Dec 09 13:21:18 fedora kwin_wayland[1633]: kwin_core: Allocating dumb buffer: fd 19 width 64 height 64
Dec 09 13:21:18 fedora kwin_wayland[1633]: kwin_core: drmPrimeHandleToFD() failed: No such file or directory ( 2 ) 1
Dec 09 13:21:18 fedora kwin_wayland[1633]: kwin_scene_qpainter: Failed to allocate a qpainter swapchain graphics buffer
Dec 09 13:21:18 fedora kwin_wayland[1633]: kwin_wayland_drm: EglGbmLayerSurface::importWithCpu: failed to get a target dumb buffer
```

STEPS TO REPRODUCE
1. boot Fedora Rawhide (40) under VMware Workstation, running KDE Plasma 6 (git master)
2. open konsole
3. `journalctl --follow`
4. move mouse cursor around such that the pointer changes - e.g. from text field to task bar

OBSERVED RESULT

* Cursor shape seems to update just fine
* Log spam, see above for log lines (note that the log lines contain local modification)

EXPECTED RESULT

* No log spam

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Rawhide (40), KDE Plasma 6 from git master (also on beta 1), Wayland

ADDITIONAL INFORMATION

This is on Linux kernel 6.7.rc4. This kernel does not have the cursor plane / hotspot fixes in - https://lore.kernel.org/lkml/87h6lbcixj.fsf@minerva.mail-host-address-is-not-set/ -, I guess all this only comes in mid of January 2024, with kernel Linux 6.8.

Because of that, the "do not use atomic mode-setting" workaround is still applied by kwin, so this virtual machine has no atomic mode setting active, IIUC.
Comment 1 Stefan Hoffmeister 2023-12-13 07:40:35 UTC
I believe this significantly correlates with Xwayland running into problems in legacy mode; the logs are full of this, too:
```
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) glamor0: GL error: GL_OUT_OF_MEMORY in glTexSubImage
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE)
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) Backtrace:
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 0: /usr/bin/Xwayland (0x55d5958db000+0x17a432) [0x55d595a55432]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 1: /usr/lib64/dri/vmwgfx_dri.so (0x7f5ab6400000+0x36e0ef) [0x7f5ab676e0ef]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 2: /usr/lib64/dri/vmwgfx_dri.so (0x7f5ab6400000+0x1aff13) [0x7f5ab65aff13]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 3: /usr/lib64/dri/vmwgfx_dri.so (0x7f5ab6400000+0x1c2bf8) [0x7f5ab65c2bf8]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 4: /usr/lib64/dri/vmwgfx_dri.so (0x7f5ab6400000+0x1953ba) [0x7f5ab65953ba]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 5: /usr/lib64/dri/vmwgfx_dri.so (0x7f5ab6400000+0x198903) [0x7f5ab6598903]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 6: /usr/lib64/dri/vmwgfx_dri.so (0x7f5ab6400000+0x19f1b9) [0x7f5ab659f1b9]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 7: /usr/bin/Xwayland (0x55d5958db000+0x729f7) [0x55d59594d9f7]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 8: /usr/bin/Xwayland (0x55d5958db000+0x6117a) [0x55d59593c17a]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 9: /usr/bin/Xwayland (0x55d5958db000+0x61911) [0x55d59593c911]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 10: /usr/bin/Xwayland (0x55d5958db000+0x1b9ff5) [0x55d595a94ff5]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 11: /usr/bin/Xwayland (0x55d5958db000+0x1ba748) [0x55d595a95748]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 12: /usr/bin/Xwayland (0x55d5958db000+0x5cb37) [0x55d595937b37]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 13: /usr/bin/Xwayland (0x55d5958db000+0xff76b) [0x55d5959da76b]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 14: /usr/bin/Xwayland (0x55d5958db000+0x11b17a) [0x55d5959f617a]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 15: /usr/bin/Xwayland (0x55d5958db000+0xb5887) [0x55d595990887]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 16: /usr/bin/Xwayland (0x55d5958db000+0x3b840) [0x55d595916840]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 17: /lib64/libc.so.6 (0x7f5ac341d000+0x2814a) [0x7f5ac344514a]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 18: /lib64/libc.so.6 (__libc_start_main+0x8b) [0x7f5ac344520b]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE) 19: /usr/bin/Xwayland (0x55d5958db000+0x3d255) [0x55d595918255]
Dec 13 08:38:30 fedora kwin_wayland_wrapper[6521]: (EE)
```

Note that in atomic mode-setting mode, the VMware graphics kernel driver seems to crash on a NULL pointer access, also correlated with the above.
Comment 2 Stefan Hoffmeister 2023-12-27 10:42:20 UTC
The root cause of this is a combination of factors that hit with kwin running in "legacy mode" (this is the default right now due to driver detection and workarounds applied), on the DRM backend:

Upon starting the Wayland compositor, output management adds outputs (WaylandCompositor::addOutput). In there, events are connected to handle workspace geometry changes and changes to the cursor (updateCursorLayer, moveCursorLayer).

Lambda updateCursorLayer is responsible for handling cursor "content" change. It does that by trying to render a hardware cursor first, and, if that fails, then rendering a fallback.

On vmwgfx as of kernel 6.7.0-rc5, trying to render a hardware cursor will *always* fail with "drmPrimeHandleToFD() failed" (and more log messages), and updating the cursor will always enter the fallback path. This causes the log spam.

There is a way to disable the attempt to perform hardware cursor rendering: configure environment variable "KWIN_FORCE_SW_CURSOR=1" to enter the (software-based cursor rendering) fallback path immediately. This stops the logspam.
Comment 3 Vlad Zahorodnii 2024-02-07 14:45:18 UTC
*** Bug 473887 has been marked as a duplicate of this bug. ***
Comment 4 Zamundaaa 2025-10-17 10:43:42 UTC
We require drmPrimeHandleToFD to work correctly; please report this to the broken kernel driver.