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.