You are not logged in.

#1 2026-11-28 05:33:26

BananaMan11
Member
Registered: 2026-11-27
Posts: 2

Kwin crashes on Nvidia 5070ti GPU (With possible workaround)

Hello everyone!

Recently I updated from a CPU from Ryzen 5700G to 5800x3D, so I moved my screens connected from the motherboard to my Nvidia 5070ti card, with the AMD iGPU I had desktop effects and a video screensaver with a desktop video wallpaer while using the Nvidia only for games and CUDA workloads. Everything worked well, but when I moved to the Nvidia GPU, most of the effects crashed the entire desktop, when disabling most of the effects, Kwin started to hang at 100% of CPU usage when using alt+tab, I disabled every effect and the desktop became somewhat stable but it was randomly freezing making annoying to work with the computer. So I decided to use Claude Code to fix the issue and it actually gave me a workaround, fixing the Kwin hang and making the entire desktop usable again. I have tested the fix and is working pretty well for me so far. I left the report Claude with the detailed issue, the workaround and the patch.
As a note, while the fix point toward the alt+tab behavior, it actually solved all the desktop effects I use on KDE.

Claude report:
On KDE Plasma 6.8 Wayland with an RTX 5070 Ti, opening the Alt+Tab window switcher freezes the compositor within seconds to a minute. The screen stops updating and the mouse doesn't move. SSH still works, and the kernel logs nothing (no Xid, NVRM or AER messages).

I narrowed it down with instrumented KWin builds. The trigger is a GPU-side `eglWaitSync()` on an `EGL_ANDROID_native_fence_sync` fence that a different EGL context in the same process created:

1. KWin renders its own pop-up windows (the Alt+Tab switcher, OSDs) with Qt Quick in **context A**. The render target is a GBM dmabuf (`DRM_FORMAT_ABGR8888`, modifier `0x300000000e08014`) imported as an EGLImage/FBO.
2. After rendering, context A creates an `EGL_SYNC_NATIVE_FENCE_ANDROID` sync, calls `glFlush()`, and exports the fd with `eglDupNativeFenceFDANDROID()`.
3. KWin's compositing **context B** shares the same `EGLDisplay`. It imports that fd with `eglCreateSyncKHR(EGL_SYNC_NATIVE_FENCE_ANDROID, EGL_SYNC_NATIVE_FENCE_FD_ANDROID=fd)`, calls `eglWaitSync()`, and re-binds the same dmabuf as an EGLImage texture (`glEGLImageTargetTexture2DOES`).
4. From then on, no GPU work submitted on context B ever completes. GPU utilization stays at 0%. The next CPU-synchronous GL call on context B spins forever in userspace inside `libnvidia-eglcore` (polling `clock_gettime`). Depending on timing that call is `glFinish`, `glClientWaitSync`, `glReadnPixels` or `glDeleteTextures`.

The fence is already signaled when context B waits on it: `poll()` on the fd returns readable before the `eglWaitSync()` call. Even when context A has run `glFinish()` before creating the fence, the hang still happens.

The bug is a race and depends on how busy the GPU queue is. More compositor load, such as many busy browser windows, makes it happen sooner. Forcing a CPU wait after every draw on context B hides it completely.

Workaround (confirmed)

In KWin's QPA plugin (`src/plugins/qpa/eglplatformcontext.cpp`, `EGLPlatformContext::swapBuffers`), call `glFinish()` on context A. Then hand the buffer to the compositor without an acquire fence, so context B never calls `eglWaitSync()`. With this change the freeze is gone: a long Alt+Tab session (over 1,600 switcher thumbnail redraws, heavy browser load) ran with no stall. Without it, the freeze reproduces every time.

+        glFinish();
         EGLNativeFence fence(EglContext::currentContext()->displayObject());
         currentSlot->releasePoint()->addReleaseFence(fence.fileDescriptor());
         internalWindow->present(InternalWindowFrame{
             .buffer = current->buffer,
-            .syncFd = fence.takeFileDescriptor(),
+            .syncFd = FileDescriptor{},

User-level workaround without patching:

kwriteconfig6 --file kwinrc --group TabBox --key ShowTabBox false

System

- GPU: RTX 5070 Ti (2B:00.0, VBIOS 98.03.58.00.94). Both monitors are connected to it: DP 1920x1080 @144 Hz and HDMI 2560x1440 @75 Hz.
- A GTX 1660 (04:00.0) is also installed, with no monitor attached. KWin is restricted to the 5070 Ti with `KWIN_DRM_DEVICES`. All buffers involved come from the 5070 Ti (dev 226:129), so no multi-GPU path is used.
- Driver: nvidia-open **620.73.04**; the same freeze happens on **595.71.05** and **615.78.08**. egl-wayland 1.1.24, egl-wayland2 1.0.2, egl-gbm 1.1.4.
- Arch Linux, kernel 6.18.65 (xanmod LTS), `nvidia_drm.modeset=1`, `NVreg_UseKernelSuspendNotifiers=1`
- KWin 6.8.3, Qt 6.12.1, libplasma 6.8.3, Mesa 26.3.1

Steps to reproduce

1. Log into a Plasma 6.8 Wayland session on the RTX 5070 Ti, with stock KWin and the default window switcher.
2. Open a browser with several busy windows (here: Waterfox, about 12 windows). This only raises the chance of hitting it.
3. Press Alt+Tab repeatedly. The compositor freezes within seconds to a minute.

Other things that did not help: kernel switch(Stock kernel/CachyOS), KWin 6.8.1 / Qt 6.12.0, Mesa 26.2.5, disabling animations, `KWIN_DRM_DISABLE_TRIPLE_BUFFERING=1`, locking GPU clocks. PCIe is Gen4 x16 with ReBAR on, and there are no AER errors.

Hung main thread (typical)

#4  __vdso_clock_gettime
#5  clock_gettime (libc)
#6  libnvidia-eglcore.so.620.73.04 +0x97ba21   <- spin
#7  libnvidia-eglcore.so.620.73.04 +0x97f659
#8  libnvidia-eglcore.so.620.73.04 +0xa4b36d
#9  libnvidia-eglcore.so.620.73.04 +0x78428f
#10 libkwin.so.6  (glClientWaitSync / glFinish caller)
#12 KWin::WorkspaceScene::prePaint(...)
    KWin::Compositor::composite(...)

Patch: https://pastebin.com/Mwu0kBEZ
Logs: https://pastebin.com/HkK0S03s

I left this for anyone who stumble on the same issue as me.

Offline

#2 2026-12-02 13:48:59

milescowan
Member
Registered: 2015-03-07
Posts: 2

Re: Kwin crashes on Nvidia 5070ti GPU (With possible workaround)

Did you report this to KDE?

Offline

#3 Today 02:40:54

BananaMan11
Member
Registered: 2026-11-27
Posts: 2

Re: Kwin crashes on Nvidia 5070ti GPU (With possible workaround)

milescowan wrote:

Did you report this to KDE?

I'm still testing whatever my fix is good or not. So far I have tested games and video wallpapers without issues. It seems that video wallpapers for the screen locker crash KDE in the same way and heavy effects makes KDE unresponsive for some seconds (worst case was 1 minute). But I will keep testing for some days and if everything is good, report it to KDE.

Offline

Board footer

Powered by FluxBB