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

Support --disable-gpu flag #364

Closed
kevinschaich opened this issue May 16, 2017 · 6 comments · Fixed by #584
Closed

Support --disable-gpu flag #364

kevinschaich opened this issue May 16, 2017 · 6 comments · Fixed by #584

Comments

@kevinschaich
Copy link
Contributor

@kevinschaich kevinschaich commented May 16, 2017

Description

Electron is using the discrete, high-performance GPU in very simple webapps. I think it would be nice to support a flag that uses the integrated, power-efficient Intel one for simple apps. This issue was mentioned in #312, but we never found a solution. In aluxian/Messenger-for-Desktop@bedec61, the fix seems to be app.disableHardwareAcceleration().

Please add CLI argument --force-integrated-gpu that invokes the electron --force-integrated-gpu flag for apps that will knowingly not require any intensive GPU processing.

Steps to Reproduce Issue

Run:

nativefier drive.google.com -n "Google Drive"

Open and inspect in activity monitor:

image

Specifications

  • Version of Nativefier (run $ nativefier --version): v7.3.1
  • Version of Node.js (run $ node --version): v7.9.0
  • OS: MacOS 10.12.4
  • Architecture x64

MacBook Pro Retina 15" w/ touch bar, Radeon Pro 460 / 4 GB

@ronjouch
Copy link
Member

@ronjouch ronjouch commented May 16, 2017

@kevinschaich thanks for the feedback!

There's a mismatch between what your title and issue say. Looking at the title, I think I understand you want to force Electron to use the integrated (Intel, power-efficient) GPU rather than your AMD/NVIDIA chip, but Electron/Chrome has no such feature as far as I know (or has it? Correct me if I'm wrong).

The request for a --disable-gpu flag remains valid (could be useful e.g. to work around crashy GPU drivers), so renaming the issue and leaving open as feature request. If you insist on the other behavior, I suggest you lobby Chrome for a --force-integrated-gpu / --forbid-discrete-gpu flag.

@ronjouch ronjouch changed the title Add --disable-gpu flag for Electron to force integrated GPU Support --disable-gpu flag May 16, 2017
@kevinschaich
Copy link
Contributor Author

@kevinschaich kevinschaich commented May 16, 2017

@ronjouch Thanks for the correction in terminology. As a revised problem statement, I think it would be helpful to have a --force-integrated-gpu flag that uses the Intel integrated, power efficient GPU. Check out this API doc for electron:

https://github.com/electron/electron/blob/master/docs/api/app.md#appdisablehardwareacceleration

I believe if you call app.disableHardwareAcceleration() in app/src/main.js, it will work as expected. EDIT: Tried on my end and can confirm this fixes the issue:

image

I can try to submit a pull request if someone can provide me an overview of how command-line arguments are parsed/used, as I'm not familiar with the codebase.

@ronjouch
Copy link
Member

@ronjouch ronjouch commented May 16, 2017

@kevinschaich thanks for the fast reponse 👍, that's clearer: you're asking for a --force-integrated-gpu / --forbid-discrete-gpu flag. Would be super neat, agreed, but that doesn't seem likely for now:

  • Reading Electron docs / app.disableHardwareAcceleration(), I think your reading is incorrect. The doc states it "disables hardware acceleration for current app", which to me reads any kind of HW acceleration, including your Intel chip. Said differently, it looks like the programmatic equivalent to Chromium flag --disable-gpu, which will force all computation to your CPU, ignoring your Intel chip. Tests/contradictions welcome, though!
  • Reading electron/electron#4380 , it still looks like no such switching feature is exposed by Electron. Commenters seem to be pointing towards helper tools such as gfxCardStatus, mentioned in the Messenger-for-Desktop issue.

@kevinschaich
Copy link
Contributor Author

@kevinschaich kevinschaich commented May 16, 2017

@ronjouch perhaps this could still be useful for the prior issue you mentioned (e.g. to work around crashy GPU drivers), and perhaps we rename it either to --disable-hardware-acceleration or --disable-gpu as originally suggested?

@ronjouch
Copy link
Member

@ronjouch ronjouch commented May 16, 2017

@kevinschaich yup, leaving the issue open as is, asking for a --disable-gpu flag that disables acceleration altogether 👍.

@pshpsh
Copy link

@pshpsh pshpsh commented Jan 23, 2018

_electron.app.disableHardwareAcceleration() needs on linux as default, if --ignore-gpu-blacklist isn't activated.

hql287/Manta#128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants