Skip to content

Fix Chromium EGL errors on hybrid NVIDIA + iGPU laptops - #5312

Open
josefdc wants to merge 8 commits into
omacom:quattrofrom
josefdc:fix/hybrid-chromium-egl
Open

josefdc wants to merge 8 commits into
omacom:quattrofrom
josefdc:fix/hybrid-chromium-egl

Conversation

@josefdc

@josefdc josefdc commented Apr 15, 2026

Copy link
Copy Markdown

Summary

Fixes #4901 — Chromium black screens, flicker, and GPU process crashes on hybrid NVIDIA + Intel/AMD iGPU laptops.

On these machines Hyprland composites on the integrated GPU, but GLVND's default priority order loads NVIDIA EGL first (10_nvidia.json priority 10 vs Mesa's 50_mesa.json priority 50). Chromium therefore renders on NVIDIA and tries to import its DMA-BUF buffers as EGLImages on the iGPU side, failing with EGL_BAD_MATCH (0x3009) hundreds of times a second and producing the visible breakage.

This PR installs a per-app override so Chromium only uses Mesa EGL (same GPU as the compositor). The system-wide EGL stack is untouched, so Hyprland itself and every other app keep NVIDIA EGL where they need it.

Changes

  • install/config/hardware/fix-hybrid-chromium.sh — new install-time script
    • Detects NVIDIA discrete + Intel/AMD iGPU via lspci
    • Writes ~/.local/share/applications/chromium.desktop derived from the stock /usr/share/applications/chromium.desktop, rewriting every Exec= line to prefix env __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json LIBVA_DRIVER_NAME=<iHD|radeonsi>
    • Bails silently when: not hybrid, Chromium not installed, Mesa EGL vendor file missing, or the user already has their own chromium.desktop override
  • install/config/all.sh — run the script after nvidia.sh / vulkan.sh
  • migrations/1776262789.sh — delegate to the same script so existing installs get the fix on next omarchy-update

Why a desktop override, not a wrapper or envs.conf

  • envs.conf (global) — tried and breaks Hyprland: the compositor can't initialize EGL on its preferred vendor and crashes on startup, requiring TTY recovery.
  • ~/.local/bin/chromium wrapper — works but depends on PATH ordering and doesn't transparently apply to Desktop Actions; users also bypass it by typing /usr/bin/chromium.
  • .desktop override (this PR) — doesn't depend on PATH, survives upgrades, transparently covers launcher/Walker/menu invocations and both Desktop Actions (new-window and incognito) since every Exec= line is rewritten.

Scope

Chromium only (the browser Omarchy ships by default). The same pattern works for Brave / Chrome / Helium / Thorium — reporters in #4901 confirmed — but extending it is left for a follow-up to keep this PR small.

Verified results (from chrome://gpu)

Feature Before After
GPU Active Intel Intel
Compositing Software Hardware accelerated
Video Decode Hardware (NVIDIA, buggy) Hardware (Intel iHD)
Rasterization Hardware Hardware accelerated
WebGL / WebGPU Hardware Hardware accelerated
GPU crash count Frequent 0
eglCreateImage errors Hundreds/sec 0

Hardware: 13th Gen Intel Iris Xe + RTX 3050, Omarchy 3.4.1, Chromium 145. Other reporters in #4901 confirmed the same fix on AMD iGPU + NVIDIA dGPU (and on Helium, a Chromium derivative).

Test plan

  • Hybrid NVIDIA + Intel iGPU laptop — Chromium hardware acceleration works with zero errors
  • Idempotent: re-running migration on a system that already has an override is a no-op
  • Skipped on hosts without NVIDIA, without iGPU, without Chromium, or with an existing user override
  • Desktop Actions (new-window, incognito) both pick up the override
  • bash -n clean on all three files
  • Tested on AMD iGPU + NVIDIA dGPU (confirmed by reporters in Hybrid Intel+NVIDIA: Chromium hardware acceleration requires manual workarounds #4901 with the same env-var approach; CI/reviewer welcome to spot-check)
  • Fresh install run (scripts verified by dry-run with a sandboxed HOME; a full install run is out of reach here)

Closes #4901

On hybrid NVIDIA + Intel/AMD iGPU laptops, Hyprland composites on the iGPU
while GLVND loads NVIDIA EGL first, so Chromium defaults to NVIDIA EGL and
fails to import its DMA-BUF buffers as EGLImages on the iGPU side. This
surfaces as EGL_BAD_MATCH (0x3009) spam, black screens, flicker, and GPU
process crashes.

Install a per-app override at ~/.local/share/applications/chromium.desktop
that runs Chromium with __EGL_VENDOR_LIBRARY_FILENAMES pointing at Mesa's
50_mesa.json (and LIBVA_DRIVER_NAME matched to the iGPU) so it renders on
the same GPU as the compositor. The system-wide EGL stack is left untouched,
so Hyprland and everything else keep working unchanged.

Gated on hybrid NVIDIA + iGPU detection and skipped when the user already
has their own chromium.desktop override. A matching migration applies the
fix on existing installs.

Closes omacom#4901

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings April 15, 2026 15:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to resolve Chromium black screens/flicker and EGL DMA-BUF import errors on hybrid NVIDIA + Intel/AMD iGPU systems by forcing Chromium-only EGL vendor selection to Mesa via a user .desktop override, leaving the system-wide EGL stack unchanged.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Changes:

  • Add an install-time hardware script to generate a per-user chromium.desktop override that prefixes Exec= with Mesa EGL + iGPU VAAPI env vars.
  • Run the new hardware script during installs after NVIDIA/Vulkan setup.
  • Add a migration that applies the same fix on existing systems by delegating to the install-time script.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
install/config/hardware/fix-hybrid-chromium.sh Detects hybrid NVIDIA+iGPU and creates a user .desktop override to force Mesa EGL for Chromium only.
install/config/all.sh Hooks the new hybrid Chromium fix into the install config sequence.
migrations/1776262789.sh Applies the fix to existing installs by invoking the same script used during install.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +39 to +41
# Rewrite every Exec= line so Desktop Actions (new-window, incognito) get the fix too
sed -E "s|^Exec=(/usr/bin/chromium.*)|Exec=env __EGL_VENDOR_LIBRARY_FILENAMES=$MESA_EGL LIBVA_DRIVER_NAME=$VAAPI_DRIVER \\1|" \
"$STOCK_DESKTOP" >"$USER_DESKTOP"

Copilot AI Apr 15, 2026

Copy link

Choose a reason for hiding this comment

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

The rewritten Exec= lines start with env ..., which breaks bin/omarchy-launch-browser (it parses the first token from Exec= and will get env, then tries to execute it as the browser). This will likely break Omarchy keybindings/launch flows that rely on omarchy-launch-browser. Consider updating omarchy-launch-browser to skip an optional leading env + VAR= assignments when extracting the real executable, or choose an override approach that keeps the actual browser executable as the first Exec token.

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +41
# Rewrite every Exec= line so Desktop Actions (new-window, incognito) get the fix too
sed -E "s|^Exec=(/usr/bin/chromium.*)|Exec=env __EGL_VENDOR_LIBRARY_FILENAMES=$MESA_EGL LIBVA_DRIVER_NAME=$VAAPI_DRIVER \\1|" \
"$STOCK_DESKTOP" >"$USER_DESKTOP"

Copilot AI Apr 15, 2026

Copy link

Choose a reason for hiding this comment

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

The sed rewrite only matches Exec= lines that begin with /usr/bin/chromium. If the stock desktop entry uses Exec=chromium ... (a pattern already used elsewhere in this repo’s .desktop handling), the substitution won’t apply but the script will still create ~/.local/share/applications/chromium.desktop, preventing subsequent runs from applying the fix. Consider matching both forms (e.g., chromium and /usr/bin/chromium) and/or only writing the override when at least one Exec= line was actually rewritten.

Suggested change
# Rewrite every Exec= line so Desktop Actions (new-window, incognito) get the fix too
sed -E "s|^Exec=(/usr/bin/chromium.*)|Exec=env __EGL_VENDOR_LIBRARY_FILENAMES=$MESA_EGL LIBVA_DRIVER_NAME=$VAAPI_DRIVER \\1|" \
"$STOCK_DESKTOP" >"$USER_DESKTOP"
# Rewrite every Exec= line so Desktop Actions (new-window, incognito) get the fix too.
# Match both `Exec=chromium ...` and `Exec=/usr/bin/chromium ...`, and only create
# the user override if at least one Exec= line was actually rewritten.
ORIGINAL_DESKTOP_CONTENT="$(cat "$STOCK_DESKTOP")"
REWRITTEN_DESKTOP_CONTENT="$(
sed -E "s|^Exec=((/usr/bin/)?chromium.*)|Exec=env __EGL_VENDOR_LIBRARY_FILENAMES=$MESA_EGL LIBVA_DRIVER_NAME=$VAAPI_DRIVER \\1|" \
"$STOCK_DESKTOP"
)"
if [[ "$REWRITTEN_DESKTOP_CONTENT" != "$ORIGINAL_DESKTOP_CONTENT" ]]; then
printf '%s\n' "$REWRITTEN_DESKTOP_CONTENT" >"$USER_DESKTOP"
fi

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +41
# Rewrite every Exec= line so Desktop Actions (new-window, incognito) get the fix too
sed -E "s|^Exec=(/usr/bin/chromium.*)|Exec=env __EGL_VENDOR_LIBRARY_FILENAMES=$MESA_EGL LIBVA_DRIVER_NAME=$VAAPI_DRIVER \\1|" \
"$STOCK_DESKTOP" >"$USER_DESKTOP"

Copilot AI Apr 15, 2026

Copy link

Choose a reason for hiding this comment

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

The override is written directly to ~/.local/share/applications/chromium.desktop via redirection. If sed fails (e.g., unreadable stock desktop, unexpected format), this can leave behind an empty/partial override that then blocks future runs because the script exits early when the file exists. Consider writing to a temp file and moving it into place only on success.

Suggested change
# Rewrite every Exec= line so Desktop Actions (new-window, incognito) get the fix too
sed -E "s|^Exec=(/usr/bin/chromium.*)|Exec=env __EGL_VENDOR_LIBRARY_FILENAMES=$MESA_EGL LIBVA_DRIVER_NAME=$VAAPI_DRIVER \\1|" \
"$STOCK_DESKTOP" >"$USER_DESKTOP"
TMP_USER_DESKTOP="$(mktemp "${USER_DESKTOP}.tmp.XXXXXX")" || exit 1
trap 'rm -f "$TMP_USER_DESKTOP"' EXIT
# Rewrite every Exec= line so Desktop Actions (new-window, incognito) get the fix too
if sed -E "s|^Exec=(/usr/bin/chromium.*)|Exec=env __EGL_VENDOR_LIBRARY_FILENAMES=$MESA_EGL LIBVA_DRIVER_NAME=$VAAPI_DRIVER \\1|" \
"$STOCK_DESKTOP" >"$TMP_USER_DESKTOP"; then
mv "$TMP_USER_DESKTOP" "$USER_DESKTOP"
trap - EXIT
else
exit 1
fi

Copilot uses AI. Check for mistakes.
Address Copilot review feedback on omacom#5312:

- Add bin/omarchy-launch-chromium that sets __EGL_VENDOR_LIBRARY_FILENAMES
  and LIBVA_DRIVER_NAME before exec'ing /usr/bin/chromium. Keeps the first
  Exec= token a single command so bin/omarchy-launch-browser's sed-based
  extraction still finds a real executable (previously got "env", which
  broke the keybinding browser launch flow).

- Rewrite every Exec= line to point at the wrapper (absolute path, since
  .desktop files don't expand $VARS).

- Broaden the sed pattern to match both Exec=/usr/bin/chromium and bare
  Exec=chromium, bounded by whitespace or end-of-line so we don't match
  chromium-browser or similar variants.

- Atomic write: produce the new .desktop in a tmpfile, verify the sed
  actually made a substitution (so we don't leave a dead override that
  blocks future runs if the stock .desktop format drifts), then mv into
  place.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for the careful write-up in #4901. I reviewed head 9ec3031 merged onto current dev (b9ddccf) and ran it on a disposable Omarchy worker. The worker has no NVIDIA hardware, so the bug itself could not be reproduced there. What I did run was the install script and wrapper, under stubbed lspci layouts, plus the CLI test suite. Codex Medium reviewed it as a second opinion and agreed with both findings below; it was not guaranteed to be independent of my review.

Two things need to change before this can land:

  • The detection also fires on desktops where NVIDIA drives the display. install/config/hardware/fix-hybrid-chromium.sh:29-32 checks only that an NVIDIA GPU and an Intel/AMD GPU are both listed by lspci. A Ryzen 7000/9000 desktop with an NVIDIA card has both, because every one of those CPUs has an iGPU that shows up as Advanced Micro Devices ... Raphael. With that layout stubbed, the script wrote the override, and the wrapper exported __EGL_VENDOR_LIBRARY_FILENAMES=50_mesa.json and LIBVA_DRIVER_NAME=radeonsi. On such a desktop Hyprland runs on the NVIDIA card, so Chromium would render on the iGPU while the compositor uses NVIDIA. That is the cross-GPU mismatch this PR fixes, turned the other way round. An Intel desktop with its iGPU left enabled hits the same case. The check needs to be about which GPU drives the display, not which GPUs exist. quattro now does that with sysfs boot_vga in bin/omarchy-hw-nvidia-display, and that approach also avoids waking a suspended NVIDIA GPU. The wrapper's lspci at bin/omarchy-launch-chromium:20 wakes it on every browser and web app launch.
  • The CLI suite fails on dev. bin/omarchy-launch-chromium has no # omarchy:summary= line, so test/omarchy-cli-test.sh stops with Missing metadata summary: omarchy-launch-chromium. Without that file the same suite passes on the same worker.

These checks passed: on a stubbed Intel + NVIDIA laptop layout, the override routes all three Exec= lines (the default, new-window and incognito) through the wrapper. omarchy-launch-browser and omarchy-launch-webapp pick the wrapper up as the executable, and a second run is a no-op. An Intel-only layout writes nothing.

A question for the maintainer: this targets dev, but quattro has since taken a different approach to the same report in 6ecf4bf. There, NVIDIA's VA-API/GLX env is set only when NVIDIA drives the display. That removes the global LIBVA_DRIVER_NAME=nvidia that most reporters here had, but it does not steer EGL. So whether Chromium's EGL_BAD_MATCH still happens on quattro has not been shown either way. If this moves to quattro, two things there would also need handling. omarchy-launch-browser focuses the window by the executable's basename, which would become omarchy-launch-chromium. And "remove" in the launcher deletes a user .desktop file and stops there, so Chromium would lose the workaround without being uninstalled.

This is waiting on the maintainer to decide which branch it belongs on, and then on the detection change above. Because only hybrid hardware shows the bug, it will also need a reporter from #4901 or #2800 to confirm the fix on their machine at the final commit.

@omarchybot
omarchybot changed the base branch from dev to quattro September 28, 2026 05:52
omarchybot and others added 5 commits September 28, 2026 09:39
On quattro, install/config/hardware is root-owned system setup, so the leaf that writes ~/.local/share/applications moves to install/user/hardware and is wired into install/user/all.sh. The migration takes a fresh timestamp so it sorts after quattro's existing ones.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Listing both an NVIDIA and an Intel/AMD GPU also matches a Ryzen desktop with an NVIDIA card, where Hyprland composites on NVIDIA and forcing Mesa EGL recreates the cross-GPU mismatch. omarchy-hw-nvidia-display reads boot_vga, as the Hyprland NVIDIA env does, and neither helper wakes a suspended GPU. It also stops the leaf failing under run_logged's bash -e on every machine without NVIDIA, where the empty lspci grep ended the script.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
lspci resumes a runtime-suspended NVIDIA GPU, and this runs on every browser and web app launch. The missing summary metadata failed test/cli.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… drives the display

The override outlives the GPU layout it was installed for, so a laptop switched to NVIDIA-only would still pin Chromium to Mesa, which has no device there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Codex Medium <[email protected]>
The leaf ends in trap - EXIT, so a failed mv of the override still returned 0 under plain bash and the migration was marked done without it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Codex Medium <[email protected]>
@omarchybot

Copy link
Copy Markdown
Collaborator

This now targets quattro, so I brought it across and pushed the result to your branch as 636a793f3a35dc8007e7526280f3e4abf9e7828a. Your commits are unchanged underneath.

What changed on the branch:

  • Merged quattro. On quattro, install/config/hardware/ is root-run system setup, so a leaf that writes ~/.local/share/applications goes in install/user/hardware/fix-hybrid-chromium.sh, run from install/user/all.sh. The migration takes a fresh timestamp (migrations/1790581167.sh) so it sorts after quattro's existing ones.
  • The override installs only when the iGPU drives the display. It now checks omarchy-hw-nvidia and omarchy-hw-nvidia-display (sysfs boot_vga, the same test default/hypr/nvidia.lua uses) instead of listing GPUs with lspci. That keeps it off Ryzen desktops with an NVIDIA display card, which the old check matched. It also fixes a failure on every machine without NVIDIA: the lspci | grep nvidia assignment ended the leaf under run_logged's bash -eE, which I reproduced with the original script.
  • omarchy-launch-chromium reads the display GPU from sysfs rather than lspci, so it no longer wakes a suspended NVIDIA GPU on every browser and web app launch. It sets Mesa EGL and VA-API only while an Intel or AMD GPU drives the display, so a laptop later switched to NVIDIA-only goes back to NVIDIA EGL. It also has the omarchy:summary metadata that test/cli requires.
  • The migration runs the leaf with bash -e. A failed write now leaves the migration pending instead of recording it as done.

What was checked: all of this ran on a disposable Omarchy worker with no NVIDIA hardware, so the bug itself could not be reproduced there. I ran the leaf under bash -eE against stubbed sysfs layouts. It writes the override, routing all three Exec= lines through the wrapper, on Intel+NVIDIA and AMD+NVIDIA laptops where the iGPU drives the display. It writes nothing on an NVIDIA-display desktop, an Intel-only machine or one without boot_vga, and a second run is a no-op. The wrapper sets iHD/radeonsi plus Mesa EGL on the two hybrid layouts and nothing when NVIDIA or a non-Intel/AMD GPU drives the display. The migration succeeds on a hybrid layout and fails when the write fails. test/cli passes except for vscode generated theme references current theme file, which fails the same way on plain quattro. hw-nvidia-test.sh, provision-user-test.sh and chromium-copy-url-test.sh pass. Codex Medium reviewed it as a second opinion over two rounds. It found the NVIDIA-only case and the migration's swallowed failure, both fixed above, and nothing open on its second round.

Two things left for the maintainer, because fixing them means changing shared launcher code rather than this PR:

What this waits on: someone with a hybrid laptop whose built-in display runs on the Intel/AMD GPU. @josefdc, or anyone from #2800 or #4901 (@shapelesh's report is on 4.0.4). quattro has since stopped exporting LIBVA_DRIVER_NAME=nvidia on these machines (6ecf4bf), so the first question is whether Chromium still logs eglCreateImage failed with 0x00003009 on current quattro without this PR. The second is whether this commit makes it stop. To test it:

git clone https://github.com/josefdc/omarchy.git ~/omarchy-5312
git -C ~/omarchy-5312 checkout 636a793f3a35dc8007e7526280f3e4abf9e7828a
omarchy dev link ~/omarchy-5312        # reboots into the checkout
bash ~/omarchy-5312/install/user/hardware/fix-hybrid-chromium.sh

Then open Chromium from the launcher, check chrome://gpu and scroll a heavy page. omarchy dev unlink and deleting ~/.local/share/applications/chromium.desktop undo it. Please say which GPUs the machine has and whether the errors were there before and after.

@imr-git

imr-git commented Oct 10, 2026

Copy link
Copy Markdown

I tested this branch's assumptions against a real hybrid machine and opened a small stacked extension: josefdc#1

The machine is a MacBookPro11,3 (Haswell Iris Pro + GT 750M/Nouveau). It is a case the current boot_vga gate misses: NVIDIA is boot_vga and owns every connector, but AQ_DRM_DEVICES puts Intel first and Hyprland renders there.

The Chromium failure was GPU-specific: its GPU process dumped core in libgallium while using NVIDIA's renderD128, and the kernel logged Nouveau DATA_ERROR / INVALID_VALUE bursts for Chromium. Intel is renderD129. Since September 13, a local workaround has kept Chromium on Intel with DRI_PRIME, Mesa EGL, Haswell's i965 VA-API driver, and a dynamically resolved --render-node-override; there have been no later Chromium coredumps or Chromium-attributed Nouveau errors through October 10.

The stacked PR generalizes that workaround by following AQ_DRM_DEVICES, resolving PCI/render-node mappings through sysfs, preserving the existing boot_vga fallback, and adding regression coverage. It can be merged into this PR's branch without creating a competing upstream PR.

quattro added vm-no-animations.sh beside fix-nouveau-cursor.sh, where this branch runs fix-hybrid-chromium.sh; both now run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@omarchybot

Copy link
Copy Markdown
Collaborator

quattro had moved on and this no longer merged, so I merged it into your branch again and pushed the result as 1b35ef48f9eff685280052b514d31f52e0cf87ff. The only conflict was install/user/all.sh: quattro added vm-no-animations.sh on the line where this branch runs fix-hybrid-chromium.sh, and both now run. Nothing else in the four files changed.

What was checked: on a disposable Omarchy worker with no NVIDIA hardware, test/cli passes at this head. So do hw-nvidia-test.sh, hybrid-gpu-test.sh, provision-user-test.sh, browser-handoff-test.sh, default-browser-lookup-test.sh, webapp-install-test.sh, migrate-scope-test.sh, migrate-wrapper-test.sh and chromium-copy-url-test.sh. launch-browser-test.sh fails, and it fails the same way on plain quattro (f2a39c4). The worker cannot show the bug itself. Codex Medium reviewed the merged head as a second opinion. It confirmed the conflict resolution. It also confirmed that the migration still runs on existing installs even though its timestamp now sorts before quattro's newest, since omarchy-migrate runs every migration that has no completion marker. It raised two things, below.

Since the last review, quattro hands links to a running browser directly (bin/omarchy-cmd-browser-handoff, from #13530). That helper accepts only /usr/bin/chromium and the other browsers' own binaries, so on a machine with this override it declines, and omarchy-launch-browser and omarchy-launch-webapp start the wrapper as before. Links and web apps still open with the wrapper's environment. Affected laptops just do not get the faster handoff. The focus problem from the last comment still stands: bin/omarchy-launch-browser:32 looks for a window matching ^omarchy-launch-chromium.*$, so opening a link from another app does not bring Chromium forward.

A smaller point the second opinion found: bin/omarchy-launch-chromium:26 sets LIBVA_DRIVER_NAME=iHD for every Intel display GPU, but iHD supports Broadwell and newer. On a Haswell or older laptop where someone has installed libva-intel-driver themselves, this would turn off hardware video decode that works today. A stock install is not affected, because Omarchy's installer gives those GPUs intel-media-driver only. I have not changed it, because which driver to pick is better settled on real hardware than guessed at here.

@imr-git's report describes a different layout: NVIDIA is boot_vga, running nouveau, while AQ_DRM_DEVICES puts Intel first and Hyprland renders there. This PR's gate deliberately does nothing on that layout, so it neither helps nor hurts there. The stacked change in josefdc#1 targets this branch rather than quattro, so whether to take it is up to @josefdc. I have not reviewed it.

This is still waiting on a hybrid laptop whose built-in display runs on the Intel or AMD GPU. The questions from the last comment still stand, now at the new head. Does Chromium log eglCreateImage failed with 0x00003009 on current quattro without this PR? And does this commit make it stop? To test it:

git clone https://github.com/josefdc/omarchy.git ~/omarchy-5312
git -C ~/omarchy-5312 checkout 1b35ef48f9eff685280052b514d31f52e0cf87ff
omarchy dev link ~/omarchy-5312        # reboots into the checkout
bash ~/omarchy-5312/install/user/hardware/fix-hybrid-chromium.sh

Then open Chromium from the launcher, check chrome://gpu and scroll a heavy page. omarchy dev unlink and deleting ~/.local/share/applications/chromium.desktop undo it. Please say which GPUs the machine has, and whether the errors were there before and after.

@greptile-apps

greptile-apps Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium impact] Adds Chromium launch wrapper for hybrid GPU systems.

Fix the forced Intel video driver before merging; the browser launch changes also deserve cleanup.

Findings

  1. P1 Older Intel video decoding breaks ▶
  2. P2 Links stop raising Chromium ▶
  3. P2 Every link starts another process ▶

Summary

Routes Chromium through a per-app wrapper on hybrid NVIDIA laptops. The wrapper selects Mesa EGL and an Intel or AMD video driver without changing the global environment.

  • Chromium uses the integrated display GPU for EGL and video.
  • Chromium's desktop launcher picks the right GPU on hybrid laptops.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[User setup or migration] --> B{Required files present and hybrid GPU detected?}
  B -->|No| C[Leave desktop entry unchanged]
  B -->|Yes| D[Rewrite Chromium Exec commands]
  D --> E[omarchy-launch-chromium]
  E --> F{Intel or AMD boot GPU?}
  F -->|Yes| G[Set Mesa EGL and video driver]
  F -->|No| H[Keep inherited environment]
  G --> I[Execute Chromium with original arguments]
  H --> I
Loading

Reviews (1) · Last reviewed commit: "Merge quattro to resolve the install/use..." · Reviewed by Greptile

for device in /sys/bus/pci/devices/*; do
[[ -f $device/boot_vga ]] && (( $(< "$device/boot_vga") == 1 )) || continue
case $(< "$device/vendor") in
0x8086) export LIBVA_DRIVER_NAME=iHD ;;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Older Intel video decoding breaks

On hybrid laptops with older Intel GPUs that require i965, this forces LIBVA_DRIVER_NAME=iHD instead. Those GPUs cannot use that driver, so Chromium loses hardware video decoding. Keep automatic driver selection for older Intel GPUs, or check the GPU generation before choosing iHD.

Comment on lines +43 to +44
sed -E "s@^Exec=(/usr/bin/chromium|chromium)( |\$)@Exec=$WRAPPER\2@" \
"$STOCK_DESKTOP" >"$TMP_DESKTOP"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Links stop raising Chromium

Replacing the first Exec command with omarchy-launch-chromium breaks the window lookup in omarchy-launch-browser. It builds the window-class pattern from that command's name, so it now searches for ^omarchy-launch-chromium.*$ rather than Chromium. Opening a URL can leave the existing browser window unfocused. Teach the launcher to use Chromium's window class for this wrapper.

Comment on lines +43 to +44
sed -E "s@^Exec=(/usr/bin/chromium|chromium)( |\$)@Exec=$WRAPPER\2@" \
"$STOCK_DESKTOP" >"$TMP_DESKTOP"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Every link starts another process

The new Exec command disables the shortcut for sending URLs directly to a running Chromium window. omarchy-cmd-browser-handoff accepts /usr/bin/chromium but rejects this wrapper, so every browser and web-app launch starts another process. Its own comment puts that extra startup at about 165 ms. Recognize this known wrapper for an already-running browser, while keeping the wrapper for cold starts.

@imr-git

imr-git commented Oct 12, 2026

Copy link
Copy Markdown

Update on the MacBookPro11,3 stack: josefdc#1 is now rebased onto this PR's current 1b35ef4 head.

It also addresses all three October 10 review findings:

  • chooses installed iHD/i965 instead of forcing iHD on older Intel GPUs;
  • maps omarchy-launch-chromium back to Chromium's window class for focus;
  • permits the trusted Omarchy GPU wrapper to use the running Chromium singleton handoff, while arbitrary wrappers remain rejected.

New focus and handoff regression tests pass, along with the Chromium GPU, default-browser, copy-URL, web-app, hardware, and command-style suites. test/cli passes completely on the rebased stack. The full headless shell run completed with every browser/Chromium test passing; its unrelated failures were environment/baseline checks involving read-only runtime paths and the absent companion omarchy-pkgs checkout.

@omarchybot

Copy link
Copy Markdown
Collaborator

This PR's head is still 1b35ef48. This comment covers @imr-git's stacked change, josefdc#1 at 5d8860ed, which says it fixes the three points from the last review. I ran it on a disposable Omarchy worker with no NVIDIA hardware: test/cli passes, and so do the new hybrid-chromium-test.sh, launch-browser-test.sh, browser-handoff-test.sh, hw-nvidia-test.sh, hybrid-gpu-test.sh, provision-user-test.sh, default-browser-lookup-test.sh, webapp-install-test.sh and chromium-copy-url-test.sh. I (Claude Opus 5.5) read the diff, and Codex Medium reviewed it separately as a second opinion. Codex agreed with the VA-API finding below, though its independence from my review is not guaranteed. It found the DRI_PRIME conflict on its own, and it traced libva's driver fallback in libva's source.

Two of the three are fixed. bin/omarchy-launch-browser:8-14 maps the wrapper back to Chromium's window class, so opening a link brings Chromium forward again. bin/omarchy-cmd-browser-handoff:18 accepts exactly $OMARCHY_PATH/bin/omarchy-launch-chromium alongside /usr/bin/chromium, and every other wrapper is still declined. That is sound, because the wrapper only affects how a new Chromium process starts.

The Haswell VA-API point is not fixed for the case it was about. A stock install gives "HD Graphics 4600" and "Iris Pro" GPUs intel-media-driver (install/hardware/intel/video-acceleration.sh:5-6 on quattro). So a Haswell user who installed libva-intel-driver themselves has both drivers, and bin/omarchy-launch-chromium:83-84 picks iHD whenever its file exists. That turns off the working i965 decode just as before. The new test only creates i965_drv_video.so (test/shell.d/hybrid-chromium-test.sh:42), so it never covers the case where both are installed. The simpler fix is to not set LIBVA_DRIVER_NAME for Intel at all. With it unset, libva tries iHD and then i965 on an i915 GPU, so each machine gets the driver that actually initialises, and a user's own choice is left alone.

A smaller conflict: in the AQ_DRM_DEVICES path, bin/omarchy-launch-chromium:105 always overwrites DRI_PRIME, but lines 107-114 keep a --render-node-override the caller passed. A caller who chose a render node therefore ends up with DRI_PRIME pointing at a different GPU.

A question for @imr-git: where is AQ_DRM_DEVICES set on the MacBook? The wrapper only sees it if it is in the environment that uwsm starts apps from, not just in Hyprland's own process. The installer only sees it if it is in the environment the migration runs in. Otherwise the migration exits without writing the override, is recorded as done, and does not run again.

Scope is for the maintainer to decide. The muxed layout, where NVIDIA is boot_vga but Aquamarine renders on Intel, is a different machine from the hybrid laptops in #4901. It roughly doubles the GPU-selection logic in this PR. Whether it belongs here or in a PR of its own is up to the maintainer, and taking the stack into this branch is up to @josefdc. I have not pushed it here.

What this still waits on: the same as before, a hybrid laptop whose built-in display runs on the Intel or AMD GPU, testing 1b35ef48. Does Chromium log eglCreateImage failed with 0x00003009 on current quattro without this PR, and does this commit make it stop? The test steps are in the previous comment. @imr-git's MacBook has the other layout, which this PR's gate skips on purpose, so it cannot answer that question.

@imr-git

imr-git commented Oct 21, 2026

Copy link
Copy Markdown

I updated the stacked change in josefdc#1 to 8d811ea4 to address both follow-up findings:

  • Intel no longer assigns LIBVA_DRIVER_NAME, so libva can fall back from iHD to i965 when appropriate and an explicit user choice remains intact. The regression fixture now has both iHD_drv_video.so and i965_drv_video.so, and also checks that a user-selected i965 value is preserved.
  • A caller-provided --render-node-override now takes priority over the automatic GPU selectors. In that case the wrapper does not inject DRI_PRIME, so the two selectors cannot point at different GPUs.

On the MacBook, AQ_DRM_DEVICES is exported from ~/.config/uwsm/env-hyprland:

export AQ_DRM_DEVICES="$HOME/.config/hypr/gpu-intel:$HOME/.config/hypr/gpu-nvidia"

Those links are:

~/.config/hypr/gpu-intel  -> /dev/dri/by-path/pci-0000:00:02.0-card
~/.config/hypr/gpu-nvidia -> /dev/dri/by-path/pci-0000:01:00.0-card

printenv AQ_DRM_DEVICES in the current graphical session returns the expanded paths, so uwsm-launched applications see it. The normal omarchy update/migration path on this machine runs in a visible terminal inherited from that graphical session and sees it as well. A fresh user-finalization run would only see it if that UWSM environment had already been configured/imported; the stack does not source arbitrary user environment files during installation.

The nine related test scripts pass, as do bash -n, git diff --check, and the full CLI suite. The full shell suite ran all 371 files; all Chromium/browser/hybrid-GPU coverage passed. Its 16 failures were unrelated environment/baseline checks (read-only runtime paths, missing omarchy-pkgs, missing local apps, and unrelated fixtures).

@omarchybot

Copy link
Copy Markdown
Collaborator

This PR's head is still 1b35ef48. This comment covers @imr-git's update to the stacked change, josefdc#1 at 8d811ea4, which answers the two points from the last review. I ran it on a disposable Omarchy worker with no NVIDIA hardware: test/cli passes, and so do hybrid-chromium-test.sh, launch-browser-test.sh, browser-handoff-test.sh, hw-nvidia-test.sh, hybrid-gpu-test.sh, default-browser-lookup-test.sh, webapp-install-test.sh and chromium-copy-url-test.sh. I (Claude Opus 5.5) read the new commit, and Codex Medium reviewed it separately as a second opinion. Codex found the same problem below and traced libva's handling of the variable in libva's source, though its independence from my review is not guaranteed.

The DRI_PRIME conflict is fixed. bin/omarchy-launch-chromium:107-110 now sets DRI_PRIME only when the wrapper adds its own --render-node-override, so a caller's render node is never paired with a DRI_PRIME the wrapper chose. Thanks for the AQ_DRM_DEVICES answer, too: exported from ~/.config/uwsm/env-hyprland, uwsm-launched apps and an update run from a terminal both see it.

Leaving LIBVA_DRIVER_NAME alone for Intel fixes Haswell, but now keeps a value Omarchy set for NVIDIA. When NVIDIA is the display GPU and is Turing or newer, default/hypr/nvidia.lua:18-19 exports LIBVA_DRIVER_NAME=nvidia into every app's environment. install/user/hardware/fix-hybrid-chromium.sh:31-41 deliberately installs the wrapper on exactly that layout when AQ_DRM_DEVICES puts Intel first. On such a machine the empty Intel case at bin/omarchy-launch-chromium:84 passes nvidia through to a Chromium rendering on Intel. libva then tries only that driver rather than falling back to iHD or i965, so hardware video decoding fails. 5d8860ed overwrote it, so this is new in 8d811ea4. The MacBookPro11,3's Kepler GPU is older than the >= 0x1e00 check in omarchy-hw-nvidia-gsp, so it does not get that variable and would not show this. The tests miss it because run_launcher clears the variable (test/shell.d/hybrid-chromium-test.sh:66). A contained fix is to clear only Omarchy's own value in the Intel case, [[ ${LIBVA_DRIVER_NAME:-} == nvidia ]] && unset LIBVA_DRIVER_NAME, which keeps both the libva fallback and a user's own iHD or i965, plus a fixture case that passes LIBVA_DRIVER_NAME=nvidia in. I have not pushed anything to either branch.

Scope is still for the maintainer to decide. Whether the muxed layout belongs in this PR or one of its own is up to the maintainer, and taking the stack into this branch is up to @josefdc.

What this PR still waits on is the same as before: someone with a hybrid laptop whose built-in display runs on the Intel or AMD GPU testing 1b35ef48. On current quattro without this PR, does Chromium log eglCreateImage failed with 0x00003009, and does this commit make it stop? The test steps are in the earlier comment.

@josefdc

josefdc commented Oct 21, 2026

Copy link
Copy Markdown
Author

I tested this on the hardware it was written for, and on current quattro the bug no longer reproduces, with or without this PR.

Machine: ASUS Vivobook Pro 15 (K6502VJ). Intel Iris Xe (Raptor Lake-P, boot_vga=1, renderD129) + RTX 3050 6GB Laptop (nvidia-open 615.78.08, renderD128). Omarchy 4.0.6, Hyprland 0.56.2, Mesa 26.2.5, Chromium 154.0.8037.97, intel-media-driver only.

Method: for each case I started a separate Chromium (throwaway --user-data-dir, the stock chromium-flags.conf, --enable-logging=stderr) with __EGL_VENDOR_LIBRARY_FILENAMES, LIBVA_DRIVER_NAME and DRI_PRIME cleared from the environment. Over CDP it opened the WebGL Aquarium, a YouTube embed with autoplay and a long Wikipedia page, scrolled that page twelve times, then read chrome://gpu. I also read the GPU process's /proc/<pid>/maps and open fds.

Case EGL vendor libs loaded in GPU process VA-API driver eglCreateImage / 0x3009 lines GPU crash count Compositing / Video decode
Plain quattro, no override Mesa + NVIDIA iHD 0 0 HW / HW
Old global env (LIBVA_DRIVER_NAME=nvidia, __GLX_VENDOR_LIBRARY_NAME=nvidia) Mesa + NVIDIA nvidia 0 0 HW / HW
This PR's wrapper (1b35ef48) Mesa only iHD 0 0 HW / HW
josefdc#1 wrapper (8d811ea4) Mesa only iHD 0 0 HW / HW

In every case chrome://gpu reports GPU1 Intel *ACTIVE*, GL_RENDERER: ANGLE (Intel, Mesa Intel(R) Iris(R) Xe Graphics (RPL-P) ...), and the browser process has appended --render-node-override=/dev/dri/renderD129 to its own command line. Nothing in Omarchy, chromium-flags.conf or my config sets that flag. Chromium picks the node itself: Ozone/Wayland now has a drm_render_node_path_finder that takes the compositor's preferred device. renderD128 is open in every case, including with this PR, because Dawn enumerates both Vulkan adapters for WebGPU. Nothing renders on it.

So, answering the two open questions:

  1. Does Chromium log eglCreateImage failed with 0x00003009 on current quattro without this PR? No. Not on plain quattro, and not even with the old global LIBVA_DRIVER_NAME=nvidia env put back.
  2. Does this commit make it stop? It runs cleanly, but there is nothing left for it to stop on this layout. The only visible change is that libEGL_nvidia no longer gets loaded into the GPU process.

My April reproduction was on Chromium 145, and that build didn't pick the render node this way. I think Chromium's own render-node selection, plus 6ecf4bf dropping the global NVIDIA VA-API env, covers #4901 on iGPU-display hybrids. This PR would add a user .desktop override, a wrapper and a migration, plus the launcher focus/handoff special-casing from the stack, for a problem that no longer reproduces here. Unless someone from #4901 or #2800 can still reproduce it on current quattro with Chromium 154+, I'd propose closing this.

@imr-git, your MacBookPro11,3 case may be covered the same way. Your crash was on August 28, and with AQ_DRM_DEVICES putting Intel first, Hyprland should advertise the Intel node as its main device. Could you launch plain /usr/bin/chromium (no wrapper, no DRI_PRIME) and check whether chrome://gpu's command line ends with --render-node-override=/dev/dri/renderD129? If it does, the stack probably isn't needed either. If it picks renderD128, that's a real remaining case, and a smaller fix aimed at just that layout might be the better shape.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for testing this on the original hardware, @josefdc. This comment covers your report above; the PR's head is still 1b35ef48 and nothing new was run on a worker, since the question was one only the laptop could answer. I (Claude Opus 5.5) read the report and checked what it rests on, and Codex Medium reviewed the same evidence separately as a second opinion. It reached the same recommendation, though its independence from my review is not guaranteed.

What the report shows. On the layout this PR targets (Intel Iris Xe drives the display, RTX 3050 on nvidia-open), with Chromium 154 on current quattro, plain Chromium logs no eglCreateImage / 0x3009 errors and has no GPU crashes. It renders on Intel and decodes video with iHD. The same holds with the old global LIBVA_DRIVER_NAME=nvidia put back. This PR's wrapper and the stack in josefdc#1 run cleanly too, but there is no longer a failure for them to fix. I confirmed that 6ecf4bf is on quattro: default/hypr/nvidia.lua now sets LIBVA_DRIVER_NAME=nvidia and __GLX_VENDOR_LIBRARY_NAME=nvidia only when NVIDIA drives the display. Chromium choosing the compositor's render node itself fits the --render-node-override=/dev/dri/renderD129 you saw appended without anything in Omarchy setting it.

What it does not cover. AMD iGPUs, Chromium derivatives, older NVIDIA drivers and the muxed layout from @imr-git's MacBookPro11,3 were not tested. A short session also cannot rule out a failure that only shows up now and then. None of that makes this PR's override, wrapper and migration necessary, because they now have no failing case to justify them. Anyone from #4901 or #2800 who still sees the errors with plain /usr/bin/chromium on current quattro should post the chrome://gpu GPU section, the command line, and the log lines, and that can justify reopening or a narrower fix. The MacBook check you asked @imr-git for is that kind of case.

What happens next. This waits on the maintainer, and the recommendation is to close it as no longer needed. Closing is their call, so I have not closed it.

@imr-git

imr-git commented Oct 23, 2026

Copy link
Copy Markdown

Update on the MacBookPro11,3 test and the stacked change:

I pushed df451ba6 to josefdc#1, addressing the remaining review finding. When Chromium is routed to Intel, the wrapper now clears an inherited LIBVA_DRIVER_NAME=nvidia while preserving explicit iHD and i965 choices. The new regression test failed before the fix and passes afterward. The related browser/GPU tests and test/cli pass.

I also tested Chromium 154 through plain /usr/bin/chromium with the local GPU overrides cleared. Its GPU-process command line contained --render-node-override=/dev/dri/renderD128, not Intel renderD129.

During roughly one hour of Jellyfin playback, the screen went black and I had to restart the machine. The previous-boot journal recorded 283,840 Nouveau GPU trap messages beginning during playback and continuing until the restart. There was no Chromium coredump or OOM event. The traps were attributed to Hyprland’s Nouveau channel, so I am not claiming this was a Chromium process crash.

The same Jellyfin app previously ran for over two hours through the Intel wrapper without these traps. This leaves the muxed MacBook layout as a real remaining case, while the original iGPU-display case no longer reproduces.

Would you prefer that I extract the MacBook/AQ_DRM_DEVICES fix into a smaller standalone PR against quattro and let #5312 close, or keep it stacked here?

@imr-git

imr-git commented Oct 23, 2026

Copy link
Copy Markdown

Follow-up on the MacBookPro11,3:

I repeated the Jellyfin test with plain /usr/bin/chromium, the Chromium GPU overrides cleared, native Wayland, and the GPU process still using NVIDIA renderD128. The only session change was AQ_FORCE_LINEAR_BLIT=0.

The episode completed after about 70 minutes. Chromium remained native Wayland (xwayland: false), the GPU process stayed on renderD128 with gpu-recent-crash-count=0, and the kernel journal recorded 0 gr: TRAP, 0 GPC/PROP traps, and 0 Nouveau DATA_ERROR/INVALID events. There was no coredump or OOM event.

For comparison, the earlier native-Wayland run without that setting produced the trap storm and black screen. An XWayland control run on renderD128 completed without a black screen or traps, but still logged 21 Nouveau DATA_ERROR/INVALID events.

This isolates the failure more closely to the native-Wayland Aquamarine/Hyprland cross-GPU blit path on Nouveau than to a Chromium process crash. AQ_FORCE_LINEAR_BLIT=0 is a promising workaround on this machine, although one clean run is not proof of a complete fix. I removed the temporary setting and rebooted after the test.

Given this result, I do not think the MacBook case is a reason to expand the Chromium wrapper in this PR. It looks better suited to a compositor-level workaround or upstream investigation, while #5312 can be decided on the original iGPU-display case.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for the two MacBookPro11,3 runs, @imr-git. This PR's head is still 1b35ef48, and nothing new was run on a worker: your results come from hardware a worker does not have, and triage has not reproduced them. I (Claude Opus 5.5) read both reports, and Codex Medium and muse-wonder (pi, thinking high) reviewed them separately as second opinions. Both reached the same conclusion; their independence from my review is not guaranteed.

What changes. The MacBook was the one case left open as a possible reason for a narrower Chromium fix. As you report it, plain Chromium 154 on NVIDIA renderD128 ran 70 minutes cleanly once the only change was AQ_FORCE_LINEAR_BLIT=0, while the earlier black screen came with Nouveau traps on Hyprland's channel and no Chromium crash. That points at Aquamarine/Hyprland's cross-GPU blit on Nouveau rather than at which GPU Chromium renders on, so it is not a reason for the wrapper here or in josefdc#1. To your question: there is no need to extract the MacBook change as a standalone Chromium PR.

What it does not show. It is one run per condition, the XWayland control still logged Nouveau DATA_ERROR events, and Nouveau on a Kepler-era MacBook says nothing about nvidia-open on the original laptop. It narrows the cause down; it does not pin it to one layer. If you want it followed up, a separate issue about native-Wayland cross-GPU blits on Nouveau, with the versions, GPU routing, journal counts and both AQ_FORCE_LINEAR_BLIT results, is the right place, here or upstream with Hyprland.

What happens next. Nothing changes from the last comment: this waits on the maintainer, and the recommendation is to close it as overtaken by Chromium's own render-node selection and 6ecf4bf on quattro. Closing is their call.

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

Labels

bug Something isn't working compatibility Make Omarchy work better on everything!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hybrid Intel+NVIDIA: Chromium hardware acceleration requires manual workarounds

4 participants