Skip to content

fix(linux): stop forcing unsupported EGL GL implementation#767

Open
maxmedina05 wants to merge 3 commits into
webadderallorg:mainfrom
maxmedina05:fix/linux-gl-egl-2
Open

fix(linux): stop forcing unsupported EGL GL implementation#767
maxmedina05 wants to merge 3 commits into
webadderallorg:mainfrom
maxmedina05:fix/linux-gl-egl-2

Conversation

@maxmedina05

@maxmedina05 maxmedina05 commented Jul 17, 2026

Copy link
Copy Markdown

Pull Request Template

Description

Removes the --use-gl=egl switch that Recordly appends on Linux X11 sessions. The switch requests a
GL implementation that Chromium rejects, so the GPU process exits on every launch and the app
restart-loops into software rendering. Dropping the override lets Linux resolve to Chromium's allowed
default — the same path the Wayland branch already took.

This is PR 1 of 4 in a series fixing Recordly on Ubuntu 24.04. The four are independent, touch
disjoint files, and can be reviewed and merged separately:

# PR Area Issues
1 Stop forcing EGL (this PR) electron/gpuSwitches.* #364, #441
2 Real X11 screen source instead of the portal sentinel src/hooks/useScreenRecorder.ts #137, #364, #441
3 Default Lightning render backend to WebGL src/lib/exporter/modernVideoExporter.ts #644
4 Re-land HUD menu expand electron/windows.ts, electron/hudOverlayBounds.* re-lands #612

This one comes first because it is the enabler: until the GPU process stays up, reviewers on Linux
cannot meaningfully test the other three.

Motivation

electron/main.ts calls app.commandLine.appendSwitch("use-gl", "egl") whenever getGpuSwitches()
returns useGl: "egl", which the old shouldForceLinuxEgl() did for every non-Wayland session.
--use-gl=egl resolves to (gl=egl-gles2, angle=none). The GL factory in the bundled Electron 43
build does not allow that combination and exits the GPU process:

[ERROR:ui/gl/init/gl_factory.cc:102] Requested GL implementation (gl=egl-gles2,angle=none)
not found in allowed implementations: [(gl=egl-angle,angle=default)].
[ERROR:components/viz/service/main/viz_main_impl.cc:189] Exiting GPU process due to errors
during initialization

This repeats for each spawned subprocess. The app still starts and the media server binds, but the
GPU process keeps failing and restarting, and rendering falls back to software. The affected surface
is the editor preview and export, which use PixiJS/WebGL for compositing.

Two consequences worth calling out:

  • It overrides user-supplied flags. appendSwitch runs after Chromium parses argv, and Chromium
    reads the last value of a switch. So --use-gl / --use-angle / --gl passed on the command line
    are silently overridden. That is why every CLI workaround fails and only --disable-gpu works —
    which is exactly the "fix" being passed around for this app today.
  • Wayland was already fine. shouldForceLinuxEgl() returned false on Wayland, so that branch
    passed useGl: undefined and resolved to the allowed egl-angle default. This change gives X11 the
    same treatment rather than inventing a new path.

Git history does not record why EGL was forced on X11 — gpuSwitches.ts was created already
containing it (be8c5ef), most likely a GLX-era NVIDIA workaround. Modern ANGLE defaults to EGL on
Linux regardless.

Type of Change

  • New Feature
  • Bug Fix
  • Refactor / Code Cleanup
  • Documentation Update
  • Other (please specify)

Bug fix in substance; the cleanup checkbox covers removal of the now-unreachable
shouldForceLinuxEgl() helpers and the dead useGl plumbing they fed.

Related Issue(s)

Refs #364, #441 — the GL half of both.

Screenshots / Video

Not applicable — this fix has no UI surface. The observable change is in the GPU process lifecycle,
so before/after logs are the meaningful artifact.

Before (X11, --use-gl=egl appended by the app):

[ERROR:ui/gl/init/gl_factory.cc:102] Requested GL implementation (gl=egl-gles2,angle=none)
not found in allowed implementations: [(gl=egl-angle,angle=default)].
[ERROR:components/viz/service/main/viz_main_impl.cc:189] Exiting GPU process due to errors
during initialization

…repeating per subprocess, GPU process restart-looping.

After (no override): clean start, no gl_factory error, GPU process stays up.

Testing Guide

Unit tests:

npx vitest --run electron/gpuSwitches.test.ts
npx biome lint electron/gpuSwitches.ts electron/gpuSwitches.test.ts electron/main.ts

Manual, on a Linux X11 session:

npm run dev

Expected: no Requested GL implementation ... not found in allowed implementations error, no GPU
process restart loop, and no need for --disable-gpu.

