Skip to content

Option to turn on/off hardware acceleration  #13648

Closed
element-hq/element-desktop
#365

Description

@austinhuang0131

Is your suggestion related to a problem? Please describe.
Mac tends to freeze a lot when hardware acceleration is frequently used. A known example is patch 2020-002. Also this would help low-end devices running the app.

Describe the solution you'd like
A switch to enable/disable hardware acceleration for graphics.

Describe alternatives you've considered
The switch certainly exists for Discord (which is also electron)...

Additional context

edit: typo

Activity

  1. changed the title [-][Suggestion] Hardware acceleration switch[/-] [+]Option to turn on/off hardware acceleration [/+] on May 13, 2020
  2. austinhuang0131 commented on May 13, 2020

    @austinhuang0131
    Author

    Also, my computer (MacBook Air) froze with that specific fault (in linked article) when launching the YouTube widget, so that sorta makes the issue somewhere between an issue and a suggestion...

  3. turt2live commented on May 13, 2020

    @turt2live
    Member

    that would probably be a different issue, though likely to be closed as a duplicate of this due to lack of the feature in the first place.

  4. added
    A-ElectronIssues specific to Element Desktop
    S-CriticalPrevents work, causes data loss and/or has no workaround
    on Apr 6, 2021
  5. added
    O-UncommonMost users are unlikely to come across this or unexpected workflow
    on Aug 2, 2021
  6. novocaine commented on Aug 4, 2021

    @novocaine
    Contributor
  7. MRAAGH commented on Mar 16, 2022

    @MRAAGH

    Seems this is still relevant, since hardware acceleration is causing #21405
    It would be great to have an option for this. All it needs to do is call app.disableHardwareAcceleration() at startup

  8. removed
    S-CriticalPrevents work, causes data loss and/or has no workaround
    on Mar 16, 2022
  9. novocaine commented on Mar 16, 2022

    @novocaine
    Contributor

    Seems this is still relevant, since hardware acceleration is causing #21405 It would be great to have an option for this. All it needs to do is call app.disableHardwareAcceleration() at startup

    You (or the OP) could verify whether your suggestion indeed resolves #21405 by running app.disableHardwareAcceleration() in the developer console (ctrl/cmd+alt+I). If you can show that, it would help motivate this enhancement request.

    Note that Electron's documentation doesn't draw that conclusion, and in the past, we've found it hasn't been that simple.

  10. MRAAGH commented on Mar 16, 2022

    @MRAAGH

    https://www.electronjs.org/docs/latest/api/app#appdisablehardwareacceleration states that this can only be called before the app is ready; so I don't think we can do this while it is already running. Additionally, I don't seem to be able to find app, it either exists under a different name or is not globally defined
    Screenshot_20220316-181028_r8KQb

  11. novocaine commented on Mar 16, 2022

    @novocaine
    Contributor

    https://www.electronjs.org/docs/latest/api/app#appdisablehardwareacceleration states that this can only be called before the app is ready; so I don't think we can do this while it is already running. Additionally, I don't seem to be able to find app, it either exists under a different name or is not globally defined Screenshot_20220316-181028_r8KQb

    ah right. well, its not too complicated to to a local build and hack the line in to test, instructions are over at https://github.com/vector-im/element-desktop/

  12. SapphyThyHybrid commented on Mar 16, 2022

    @SapphyThyHybrid

    Seems this is still relevant, since hardware acceleration is causing #21405 It would be great to have an option for this. All it needs to do is call app.disableHardwareAcceleration() at startup

    You (or the OP) could verify whether your suggestion indeed resolves #21405 by running app.disableHardwareAcceleration() in the developer console (ctrl/cmd+alt+I). If you can show that, it would help motivate this enhancement request.

    Note that Electron's documentation doesn't draw that conclusion, and in the past, we've found it hasn't been that simple.

    I'll do my best then

  13. t3chguy commented on Mar 21, 2022

    @t3chguy
    Member

    Additionally, I don't seem to be able to find app, it either exists under a different name or is not globally defined

    Its only available from the Main process, not the Renderer process.

    image

  14. MRAAGH commented on Mar 21, 2022

    @MRAAGH

    I am not personally experiencing this issue, but for anyone who is, here is how you can test if disabling hardware acceleration is the solution:

    1. install yarn (for example from https://github.com/yarnpkg/yarn/releases)
    2. go to https://github.com/vector-im/element-desktop/ click Code and then Download ZIP. Extract the zip
    3. open a terminal in the extracted folder and run these commands:
    yarn install
    yarn run fetch --noverify --cfgdir ""
    yarn add electron
    yarn start
    

    Your freshly compiled Element should start. Please check that your issue still happens in this version. Then quit Element.

    1. open the folder src and edit electron-main.ts. Find the line that says app.on('ready', async () => { (should be line number 846). Before this line, add the following line:
    app.disableHardwareAcceleration();
    

    Save and close.

    1. Run the command yarn start again. Element starts again. Check that the issue does not happen any more.
  15. SapphyThyHybrid commented on Mar 23, 2022

    @SapphyThyHybrid

    Seems this is still relevant, since hardware acceleration is causing #21405 It would be great to have an option for this. All it needs to do is call app.disableHardwareAcceleration() at startup

    You (or the OP) could verify whether your suggestion indeed resolves #21405 by running app.disableHardwareAcceleration() in the developer console (ctrl/cmd+alt+I). If you can show that, it would help motivate this enhancement request.
    Note that Electron's documentation doesn't draw that conclusion, and in the past, we've found it hasn't been that simple.

    I'll do my best then

    Continuing with this and with the help of friends, eventually we go there, thanks to this person and these steps (as well as other cause windows wants to be windows

    I am not personally experiencing this issue, but for anyone who is, here is how you can test if disabling hardware acceleration is the solution:

    1. install yarn (for example from https://github.com/yarnpkg/yarn/releases)
    2. go to https://github.com/vector-im/element-desktop/ click Code and then Download ZIP. Extract the zip
    3. open a terminal in the extracted folder and run these commands:
    yarn install
    yarn run fetch --noverify --cfgdir ""
    yarn add electron
    yarn start
    

    Your freshly compiled Element should start. Please check that your issue still happens in this version. Then quit Element.

    1. open the folder src and edit electron-main.ts. Find the line that says app.on('ready', async () => { (should be line number 846). Before this line, add the following line:
    app.disableHardwareAcceleration();
    

    Save and close.

    1. Run the command yarn start again. Element starts again. Check that the issue does not happen any more.

    disabling hardware acceleration has fixed the issue for me

    Before disabling:
    image

    and after disabling:
    image
    I waited a couple of mins after disabling to see if it comes back (usually takes about 10 seconds for it to become blurry for me) and it stayed readable. I hope this is enough proof that disabling hardware acceleration fixes the issue for me, and sorry it took a while. Life happened.

  16. MRAAGH commented on Apr 16, 2022

    @MRAAGH

    tl;dr: yes, app.disableHardwareAcceleration(); fixed everything, and there should probably be a setting for this.

  17. MRAAGH commented on May 23, 2022

    @MRAAGH

    🎉

  18. added a commit that references this issue on Jun 7, 2022
    bb2a41e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ElectronIssues specific to Element DesktopHelp WantedExtra attention is neededO-UncommonMost users are unlikely to come across this or unexpected workflowT-Enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions