Skip to content

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 #72

Closed

Description

@ship-it-mind

Hex report with the full repro and logs: anomalyco/hex#982

What happens

On Ubuntu 26.04 (GNOME, Wayland) with an NVIDIA RTX 5090 driving the displays and an AMD Radeon iGPU (Ryzen 9 9950X) also present, Hex 3.2.0 (.deb) starts, but its Rune app panics as soon as the HUD overlay is created (at launch, or at the first dictation):

ERROR hex::app_paths: panic: panicked at wgpu-30.0.1/src/backend/wgpu_core.rs:3981:18:
wgpu error: Validation Error
  In Surface::configure
    Invalid surface
ERROR hex::linux::app: the Hex window failed; Hex keeps running without it
WARN  hex::linux::rune_hud: HUD unavailable: Rune could not open the overlay (no reason given); dictation still works

Dictation keeps working, but the Settings window dies (or never opens) and there is no HUD. hex status shows Recording HUD unavailable: the overlay could not open (no reason given).

Cause

  1. GNOME has no layer-shell, so the HUD is an override-redirect ARGB X11 window on XWayland (platform/x11/xwayland.rs).
  2. gpu::pick correctly picks the compositor's GPU (NVIDIA, 0000:01:00.0).
  3. NVIDIA's Vulkan driver reports only OPAQUE composite alpha for that X11 surface, so render::translucency::prefer looks for another adapter that claims a translucent mode. RADV (the AMD iGPU) reports PRE_MULTIPLIED | INHERIT and is_surface_supported = true, so the overlay moves to the iGPU, even though the sort prefers the compositor's device.
  4. RADV can't create a swapchain on an XWayland that NVIDIA drives: vkCreateSwapchainKHR returns VK_ERROR_INITIALIZATION_FAILED. wgpu-hal maps that to SurfaceError::Lost, and wgpu-core to ConfigureSurfaceError::InvalidSurface. wgpu's default uncaptured-error handler panics, and the panic takes the whole Rune app down with it.

I reproduced step 4 outside Hex with a small C program. It creates the same depth-32 override-redirect window on XWayland and calls vkCreateSwapchainKHR:

  • NVIDIA: caps alpha=0x1 (opaque only), swapchain VK_SUCCESS
  • RADV: caps alpha=0xa (premultiplied | inherit), swapchain -3 (VK_ERROR_INITIALIZATION_FAILED)

Confirmation in the running app:

  • VK_LOADER_DRIVERS_DISABLE=*radeon* → no panic
  • WGPU_ADAPTER_NAME=nvidia (pins the pick, so prefer is skipped) → no panic at launch; the first HUD show works (but see the second crash below)
  • DISPLAY= (no XWayland) → no panic, no HUD

Second crash once the first is avoided: Cannot get non-existent resource BufferId(3,1)

With the overlay pinned to NVIDIA (WGPU_ADAPTER_NAME=nvidia), the HUD shows once. The next time it shows, the app panics in wgpu-core-30.0.1/src/storage.rs:143 with Cannot get non-existent resource BufferId(3,1).

  • NVIDIA's surface never serves a translucent overlay, so Overlay::attach makes a new Gpu (instance + device) on every show (the None branch).
  • It keeps self.renderer from the previous show and only calls rebuild_renderer (set_format / set_srgb_blend), so the renderer's buffers belong to the old device's hub.
  • Hex's HudCompositor (src/rune_hud.rs) caches its Painter (uniform buffers, bind group, pipeline) keyed only on the target format, so it has the same problem.

So the workaround stops the window from dying at launch, but the HUD still can't be shown twice.

Workaround

# ~/.config/systemd/user/hex.service.d/workaround-hybrid-gpu.conf
[Service]
Environment=WGPU_ADAPTER_NAME=nvidia

then systemctl --user daemon-reload && systemctl --user restart hex.

Proposed fix (Rune)

  • translucency::prefer: when the compositor named its GPU, don't consider adapters on other GPUs (the rule gpu/pick.rs already states: only the compositor's GPU's buffers can be shown). The overlay draws opaque on the compositor's GPU instead of failing.
  • Overlay::attach: configure the surface inside a validation error scope, and fail() the overlay on error instead of letting wgpu's default handler panic the app.
  • Overlay::attach: when it makes a new Gpu, drop the old renderer so it is rebuilt (with the atlases) on the new device. Document on Compositor::render that f.device can change between frames.

Proposed fix (Hex)

  • HudCompositor: rebuild the Painter when f.device changes, not only when the format does.

Environment

  • Hex 3.2.0 (hex_3.2.0-1_amd64.deb), Rune pin f5def6d, wgpu 30.0.1
  • Ubuntu 26.04.1, kernel 7.0.0-42, GNOME (Mutter, experimental scale-monitor-framebuffer, xwayland-native-scaling), Wayland + XWayland
  • NVIDIA GeForce RTX 5090, driver 595.58.03 (displays on this card); AMD Radeon iGPU (RADV, Mesa 26.0.8)

Activity

  1. thdxr commented on Nov 2, 2026

    @thdxr
    Member

    fixed in 53c0c9a on dev (hex picked it up in anomalyco/hex#986). thanks for the write-up.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions