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

[PS-1196] Add option to disable hardware acceleration #2896

Closed
wants to merge 6 commits into from
Closed

[PS-1196] Add option to disable hardware acceleration #2896

wants to merge 6 commits into from

Conversation

evelez7
Copy link

@evelez7 evelez7 commented Jun 11, 2022

Type of change

- [ ] Bug fix
- [x] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

Address #2615 which requests an option to disable hardware acceleration in the desktop application.

Code changes

Desktop

  • /accounts/settings.component.html - Add checkbox to toggle hardware acceleration in application settings
  • /accounts/settings.component.ts - Add enableHardwareAcceleration member boolean and text variables. Also initialize along with other members and add a save function for when checkbox is used in settings. It is initialized as true by default.
  • locales/en(/en_GB/en_IN)/messages.json - Add text for the checkbox option
  • main.ts - Add an async function to toggle hardware acceleration. The function must wait for the Promise from stateService for the setting on hardware acceleration. It is called as the first line in main.bootstrap().

Common

  • /abstractions/state.service.ts - Add get/set enableHardwareAcceleration declarations.
  • /models/domain/globalState.ts - Add enableHardwareAcceleration boolean.
  • /services/stateMigration.service.ts - Add enableHardwareDeclaration string key and line to initialize the variable in globals.
  • /services/state.service.ts - Define get/set enableHardwareAcceleration, similar to other functions in that file.

Screenshots

bitwarden_toggled
bitwarden_toggled_off
bitwarden_zoomed

Before you submit

- [x] I have checked for **linting** errors (`npm run lint`) (required)
- [ ] I have added **unit tests** where it makes sense to do so (encouraged but not required)
- [ ] This change requires a **documentation update** (notify the documentation team)
- [ ] This change has particular **deployment requirements** (notify the DevOps team)

evelez7 added 5 commits June 10, 2022 22:08
begin to address #2615

* add HTML portion for checkbox

* add text for EN variations
see #2615

* add listener function for the toggle

* add hardware acceleration member to state classes
* toggle hardware acceleration in main.bootstrap if set to false

* change en descriptions to indicate restart is required
@djsmith85 djsmith85 added the desktop Desktop Application label Jul 26, 2022
@djsmith85 djsmith85 changed the title Add option to disable hardware acceleration [PS1196] Add option to disable hardware acceleration Jul 26, 2022
@djsmith85 djsmith85 changed the title [PS1196] Add option to disable hardware acceleration [PS-1196] Add option to disable hardware acceleration Jul 26, 2022
@Hinton
Copy link
Member

Hinton commented Oct 7, 2022

Hi @evelez7,

Apologies for the late review, I think this change in general is appriciated but the number of people that have issuse with hardware acceleration is far outnumbered by those it helps. Can we invert the condition, and have HW acceleration be enabled by default.

@Hinton Hinton self-assigned this Oct 7, 2022
also set the enableHardwareAcceleration initialization to false like the
rest of the variables
@evelez7
Copy link
Author

evelez7 commented Oct 7, 2022

Can we invert the condition, and have HW acceleration be enabled by default.

Just pushed a commit to fix this @Hinton.

Copy link
Member

@Hinton Hinton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to rebase this on master, and here are some additional review feedback.

Comment on lines +60 to +61
enableHardwareAccelerationText: string;
enableHardwareAccelerationDescText: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be unnecessary since we don't need to conditionally change what text is shown.

Comment on lines +103 to +108
const enableHardwareAccelerationKey = "enableHardwareAcceleration";
this.enableHardwareAccelerationText = this.i18nService.t(enableHardwareAccelerationKey);
this.enableHardwareAccelerationDescText = this.i18nService.t(
enableHardwareAccelerationKey + "Desc"
);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once 60-61 is removed, this also needs to be removed.

@@ -889,6 +889,12 @@
"enableTrayDesc": {
"message": "Always show an icon in the system tray."
},
"enableHardwareAcceleration": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please only change the en locale. The other locales are generated by the crowdin integration.

@@ -930,6 +930,12 @@
"enableTrayDesc": {
"message": "Always show an icon in the system tray."
},
"enableHardwareAcceleration": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please only change the en locale. The other locales are generated by the crowdin integration.

@@ -59,6 +59,7 @@ const v1Keys: { [key: string]: string } = {
enableMinimizeToTray: "enableMinimizeToTray",
enableStartToTray: "enableStartToTrayKey",
enableTray: "enableTray",
enableHardwareAcceleration: "enableHardwareAcceleration",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we'll need a state migration for this. It's a new option that wasn't available before the migration.

@@ -930,6 +930,12 @@
"enableTrayDesc": {
"message": "Always show an icon in the system tray."
},
"enableHardwareAcceleration": {
"message": "Enable hardware acceleration"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"message": "Enable hardware acceleration"
"message": "Use hardware acceleration"

"message": "Enable hardware acceleration"
},
"enableHardwareAccelerationDesc": {
"message": "Enable the application to make use of a discrete GPU. Restart is required."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"message": "Enable the application to make use of a discrete GPU. Restart is required."
"message": "By default this setting is on. Turn off only if you experience graphical issues. Restart is required."

@djsmith85 djsmith85 added the needs-changes Closes PR if no further changes after 21 days label Dec 19, 2022
@github-actions
Copy link
Contributor

We can’t merge your pull request until you make the changes we’ve requested. As we haven’t heard from you recently, this pull request will be closed.

If you’re still working on this, please respond here after you’ve made the changes we’ve requested and our team will re-open it for further review.

Please make sure to resolve any conflicts with the master branch before requesting another review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-pr desktop Desktop Application needs-changes Closes PR if no further changes after 21 days
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants