Skip to content

fix(wayland): make layer-shell initial configure non-blocking - #2629

Merged
Hona merged 1 commit into
devfrom
fix/wayland-async-layer-configure
Nov 27, 2026
Merged

Hona merged 1 commit into
devfrom
fix/wayland-async-layer-configure

Conversation

@Hona

@Hona Hona commented Nov 27, 2026

Copy link
Copy Markdown
Member

Fixes #2454

Summary

  • Remove the blocking wait_for_configure poll(2) loop (up to 2 s per overlay) from LayerSurface::new; it now sends the initial bufferless commit, flushes non-blockingly, and returns immediately without stalling the event loop.
  • Handle bound-wl_output removal via wl_registry.global_remove in LayerSurface so a surface targeting an output that disappears before its first configure closes cleanly even without a zwlr_layer_surface_v1.closed event.
  • Add an explicit cross-platform initial-configure state machine (overlay::layer_configure) and PendingLayer subsystem on OverlayCore that holds an unconfigured LayerSurface without a GPU surface until its first configure arrives through normal wake_on_wayland_read turns (wired into has_live_wayland_layer, has_pending_platform_events, awaiting_layer_frame, draw, drain_hidden, hide, release, sync, resized, request_keys/release_keys, activation_token, and terminal GPU loss).
  • Keep no artificial 2 s deadline for initial configure (matching WaylandResize, HideSync, and frame_callback) so compositors that defer configure (such as lock surfaces or DPMS-off outputs) are never killed while every failure end (closed, bound-output removal, fatal display error, hide/display-change/close) ends the wait as an event.
  • Move timeout_ms to its sole remaining caller in platform::wayland::drop::machine::pipe_read and remove dead configure_wait.

Verification

  • Verified locally on Windows:
    • cargo check -p rune --lib
    • cargo check -p rune --lib --target wasm32-unknown-unknown
    • cargo test -p rune --lib -- layer_configure layer_shell_machine pipe_read overlay::keys (52 passed)
    • cargo test -p rune --lib -- layer_configure layer_shell_machine pipe_read overlay:: (233 passed)
  • Added mock-Wayland Unix-socket tests (platform/layer_shell/configure_tests.rs) proving LayerSurface::new returns without waiting for configure, applies pre-configure preferred_buffer_scale + initial configure + ack_configure, and ends cleanly on early closed, bound-wl_output global_remove, and socket hangup (compiled and run by Linux CI).
  • Not verified locally on live Wayland compositor hardware (Hyprland/sway/niri/KWin).

@Hona
Hona force-pushed the fix/wayland-async-layer-configure branch from 6324720 to e9bf0f9 Compare November 27, 2026 14:58
@Hona
Hona merged commit 0c289f7 into dev Nov 27, 2026
@Hona
Hona deleted the fix/wayland-async-layer-configure branch November 27, 2026 14:58
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.

Wayland: every show of a layer overlay blocks the event thread until the compositor configures it, up to 2 s

1 participant