Skip to content

Commit 0b3e587

Browse files
romgrkclaude
andcommitted
perf: default GSK_RENDERER=ngl on Linux
GTK >= 4.22 defaults to the Vulkan renderer. On dual-GPU laptops where the only Vulkan ICD is NVIDIA's (common Optimus setup), every window then renders on the discrete GPU: realization wakes it from runtime suspend (~1s added to first frame on every launch) and keeps it awake for the app's lifetime, even though the display runs on the integrated GPU. The GL renderer follows the compositor's device via Mesa/EGL and avoids all of it. Set at require time, before GTK reads the variable; setting GSK_RENDERER yourself (including '' for GTK's own choice) takes precedence. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 77f5492 commit 0b3e587

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

lib/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22
* index.js
33
*/
44

5+
/* GTK ≥ 4.22 defaults to the Vulkan renderer. On Linux dual-GPU laptops where
6+
* the only Vulkan ICD is NVIDIA's (a common Optimus setup), that renders every
7+
* window on the discrete GPU: window realization then wakes it from runtime
8+
* suspend (~1s added to first frame, on every launch once it re-suspends) and
9+
* pins it awake — and drawing battery — for the app's lifetime, even though the
10+
* display runs on the integrated GPU. The GL renderer picks the compositor's
11+
* device via Mesa/EGL and has none of these problems. Opt out by setting
12+
* GSK_RENDERER yourself (any value, including 'vulkan' or '' for GTK's choice);
13+
* this runs at require time, before GTK can read the variable. */
14+
if (process.platform === 'linux' && process.env.GSK_RENDERER === undefined)
15+
process.env.GSK_RENDERER = 'ngl'
16+
517
const internal = require('./native.js')
618
const moduleCache = internal.GetModuleCache()
719

0 commit comments

Comments
 (0)