Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron 7, disable-gpu flag no longer working #20702

Closed
3 tasks done
t57ser opened this issue Oct 23, 2019 · 11 comments
Closed
3 tasks done

Electron 7, disable-gpu flag no longer working #20702

t57ser opened this issue Oct 23, 2019 · 11 comments

Comments

@t57ser
Copy link
Contributor

@t57ser t57ser commented Oct 23, 2019

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    • 7.0.0
  • Operating System:
    • Windows 10
  • Last Known Working Electron version:
    • 6

Expected Behavior

GPU should be disabled and the chrome window should have no "Intermediate D3D Window" child

Actual Behavior

GPU is enabled

To Reproduce

app.commandLine.appendSwitch("disable-gpu");

Additional Information

It works when using app.disableHardwareAcceleration() but that has a different effect. See:

Electron 7 with app.disableHardwareAcceleration():

electron7

Electron 6 with disable-gpu:

electron 6

@pushkin-
Copy link

@pushkin- pushkin- commented Feb 5, 2020

I believe that something like this broke in Electron 5 and I had to do the following to work around this (not tested in Electron 7):

app.disableHardwareAcceleration();
app.commandLine.appendSwitch("disable-software-rasterizer");

@pushkin-
Copy link

@pushkin- pushkin- commented Mar 4, 2020

Related issue here.

Suggests adding the "in-process-gpu" switch. This does prevent the GPU process from starting, but the chrome://gpu page is a lot greener than I expected with all three options (in-process-gpu, disable-software-rasterizer, app.disableHardwareAcceleration)

image

This is also a problem in Electron 8.

@pushkin-
Copy link

@pushkin- pushkin- commented Mar 4, 2020

Actually the green stuff makes sense, I just didn't understand what in-process-gpu actually does. I'm guessing that's not suitable for you.

@pushkin-
Copy link

@pushkin- pushkin- commented Mar 4, 2020

Did some more investigation.

Passing the --disable-gpu and --disable-software-rasterizer switches to Chrome 80 prevents the GPU process from starting.

Passing these switches via app.commandLine.appendSwitch in addition to calling app.disableHardwareAcceleration() prevents the GPU process from starting in Electron 6.1.9 (latest Electron 6 patch), but stopped working in Electron 7.0.0-beta.1 (earliest Electron 7).

The Chromium version between the two Electron versions changed from 76.0.3809.146 to 78.0.3866.0. Maybe something in Chromium broke this.

When loading chrome://gpu in Electron 6 vs 7beta:
"Metal" disabled in 6; not present in 7
"Multiple Raster Threads" disabled in 6; enabled in 7
"Surface Control" disabled in 6; not present in 7
"Surface Synchronization" enabled in 6; not present in 7
"WebGL/GL2" disabled in 6; "software only, hardware acceleration unavailable" in 7

@pushkin-
Copy link

@pushkin- pushkin- commented Jun 1, 2020

It looks like as of Electron 9:

app.disableHardwareAcceleration();
app.commandLine.appendSwitch("disable-software-rasterizer");

successfully prevent the GPU process from spawning. Could someone double check this?

The disable-gpu switch still doesn't do that, so I guess the main issue remains.

@Syed-Umair
Copy link
Contributor

@Syed-Umair Syed-Umair commented Aug 21, 2020

Hi team,

Any update on this, It is also not working in electron 8.x

@t57ser
Copy link
Contributor Author

@t57ser t57ser commented Jan 13, 2021

The flag seems to be working again,
latest 8: not working
latest 9, 10, 11: working

@pushkin-
Copy link

@pushkin- pushkin- commented Jan 13, 2021

@t57ser For me, it that switch still doesn't turn off the GPU process in Electron 11.

@t57ser
Copy link
Contributor Author

@t57ser t57ser commented Jan 13, 2021

@pushkin- That's weird, this is the code I tried:

const electron = require("electron");
const path = require("path");

const init = () => {
	let browserWindow2 = new electron.BrowserWindow({
		show: true,
		x: 500,
	});

	browserWindow2.webContents.loadURL("http://www.google.com").then(() => {
	});
};
electron.app.commandLine.appendSwitch("disable-gpu");
electron.app.on("ready", () => {
	init();
});

I see that no gpu process spawned.

@electron-triage
Copy link
Collaborator

@electron-triage electron-triage commented Mar 9, 2021

The Electron version reported on this issue is no longer supported. See our supported versions documentation.

If this is still reproducible on a supported version, please open a new issue with any other new information that a maintainer should know.

Thank you for taking the time to report this issue and helping to make Electron better! Your help is appreciated.

@pushkin-
Copy link

@pushkin- pushkin- commented Mar 12, 2021

follow here for updates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
7.2.x
Unsorted Issues
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants