fix(linux): stop forcing unsupported EGL GL implementation#767
fix(linux): stop forcing unsupported EGL GL implementation#767maxmedina05 wants to merge 3 commits into
Conversation
📝 WalkthroughWalkthroughLinux GPU switch handling no longer forces EGL through ChangesLinux GPU switch cleanup
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
electron/gpuSwitches.test.ts (2)
23-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUpdate 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 valueUpdate 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 thedisableFeaturespayload 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
📒 Files selected for processing (3)
electron/gpuSwitches.test.tselectron/gpuSwitches.tselectron/main.ts
Pull Request Template
Description
Removes the
--use-gl=eglswitch that Recordly appends on Linux X11 sessions. The switch requests aGL 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:
electron/gpuSwitches.*src/hooks/useScreenRecorder.tssrc/lib/exporter/modernVideoExporter.tselectron/windows.ts,electron/hudOverlayBounds.*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.tscallsapp.commandLine.appendSwitch("use-gl", "egl")whenevergetGpuSwitches()returns
useGl: "egl", which the oldshouldForceLinuxEgl()did for every non-Wayland session.--use-gl=eglresolves to(gl=egl-gles2, angle=none). The GL factory in the bundled Electron 43build does not allow that combination and exits the GPU process:
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:
appendSwitchruns after Chromium parses argv, and Chromiumreads the last value of a switch. So
--use-gl/--use-angle/--glpassed on the command lineare silently overridden. That is why every CLI workaround fails and only
--disable-gpuworks —which is exactly the "fix" being passed around for this app today.
shouldForceLinuxEgl()returnedfalseon Wayland, so that branchpassed
useGl: undefinedand resolved to the allowedegl-angledefault. This change gives X11 thesame treatment rather than inventing a new path.
Git history does not record why EGL was forced on X11 —
gpuSwitches.tswas created alreadycontaining it (
be8c5ef), most likely a GLX-era NVIDIA workaround. Modern ANGLE defaults to EGL onLinux regardless.
Type of Change
Bug fix in substance; the cleanup checkbox covers removal of the now-unreachable
shouldForceLinuxEgl()helpers and the deaduseGlplumbing 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=eglappended by the app):…repeating per subprocess, GPU process restart-looping.
After (no override): clean start, no
gl_factoryerror, GPU process stays up.Testing Guide
Unit tests:
Manual, on a Linux X11 session:
Expected: no
Requested GL implementation ... not found in allowed implementationserror, no GPUprocess 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.--use-gl=egl: reproduces the error above verbatim; GPU process exits.Wayland behaviour is unchanged — it already passed
useGl: undefinedand resolved to the sameallowed default.
Checklist
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