Closed Bug 1562812 Opened 5 months ago Closed 5 months ago

For powerPreference:Default, only keep dGPU active for consistently active contexts


(Core :: Canvas: WebGL, enhancement, P1, major)




Tracking Status
relnote-firefox --- 69+
firefox69 --- fixed


(Reporter: jgilbert, Assigned: jgilbert)


(Blocks 1 open bug, Regressed 1 open bug)



(1 file)

Also, don't switch to dGPU immediately.

My current thinking:
PowerPreference::LowPower should never request dGPU.
::HighPerformance should always get the dGPU. (You asked for it!!)
::Default is trickier!

We don't want ::Default contexts keeping the dGPU alive when they're not/barely using it.
However, we need old/powerPreference-unaware content to run as fast as it used to. (benchmarks, games, etc)
Additionally, it would be nice to not switch to dGPU immediately for ::Default contexts, since some (many) of them are one-offs. (but we want to activate the dGPU for steady-state content!)

So! On ::Default context creation, we have a grace period where we don't yet active the dGPU. After this grace period, if the context is still active, activate the dGPU. If the context falls dormant, drop our reference to the dGPU to (try to) switch back to iGPU.

Additionally, I was struck by this recently:

  • Leaving the dGPU active is likely battery-draining
  • The vast majority of current WebGL content, trackers, and ads don't express a powerPreference
  • We have reports from a ton of particularly macOS users of high battery drain


This would be a great thing to get Telemetry on, but it's also something we should probably stem the bleeding on ASAP.

This patch reverts bug 1561073, since this patch should improve the false-positive rate from heuristic in 1561073. (1561073 might cause not give the dGPU to content which creates a webgl context before attaching the canvas to the DOM)

See Also: → 1561073
Pushed by
For powerPreference:Default, only keep dGPU active for consistently active contexts. r=lsalzman
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69

Release Note Request (optional, but appreciated)
[Why is this notable]: macOS users on dual-graphics-card machines (like MacBook Pro) will switch back to the low-power GPU more aggressively, saving battery life.
[Affects Firefox for Android]: no
[Suggested wording]: macOS users with dual-graphics-card machines (like MacBook Pro) will switch WebGL content back to the more power-efficient GPU more aggressively, saving battery life. Firefox will also no longer spin-up the high-power GPU by default for one-off transient uses of WebGL.
[Links (documentation, blog post, etc)]: none

I don't know if we mention preferences in these, but if so:

There's also a new preference (webgl.default-low-power) available for users who want to keep most WebGL content on the more power-efficient GPU.

relnote-firefox: --- → ?

Added to the Fx69 Beta release notes.

See Also: → 1339215
Regressions: 1579984
You need to log in before you can comment on or make changes to this bug.