Skip to content

wayland/lock: recover graphics initialization failures - #1106

Open
acrogenesis wants to merge 1 commit into
quickshell-mirror:masterfrom
acrogenesis:fix/session-lock-graphics-recovery
Open

acrogenesis wants to merge 1 commit into
quickshell-mirror:masterfrom
acrogenesis:fix/session-lock-graphics-recovery

Conversation

@acrogenesis

@acrogenesis acrogenesis commented Sep 9, 2026

Copy link
Copy Markdown

Graphics initialization failure on a session-lock surface aborts Quickshell, leaving the session locked without an authentication UI.

Handle sceneGraphError and recreate the failed native window: Qt cannot retry RHI initialization on that window. Preserve the compositor lock, QML input state, geometry, visibility, color and focus. Retries back off from 1 to 30 seconds, reset after a rendered frame, transfer on reload, and stop after unlock or output removal.

Tested with Clang 22 and Qt 6.11.2:

  • All-features Debug build and eight focused Qt tests pass across offscreen and opt-in Wayland runs.
  • Dedicated Hyprland VM lock fixture: EGL_BAD_ALLOC injection, reload during pending retries, recovery, keyboard input and unlock pass with basic and threaded render loops.
  • Full offscreen suite: 9/10 executables pass; existing popupwindow::moveWithParent failure remains.
  • Formatting passes. Local lint reports only existing findings outside changed lines; custom tidyfox is unavailable.

Physical NVIDIA memory exhaustion, older Qt and multiple monitors remain untested. Persistent allocation failure still requires resources to become available.

@acrogenesis
acrogenesis force-pushed the fix/session-lock-graphics-recovery branch from c06b08c to 9c2006e Compare September 17, 2026 19:46
@acrogenesis acrogenesis changed the title wayland: recover session lock graphics initialization failures wayland/lock: recover graphics initialization failures Sep 17, 2026
@acrogenesis
acrogenesis force-pushed the fix/session-lock-graphics-recovery branch from 9c2006e to 76c818b Compare September 17, 2026 19:47
Qt cannot retry RHI initialization on a failed window. Recreate failed
lock windows with backoff instead of letting sceneGraphError abort the
shell, preserving the compositor lock and QML state during recovery.

Transfer pending retries when reloading surfaces.
@acrogenesis
acrogenesis force-pushed the fix/session-lock-graphics-recovery branch from 76c818b to ea6fc70 Compare September 17, 2026 20:16
@acrogenesis
acrogenesis marked this pull request as ready for review September 17, 2026 20:22
@outfoxxed

Copy link
Copy Markdown
Member

Have you observed failure paths besides OOM on launch? I'd rather just trigger a wayland unlock if we fail to allocate all lock surfaces initially instead of doing an exponential backoff on vram.

If you're specifically observing a case where a scene graph error happens on unsuspend or something then that requires more consideration.

@acrogenesis

Copy link
Copy Markdown
Author

This happened when idle locking an already running desktop, rather than on resume:

The sequence of events was:

  1. vLLM occupied ~30 GB of VRAM, leaving roughly 388 MB free.
  2. The desktop reached its idle timeout and requested a lock.
  3. Qt hit EGL_BAD_ALLOC during graphics initialization and aborted Quickshell.
  4. Quickshell crashed seven times, exhausting the launcher's restart attempts. Hyprland remained alive.
  5. I recovered the shell using software OpenGL.

The backoff was my proposed recovery approach, rather than something required by an observed resume failure. Your suggestion to unlock if initial lock-surface allocation fails fits the confirmed case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants