Skip to content

Overlays stay on the compositor's GPU, fail alone, and rebuild their renderer on a new device - #73

Closed
ship-it-mind wants to merge 1 commit into
anomalyco:devfrom
ship-it-mind:fix/xwayland-overlay-compositor-gpu
Closed

ship-it-mind wants to merge 1 commit into
anomalyco:devfrom
ship-it-mind:fix/xwayland-overlay-compositor-gpu

Conversation

@ship-it-mind

Copy link
Copy Markdown

Fixes #72 (reported from anomalyco/hex#982).

On GNOME (no layer-shell) with an NVIDIA GPU driving the displays and an AMD iGPU present, every Rune app with an input-free overlay panics. Hex's window dies at launch or at the first dictation.

Changes

  • translucency::prefer: when the compositor named its GPU (Pick::knows_compositor), only adapters on that GPU are candidates. NVIDIA's X11 driver reports only OPAQUE alpha for the XWayland overlay. RADV claims PRE_MULTIPLIED | INHERIT and is_surface_supported, but its vkCreateSwapchainKHR on an NVIDIA-driven XWayland returns VK_ERROR_INITIALIZATION_FAILED. wgpu reports that as Surface::configure: Invalid surface, and the default handler panics. The overlay now draws opaque on the compositor's GPU instead. This follows the rule gpu/pick.rs already states.
  • Overlay::attach: configures the surface inside a validation error scope (native targets), so a surface that can't be configured fail()s that overlay instead of panicking the app.
  • Overlay::attach: when it makes a new Gpu (which happens on every show once the pooled device doesn't serve a translucent surface), it drops the previous renderer, which is then rebuilt on the new device along with the atlases. Before, it kept the old renderer and only called rebuild_renderer, which panics with Cannot get non-existent resource BufferId(3,1) the second time the overlay shows. Compositor::render now documents that f.device can change between frames. Hex's HUD compositor needs the matching change (hex#982).

Verification

  • cargo clippy -p rune --lib on Linux: builds, with the same warning count before and after the change (632).
  • The root cause was reproduced outside Rune with a C program that builds the same depth-32 override-redirect XWayland window. NVIDIA reports caps alpha 0x1 and the swapchain succeeds; RADV reports alpha 0xa and the swapchain returns -3.
  • In the shipped Hex 3.2.0, pinning WGPU_ADAPTER_NAME=nvidia (which skips prefer) removes the launch panic, and the BufferId panic then appears on the HUD's next show.
  • Not yet verified end to end: I haven't built Hex against this branch on the affected machine.
  • Unrelated: cargo test -p rune --lib doesn't compile on Linux at dev head with or without this change (cannot find `metal` in `gpu` , four errors).

Trade-off

On a laptop whose compositor runs on an opaque-only iGPU, an overlay used to move to a discrete GPU that claims translucency; it now draws opaque on the iGPU. That is the same rule the window already follows (a non-compositor GPU's buffers may not be shown).

…renderer on a new device (anomalyco#72, hex#982)

- translucency::prefer: when the compositor named its GPU, only adapters on it are
  candidates. On GNOME + NVIDIA with an AMD iGPU, NVIDIA's X11 driver reports only
  opaque alpha for an XWayland overlay, RADV claims premultiplied, and RADV can't
  make a swapchain on an NVIDIA-driven XWayland (VK_ERROR_INITIALIZATION_FAILED).
- Overlay::attach: configure the surface in a validation error scope and fail the
  overlay, instead of wgpu's default handler panicking the whole app.
- Overlay::attach: a new Gpu drops the previous show's renderer, whose buffers live
  on the old device (Cannot get non-existent resource BufferId). Compositor::render
  documents that f.device can change between frames.
@thdxr

thdxr commented Nov 2, 2026

Copy link
Copy Markdown
Member

thanks, this analysis was spot on. we don't merge outside prs, so it's rewritten in 53c0c9a on dev along the same lines: prefer stays on the compositor's gpu, overlay configure goes through an error scope and fails just that overlay, an overlay keeps its own device across shows and drops its renderer on a new one. hex picked it up in anomalyco/hex#986.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

@thdxr thdxr closed this Nov 2, 2026
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.

XWayland overlay on an NVIDIA-driven GNOME moves to the iGPU and panics the app; a re-shown overlay reuses the old device's renderer

2 participants