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

--- Comment #1 from rebelCoder <[email protected]> ---
Cleaned-up Report (Formatted for Bugzilla Plain Text):

SUMMARY:
kwin_wayland EGL context corruption (GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT) when
S4 hibernation is aborted by a pre-sleep script (PrepareForSleep(false)),
causing a black screen freeze on subsequent S4 resume.

ENVIRONMENT & HARDWARE:
- OS: Bazzite (Fedora Linux 44 ostree)
- KDE Plasma Version: 6.1.0 (Wayland)
- Kernel: 7.1.3-ogc3.4.fc44.x86_64
- Hardware Setup: Dual-AMD Laptop (ASUS ROG Zephyrus G14 GA402RK) - Radeon 680M
iGPU + Radeon RX 6700S dGPU (SmartShift)
- Relevant Power Kernel Flags: resume=UUID=..., amdgpu.sg_display=0,
amd_pstate=guided, hibernate.compressor=lzo

REAL-WORLD EDGE CASE CONTEXT:
On Dual-GPU laptops (e.g. AMD SmartShift iGPU + dGPU), attempting S4
hibernation while the secondary dGPU is still powered on (active / D0) causes
PCIe reset timeouts and memory snapshot corruption on wake. To prevent hardware
corruption, system pre-sleep scripts inspect runtime_status and return exit 1
to abort systemd-hibernate.service if the dGPU fails to autosuspend.

When this pre-sleep abort fires, systemd broadcasts D-Bus
PrepareForSleep(false). However, kwin_wayland does not cleanly recover its EGL
surface bindings if sleep is canceled after framebuffer teardown has already
started.

STEPS TO REPRODUCE:
1. Initiate S4 Hibernation (systemctl hibernate). D-Bus broadcasts
PrepareForSleep(true). kwin_wayland and kscreenlocker_greet lock the screen and
tear down offscreen render targets.
2. A system pre-sleep script returns exit 1 because the dGPU is still active.
systemd broadcasts PrepareForSleep(false).
3. kwin_wayland attempts to resume rendering, but fails EGL framebuffer
attachments, logging multiple OpenGL context errors into journalctl.
4. Initiate S4 Hibernation a second time (systemctl hibernate). This time the
dGPU is suspended and the pre-sleep script passes. The kernel writes the RAM
snapshot (containing KWin's corrupted EGL state) to swap and powers off.
5. Power on system to resume from S4 hibernation.

OBSERVED RESULT:
Upon waking from swap, dracut unpacks the memory image into RAM cleanly, but
kwin_wayland fails framebuffer swapchain initialization — resulting in a frozen
black screen with no desktop output. Hard power cycle required.

EXPECTED RESULT:
When PrepareForSleep(false) is broadcast following a canceled hibernation
attempt, kwin_wayland should cleanly re-bind its EGL surfaces without leaving
invalid framebuffer attachments in memory.

LOG EVIDENCE (journalctl):
  Jul 22 00:15:51 localhost systemd[1]: Starting systemd-hibernate.service -
System Hibernate...
  Jul 22 00:16:03 localhost kwin_wayland[2985]: 0x3: GL_INVALID_VALUE in
glTexStorage2D(width, height or depth < 1)
  Jul 22 00:16:03 localhost kwin_wayland[2985]: Invalid framebuffer status:
"GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"
  Jul 22 00:16:03 localhost kwin_wayland[2985]: 0x3: GL_INVALID_OPERATION in
glBindFramebuffer(non-gen name)
  Jul 22 00:16:03 localhost kwin_wayland[2985]: 0x3:
GL_INVALID_FRAMEBUFFER_OPERATION in glClear(incomplete framebuffer)
  Jul 22 00:16:04 localhost kwin_wayland[2985]: Could not delete texture
because no context is current
  Jul 22 00:16:07 localhost systemd[1]: systemd-hibernate.service: Control
process exited, code=exited, status=1/FAILURE
  Jul 22 00:16:07 localhost systemd[1]: Stopped target sleep.target - Sleep.

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

Reply via email to