Skip to content

fix(overlay): a hidden Wayland overlay drops its images, and release_gpu_when_hidden parks its renderer there - #1465

Merged
Hona merged 1 commit into
devfrom
fix/142-wayland-overlay-park
Nov 23, 2026
Merged

Hona merged 1 commit into
devfrom
fix/142-wayland-overlay-park

Conversation

@Hona

@Hona Hona commented Nov 23, 2026

Copy link
Copy Markdown
Member

Fixes #142

Root cause

  • OverlayCore::hide_window (crates/rune/src/overlay/lifetime.rs) destroys a Wayland layer or XWayland surface on hide (surface.take_live()). The renderer, the GPU device hold, the runtime's image atlas and the last committed tree stayed.
  • OverlayCore::park (the release_gpu_when_hidden / release_gpu_after effect) returned at once unless the live backing was Backing::Window. On Wayland nothing was live by then, so it parked nothing.
  • ImageAtlas::end_frame frees unused pages only at the end of a drawn frame. A hidden overlay draws none, so its last image pages, their GPU textures and the Pixels in its committed nodes and memo cache stayed alive.

Changes

  • park releases the renderer, the device hold and the surface description whether or not a surface is still live. A device another surface shares is polled so its finished work retires now.
  • A Wayland hide calls drop_hidden_images: RuntimeCore::drop_images clears the CPU atlas (ImageAtlas::clear), the Pixels held by committed nodes (El::pixels and inline images) and the memo cache, and marks the view dirty. Renderer::clear_images drops the image textures and the layer bind groups that name them.
  • warm::park calls Renderer::clear_for_park before it parks a renderer: image textures, layer targets, backdrops and staging chunks go. Pipelines and the glyph atlas stay.
flowchart LR
  H[hide on Wayland] --> T[surface destroyed]
  T --> D[drop_hidden_images: atlas, tree Pixels, memo, GPU textures]
  T --> P{release_gpu_when_hidden}
  P --> K[park: renderer and device released even with no live surface]
  S[next show] --> R[view rebuilt, images uploaded again]
Loading

Tests

  • overlay::state_walk_tests::park_after_wayland_hide_releases_gpu_renderer_and_surface_description (fails on dev).
  • overlay::state_walk_tests::wayland_hide_drops_pixels_references_atlas_pages_and_gpu_textures_and_reuploads_on_next_frame.
  • render::image_tests::clear_for_park_drops_image_textures_and_reuploads_cleanly and rune-image clear_drops_pages_slots_and_replaces_cleanly.
  • Compiled for Linux (aarch64) and macOS. Not run on a real Wayland session: the tests drive the same functions with a headless GPU.

@Hona
Hona merged commit 50c194f into dev Nov 23, 2026
1 check passed
@Hona
Hona deleted the fix/142-wayland-overlay-park branch November 23, 2026 05:11
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: a hidden overlay keeps its last images in memory, and release_gpu_when_hidden does nothing there

1 participant