https://bugs.kde.org/show_bug.cgi?id=521864

Evert Vorster <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDSINFO                   |REPORTED
         Resolution|WAITINGFORINFO              |---

--- Comment #16 from Evert Vorster <[email protected]> ---
OK. I did a deep dive here. 
What is happening is that nvidia does not suspend properly with asked to
preserve its GPU memory. 
https://forums.developer.nvidia.com/t/rtx-5080-laptop-drm-device-removal-during-nvidia-suspend-service-causes-kwin-wayland-to-fail-blocking-resume-from-s2idle/369719

https://forums.developer.nvidia.com/t/rtx-3080-laptop-gpu-enters-nv-err-reset-required-after-first-suspend-resume-on-wayland-tuxedo-gemini-gen1-driver-610-43-02/371938

Nvidia is working on it:
https://forums.developer.nvidia.com/t/nvidia-sleep-sh-changes-vt-causes-re-suspend-after-resume-now-is-it-still-needed-under-wayland/353332

tl;dr:
In order for suspend to work at all, we have to disable
nvidia.NVreg_PreserveVideoMemoryAllocations=1 (Or just remove it)

When the system resumes from s2idle, KWin's DRM backend receives udev change
events for both GPUs (card1 = displayless amdgpu, card2 = working nvidia). 

Because the NVIDIA driver performed a full GPU reset during resume, all GPU
memory is wiped — framebuffers, buffer objects, and EGL contexts that KWin held
before suspend are now pointing to invalidated memory. The render node file
descriptors survive (the /dev/dri/ inodes persist across s2idle), but the
underlying GPU allocations are gone.

When KWin tries to apply the output configuration, it calls
testPendingConfiguration() on each GPU via DrmBackend::applyOutputChanges(). 
The nvidia GPU's pipeline test attempts to allocate a GBM buffer for the
primary plane's preparePresentationTest(). This fails because the EGL context
references stale GPU memory, producing GL_INVALID_OPERATION (error 0x502:
"image and target are incompatible") followed by
GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT. 

KWin has no recovery path for this — it returns
OutputConfigurationError::Unknown, prints "Applying output configuration
failed!" and never retries.

The same cascade repeats on each subsequent udev event until eventually the
logind session goes stale and KWin terminates. The system remains responsive
(SSH, TTY work) but the compositor cannot recover its display state on its own.

In workspace.cpp: 
```
case OutputConfigurationError::Unknown:
    if (alreadyHaveEnabledOutputs) {
        break;   // ← gives up immediately
    }
    toEnable.removeLast();
    break;
```
When alreadyHaveEnabledOutputs is true (which it is after a resume — the
outputs were enabled before suspend), Unknown just breaks out and hits the
fatal message. No recovery attempted.

The simplest minimal fix would be: on OutputConfigurationError::Unknown, force
the render backend to reinitialize its EGL/GBM context — close the stale render
node FD, re-open it from /dev/dri/, recreate surfaces — then retry
applyOutputConfiguration() once. If that succeeds, the session recovers
transparently. If it fails again, then give up.

This wouldn't require changing KWin's architecture or adding new abstractions.
It's a retry-with-reinit in the one place where the current code gives up
permanently.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to