Repository navigation
fix(overlay): a hidden Wayland overlay drops its images, and release_gpu_when_hidden parks its renderer there - #1465
Merged
Merged
Conversation
…gpu_when_hidden parks its renderer there
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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(therelease_gpu_when_hidden/release_gpu_aftereffect) returned at once unless the live backing wasBacking::Window. On Wayland nothing was live by then, so it parked nothing.ImageAtlas::end_framefrees unused pages only at the end of a drawn frame. A hidden overlay draws none, so its last image pages, their GPU textures and thePixelsin its committed nodes and memo cache stayed alive.Changes
parkreleases 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.drop_hidden_images:RuntimeCore::drop_imagesclears the CPU atlas (ImageAtlas::clear), thePixelsheld by committed nodes (El::pixelsand inline images) and the memo cache, and marks the view dirty.Renderer::clear_imagesdrops the image textures and the layer bind groups that name them.warm::parkcallsRenderer::clear_for_parkbefore 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]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_cleanlyandrune-imageclear_drops_pages_slots_and_replaces_cleanly.