Skip to content

fix: prevent disabling GPU on the latest Linux kernels#257

Open
Abubakr98 wants to merge 1 commit intoelectron-vite:mainfrom
Abubakr98:fix-linux-gpu-acceleration
Open

fix: prevent disabling GPU on the latest Linux kernels#257
Abubakr98 wants to merge 1 commit intoelectron-vite:mainfrom
Abubakr98:fix-linux-gpu-acceleration

Conversation

@Abubakr98
Copy link

Description

This PR fixes a critical bug where hardware acceleration (GPU, WebGL, WebGPU) is unintentionally disabled for Linux users running kernel versions 6.1 and higher (e.g., modern Debian 13, Ubuntu 24.04).

What is the problem?

Currently, in index.ts, there is the following check:
if (os.release().startsWith('6.1')) app.disableHardwareAcceleration()

This was clearly intended to disable hardware acceleration on Windows 7 (which has the NT kernel version 6.1). However, on Linux, os.release() returns the Linux kernel version. Since modern Linux distributions are now using kernel 6.1.x and above, the startsWith('6.1') condition incorrectly evaluates to true, forcing the Electron app into a software rendering fallback (SwiftShader) and completely killing GPU performance.

How does this PR fix it?

Added a strict process.platform === 'win32' check before evaluating the OS release version.

What is the purpose of this pull request?

  • [ X] Bug fix
  • New Feature
  • Documentation update
  • Other

Add win32 platform check to prevent disabling GPU on Linux kernels that starts with 6.1 (e. g. 6.1, 6.19 etc.)
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.

1 participant