electron: 3.0 regression: gpu process is started despite app.disableHardwareAcceleration() (and offscreen mode)
- Output of
node_modules/.bin/electron --version: v3.0.0-beta.7 (x86) - Operating System (Platform and Version): win7 sp1 x64
- Output of
node_modules/.bin/electron --versionon last known working Electron version (if applicable): v2.0.8 (x86)
Expected Behavior
gpu process should not be started, as in 2.0.8

Actual behavior
gpu process is started and it exits with error

[9276:0822/202731.860:ERROR:viz_main_impl.cc(195)] Exiting GPU process due to errors during initialization
[9684:0822/202731.869:ERROR:browser_gpu_channel_host_factory.cc(119)] Failed to launch GPU process.
[9684:0822/202731.869:ERROR:gpu_process_transport_factory.cc(1017)] Lost UI shared context.
To Reproduce
run
electron.exe --enable-logging offscreen.js
offsreen.js
const { app, BrowserWindow } = require('electron')
const OFFSCREEN = true
if (OFFSCREEN)
app.disableHardwareAcceleration()
let win
app.once('ready', () => {
win = new BrowserWindow({
width: 340,
height: 240,
webPreferences: {
offscreen: OFFSCREEN,
}
})
if (win.webContents.isOffscreen())
win.webContents.setFrameRate(1)
console.log('%O', {offscreen: win.webContents.isOffscreen(), frameRate: win.webContents.getFrameRate()})
win.webContents.on('paint', (event, dirty, image) => {
console.log('paint')
})
win.loadURL('about:blank')
})
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 16 (7 by maintainers)
the tl;dr from that Chrome issue is:
--in-process-gpu. If you also want to disable SwiftShader (and lose WebGL support),--disable-software-rasterizeris there for you.--in-process-gpuis a substantial deviation from the way Chromium generally expects to operate and I expect it to be somewhat less stable than running in the default mode with a separate gpu process (for instance, we would be unable to recover from a crash in the compositor, as that would crash the main process when running with--in-process-gpu).We should make sure we have a JS hook that runs early enough that adding
--in-process-gputo the command-line switches is effective, butapp.disableHardwareAcceleration()should not add that switch by default.--in-process-gpudoes not suppered in WINDOWS, the page will not render, but the IOS platform is okWorking with Electron 4.1, Greenworks and Steam in the Windows environment, we need to use --in-process-gpu to enable the Steam overlay. Currently, due to the issue commented above, we need to add the --in-process-gpu command line switch during the launch of the app (e.g.
app.exe --in-process-gpu). As noted above, if we try to useapp.commandLine.appendSwitchthe app becomes unstable, intermittently crashing.All this is to say that we also would like to see, so we can add that switch to the code and do not need to rely on adding the command line switch actually on the command line.
“We should make sure we have a JS hook that runs early enough that adding --in-process-gpu to the command-line switches is effective…”