Skip to content

fix: run Hyprland and COSMIC on hybrid NVIDIA hosts and stop leaking Weston - #155

Merged
avifenesh merged 2 commits into
mainfrom
fix/hybrid-gpu-backends
Oct 25, 2026
Merged

avifenesh merged 2 commits into
mainfrom
fix/hybrid-gpu-backends

Conversation

@avifenesh

@avifenesh avifenesh commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Hyprland and COSMIC failed to start on a laptop with Intel and NVIDIA GPUs. COSMIC also left its Weston parent running after a failed start or a killed daemon.

  • Hyprland: KWin's virtual renderer opens the first DRM device that works, and Hyprland allocates its buffers there. NVIDIA's GBM cannot allocate them, so the output never got a mode ("timed out waiting for Hyprland requested output geometry"). On hosts with an NVIDIA GPU and another GPU, the renderer now runs in bubblewrap with only the other GPU's render node in /dev/dri. Single-vendor hosts are unchanged.
  • COSMIC: glvnd loaded NVIDIA's EGL first and XWayland crashed in libnvidia-egl-gbm. The Weston parent, cosmic-comp and XWayland now load only Mesa's EGL vendor when its file exists.
  • Leak: bwrap's --die-with-parent does not stop the sandboxed process without a PID namespace (checked on kernel 7.0: SIGTERM and SIGKILL of bwrap both leave it running). The Weston parent now gets --unshare-pid, and shutdown signals its process group. The leaked Weston also kept the host GPU lock descriptor.

Validation on the hybrid host (Intel + RTX 5090):

  • Each backend started, opened weston-terminal or xterm and captured a screenshot: x11, i3, kwin, gnome, hyprland, cosmic all pass (hyprland and cosmic failed before).
  • Daemon SIGKILL leak check: no workspace process survives for cosmic or hyprland.
  • fmt, clippy -D warnings, 256 tests in both TMPDIR modes, runtime isolation smoke on all six backends, terminal lifecycle, integration smoke: pass.
  • COSMIC and Hyprland container acceptance probes: pass.

Note

Medium Risk
Touches compositor spawn/teardown, bubblewrap sandboxes, and DRM/EGL vendor selection on session start and shutdown; wrong GPU or signal handling could break workspaces or leave orphan processes.

Overview
Fixes Hyprland and COSMIC on hybrid Intel/NVIDIA laptops and stops COSMIC’s Weston parent from surviving daemon crashes.

Hyprland: When both NVIDIA and another GPU are present, the private KWin virtual renderer now runs under bubblewrap with /dev/dri limited to the non-NVIDIA render node, so buffer allocation does not land on NVIDIA GBM (which cannot satisfy Hyprland). Single-GPU-vendor hosts are unchanged; bwrap becomes required on hybrid NVIDIA setups.

COSMIC: Shared use_mesa_egl sets __EGL_VENDOR_LIBRARY_FILENAMES to Mesa’s vendor file (when installed) for the Weston parent, cosmic-comp, and authenticated XWayland, avoiding glvnd picking NVIDIA EGL. The Weston bwrap sandbox adds --unshare-pid so --die-with-parent actually tears down Weston; startup/shutdown use unreaped_exit and process-group SIGTERM/SIGKILL so leaked Weston and GPU locks do not persist after a killed daemon.

Reviewed by Cursor Bugbot for commit fe7ca98. Configure here.

…Weston

On a host with Intel and NVIDIA GPUs, Hyprland's private KWin renderer opened
the NVIDIA render node, whose GBM cannot allocate Hyprland's buffers, so the
output never got a mode. That renderer now runs in a bubblewrap namespace that
exposes only the other GPU's render node. Single-vendor hosts are unchanged.

COSMIC's software-rendered Weston parent, compositor and XWayland now load only
Mesa's EGL vendor; NVIDIA's EGL made XWayland crash at startup.

COSMIC's Weston parent outlived a failed start or a killed daemon: bwrap's
--die-with-parent does not stop the sandboxed process without a PID namespace.
The parent now gets one, and shutdown signals its whole process group.
Copilot AI balanced review requested due to automatic review settings October 25, 2026 20:59
@cursor

cursor Bot commented Oct 25, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 987192c1-3183-41f1-aea1-91101945d88e)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@avifenesh

Copy link
Copy Markdown
Collaborator Author

Self-review at 57f2111. Scope is limited to the Hyprland parent renderer and the COSMIC parent/compositor/XWayland. The node filter only applies when an accessible NVIDIA render node and another accessible render node both exist; otherwise the command is unchanged. The Mesa vendor pin is skipped when Mesa's vendor file is missing. --unshare-pid is added only to the Weston parent; cosmic-comp keeps the host PID view it needs for client credentials and exits with its guard socket. Shutdown now matches the group-signal pattern used by Hyprland and the private session. Validation is listed in the PR body.

@revuto-review revuto-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an auto review done by revuto.


COSMIC startup failure can leave shutdown signalling an unreserved process-group ID, risking termination of unrelated host processes.

Comment thread src/session/cosmic.rs
Copilot AI balanced review requested due to automatic review settings October 25, 2026 21:41
@cursor

cursor Bot commented Oct 25, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: fb2f4983-cb3c-4a55-8943-f823e723aeb8)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@revuto-review revuto-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an auto review done by revuto.


Revuto completed the review and found no evidence-backed concerns.

@avifenesh
avifenesh merged commit dfc0f65 into main Oct 25, 2026
10 checks passed
@avifenesh avifenesh mentioned this pull request Oct 25, 2026
@avifenesh
avifenesh deleted the fix/hybrid-gpu-backends branch October 25, 2026 23:08
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.

2 participants