https://bugs.kde.org/show_bug.cgi?id=527309
Bug ID: 527309
Summary: Black screen after resume when KWIN_DRM_DEVICES points
at a symlink: GPU re-add fails with "Device already
taken"
Classification: Plasma
Product: kwin
Version First 6.8.0
Reported In:
Platform: CachyOS
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: platform-drm
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: ---
After updating from Plasma 6.7.5 to 6.8.0, the internal panel stays black after
every resume from suspend. The system itself is alive (network and Magic SysRq
work), but KWin has no outputs and no longer handles input, so Ctrl+Alt+F3 does
nothing and the only way out is a reboot.
This only happens when KWIN_DRM_DEVICES names the GPU through a symlink. I use
a udev rule that creates /dev/dri/intel-igpu -> cardN, because cardN numbering
changes between boots on this hybrid laptop (the iGPU was card1 on one boot and
card2 on the next), and KWin is pinned to the iGPU so the NVIDIA dGPU can
runtime-suspend.
Workaround: resolve the symlink before KWin starts, e.g. in
plasma-workspace/env:
export KWIN_DRM_DEVICES="$(readlink -f /dev/dri/intel-igpu)"
STEPS TO REPRODUCE
1. On a hybrid Intel + NVIDIA laptop, create a symlink to the Intel primary
node (e.g. a udev rule creating /dev/dri/intel-igpu).
2. Set KWIN_DRM_DEVICES=/dev/dri/intel-igpu in ~/.config/plasma-workspace/env/
and log in to a Wayland session.
3. Suspend (deep / S3) and wake the system.
OBSERVED RESULT
As suspend starts, every Wayland client logs "There are no outputs - creating
placeholder screen". On wake, the screen stays black and KWin logs:
kwin_wayland: Failed to open /dev/dri/card1 device (Device already taken)
kwin_wayland: Failed to open drm device /dev/dri/card1: Invalid argument
Reproduced on 3 of 3 suspends with the symlink path. With the workaround,
resume works on every try.
EXPECTED RESULT
The internal panel comes back after resume, as it did in 6.7.5.
SOFTWARE/OS VERSIONS
Operating System: CachyOS Linux
KDE Plasma Version: 6.8.0
KDE Frameworks Version: 6.31.0
Qt Version: 6.12.0
Kernel Version: 7.2.9-2-cachyos (64-bit)
Graphics Platform: Wayland
ADDITIONAL INFORMATION
Hardware: Razer Blade 15 (2022). Intel Iris Xe (i915) drives the internal
panel; NVIDIA RTX 3070 Ti Laptop GPU (open kernel modules 615.78.08) is used
for offload only. systemd 262.
I think this comes from MR !9549 (commits 41097b10 "backends/drm: remove DrmGpu
when it becomes inactive" and 5a4663bc "backends/drm: Cache authentication
handles for the lifespan of the device"):
- At startup, addGpu() gets the KWIN_DRM_DEVICES path, so the DrmAuthHandle is
cached in m_gpuAuthHandles under "/dev/dri/intel-igpu".
- On Session::devicePaused, the GPU is now removed, but its auth handle stays
cached, so the session keeps the device taken.
- On Session::deviceResumed, the GPU is re-added through
drmGetDeviceFromDevId(), which returns the kernel node path "/dev/dri/card1".
That lookup misses the handle cached under the symlink path, so a new
DrmAuthHandle calls openRestricted() (logind TakeDevice) a second time for a
device the session already holds. logind refuses, addGpu() returns nullptr and
no GPU is left.
The udev "remove" branch has the same mismatch
(m_gpuAuthHandles.remove(device->devNode()) uses the kernel path). Keying
m_gpuAuthHandles by dev_t instead of by path would fix both. A smaller fix
would be for deviceResumed to reuse the matching KWIN_DRM_DEVICES entry,
compared by canonicalFilePath() as handleUdevEvent() already does.
With KWIN_DRM_DEVICES set to the resolved path and
QT_LOGGING_RULES="kwin_wayland_drm.debug=true", a working cycle logs:
kernel: PM: suspend entry (deep)
kwin_wayland: Removing output KWin::DrmOutput(...)
kwin_wayland: Removing GPU "/dev/dri/card2"
kernel: PM: suspend exit
kwin_wayland: adding GPU /dev/dri/card2
kwin_wayland: New output on GPU /dev/dri/card2: eDP-1-TL156VDXP02-0
--
You are receiving this mail because:
You are watching all bug changes.