To reproduce the original failure on the same machine, re-add the switch (or launch a pre-fix build
with --use-gl=egl) and watch the GPU process exit on startup.

Verified on: Razer Blade 15 Base (2021), Intel i7-10750H + NVIDIA RTX 3070 Laptop (hybrid,
PRIME on-demand), Ubuntu 24.04 LTS, kernel 6.17.0-35, NVIDIA driver 580, X11 session.

  • With --use-gl=egl: reproduces the error above verbatim; GPU process exits.
  • Without it: clean start, no GL errors, GPU process stays up.

Wayland behaviour is unchanged — it already passed useGl: undefined and resolved to the same
allowed default.

Checklist

  • I have performed a self-review of my code.
  • I have added any necessary screenshots or videos.
  • I have linked related issue(s) and updated the changelog if applicable.

Notes

Investigated and drafted with Claude Code. The failure logs and the A/B below are from real
runs on the hardware listed, not generated — I can re-run either on request.


Thank you for contributing!

Summary by CodeRabbit

  • Bug Fixes
    • Removed forced EGL/GL selection on Linux so the app now uses the platform default graphics behavior.
    • Kept Linux-specific GPU workarounds active where applicable (including VAAPI-related feature disabling).
    • Updated GPU acceleration switch handling to apply only the relevant options, avoiding unnecessary graphics overrides.
  • Tests
    • Updated the GPU switch selection test coverage to match the new Linux behavior and verify the absence of GL forcing.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Linux GPU switch handling no longer forces EGL through use-gl. The GPU switch contract and tests were updated, and Electron command-line configuration now retains only use-angle and disable-features handling.

Changes

Linux GPU switch cleanup

Layer / File(s) Summary
Remove EGL forcing from GPU switch selection
electron/gpuSwitches.ts
The GpuSwitches type and Linux branch no longer expose or return useGl; the exported EGL decision helper was removed.
Update command-line wiring and coverage
electron/main.ts, electron/gpuSwitches.test.ts
GPU configuration no longer appends use-gl, and tests cover Linux Wayland, X11, and empty-environment results.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly states the main Linux change: stopping the forced EGL GL implementation.
Description check ✅ Passed The description covers purpose, motivation, change type, related issues, testing, and checklist, with screenshots marked not applicable.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (2)
electron/gpuSwitches.test.ts (2)

23-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Update test description.

The test description mentions "on Linux X11", but the environment provided is empty ({}) and doesn't specify an X11 session. Consider updating the description to indicate a generic or empty Linux environment instead.

♻️ Proposed fix
-	it("does not force a GL implementation on Linux X11", () => {
+	it("does not force a GL implementation on generic Linux", () => {
 		expect(getGpuSwitches("linux", {})).toEqual({
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@electron/gpuSwitches.test.ts` around lines 23 - 27, Update the test
description in the getGpuSwitches test to describe a generic or empty Linux
environment rather than Linux X11, since the provided environment object is
empty. Keep the assertions and test behavior unchanged.

17-21: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Update the test name to reflect the removed EGL workaround.

The test name still references the "X11 EGL workaround," but the EGL workaround logic has been completely removed from getGpuSwitches. Since this test just verifies the disableFeatures payload for X11 sessions, consider renaming it to better reflect the new behavior.

♻️ Proposed fix
-	it("returns the X11 EGL workaround on Linux X11", () => {
+	it("returns the VAAPI workaround on Linux X11", () => {
 		expect(getGpuSwitches("linux", { XDG_SESSION_TYPE: "x11" })).toEqual({
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@electron/gpuSwitches.test.ts` around lines 17 - 21, Rename the test case
around getGpuSwitches for Linux X11 so it describes the disableFeatures payload
or current X11 behavior without mentioning the removed EGL workaround; leave the
assertions and implementation unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@electron/gpuSwitches.test.ts`:
- Around line 23-27: Update the test description in the getGpuSwitches test to
describe a generic or empty Linux environment rather than Linux X11, since the
provided environment object is empty. Keep the assertions and test behavior
unchanged.
- Around line 17-21: Rename the test case around getGpuSwitches for Linux X11 so
it describes the disableFeatures payload or current X11 behavior without
mentioning the removed EGL workaround; leave the assertions and implementation
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 50372711-d829-44ad-9bc3-4326b00a19ce

📥 Commits

Reviewing files that changed from the base of the PR and between 360b160 and 04f8019.

📒 Files selected for processing (3)
  • electron/gpuSwitches.test.ts
  • electron/gpuSwitches.ts
  • electron/main.ts

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant