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

            Bug ID: 519935
           Summary: KWin Wayland main thread hangs ~12s on AMD hybrid GPU
                    (ROG G14) — KWin trying to open D3cold dGPU
    Classification: Plasma
           Product: kwin
      Version First 6.6.4
       Reported In:
          Platform: Manjaro
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: wayland-generic
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

DESCRIPTION

On AMD hybrid-GPU laptops running in Hybrid mode (supergfxd), the dGPU suspends
to D3cold (fully powered off at the PCIe level) when idle. KWin periodically
tries to open /dev/dri/card1 (the dGPU). Opening a D3cold device triggers a
synchronous PCIe power-on sequence inside the kernel driver, which blocks the
calling thread for ~12 seconds. Since this call is made on KWin's main thread,
the entire compositor freezes. Any Wayland client waiting for a compositor
response during this time also hangs.

This produces a burst of ~300 repeated open failures followed by the hang
message in KWin's log:

    kwin_wayland[2018]: Failed to open /dev/dri/card1 device (Device or
resource busy)
    [... repeated ~300 times over ~7 seconds ...]
    kwin_wayland[2018]: Failed to open drm device /dev/dri/card1
    kwin_wayland[2018]: The main thread was hanging temporarily!

In a single ~10-minute session I observed 5 separate hang events and 306 total
failed open attempts. The hang recurs whenever the dGPU transitions into D3cold
— including when the wake is triggered by another process. For example, running
vulkaninfo with WAYLAND_DISPLAY= (bypassing the compositor entirely) still
causes a 12-second screen freeze: vulkaninfo opening /dev/dri/card1 directly
wakes the dGPU, which causes KWin to independently probe the device, blocking
its main thread.


STEPS TO REPRODUCE
1. Boot into a KDE Wayland session on a hybrid-GPU AMD laptop with supergfxd in
Hybrid mode.
2. Wait ~1 minute for the dGPU to suspend to D3cold: watch -n2 cat
/sys/bus/pci/devices/0000:03:00.0/power/runtime_status (wait until it shows
"suspended").
3. Launch any app that enumerates GPUs on startup — Electron apps (Slack, VS
Code, Discord) reliably trigger this.
4. Observe the entire desktop freeze for ~12 seconds, then check: journalctl
--user -u plasma-kwin_wayland -b | grep -E "card1|hanging"


OBSERVED RESULT

Desktop freezes for ~12 seconds. KWin log shows hundreds of failed open
attempts on /dev/dri/card1 followed by "The main thread was hanging
temporarily!". This repeats every few minutes for as long as the dGPU cycles in
and out of D3cold.


EXPECTED RESULT

KWin should not block its main thread when opening a DRM device. Device probing
should either be done off the main thread (with a timeout), or KWin should
check power/runtime_status before attempting to open a suspended device and
skip it. In Hybrid mode, KWin should only composite on the iGPU and avoid
probing the dGPU entirely.

Workaround: setting KWIN_DRM_DEVICES=/dev/dri/card2 in
~/.config/environment.d/kwin-gpu.conf prevents KWin from touching the dGPU and
eliminates the hang completely.


SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux
KDE Plasma Version: 6.6.4
KDE Frameworks Version: 6.25.0
Qt Version: 6.11.0
Kernel Version: 7.0.3-1-MANJARO (64-bit)
Graphics Platform: Wayland


ADDITIONAL INFORMATION

Hardware:
- Laptop: ASUS ROG Zephyrus G14 GA402RK
- CPU/iGPU: AMD Ryzen 7 6800HS — Radeon 680M (/dev/dri/card2, PCI ID 1002:1681)
- dGPU: AMD Radeon RX 6800S (/dev/dri/card1, PCI ID 1002:73EF)
- GPU manager: supergfxd in Hybrid mode

The bug was first observed on Plasma 6.5.x and persists unchanged on 6.6.4.

dGPU power state at time of hang:
    $ cat /sys/bus/pci/devices/0000:03:00.0/power/runtime_status
    suspended

The KWIN_DRM_DEVICES workaround eliminates the desktop freezes entirely — even
when other processes wake the dGPU — confirming KWin's main-thread open() is
the sole cause of the compositor freeze.

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

Reply via email to