WebGPU is constrained to low power devices when `GPURequestDeviceOptions.powerPreference` is not set
Categories
(Core :: Graphics: WebGPU, defect, P2)
Tracking
()
People
(Reporter: ErichDonGubler, Assigned: ErichDonGubler)
References
Details
Quoting myself from internal WebGPU chat:
I notice that WebGPU is picking the integrated GPU over the NVIDIA GPU reported in comment 7 on bug 1840273 (see the
about:supportPDF attachment); is this related towgpu#3903?Looks like it eventually turns into not setting the
WGPURequestAdapterOptions::power_preferencesetting after a default constructor (i.e.,… options = {}). I'm assuming that because<wgpu::RequestAdapterOptions as Default>::defaultcurrently returnsLowPower, and the FFI definition ofWGPUPowerPreference_LowPower = 0, we're requesting low-power interfaces by default.
This will be resolved in wgpu#3903. We track the consumption of this fix in this bug.
| Assignee | ||
Updated•2 years ago
|
| Assignee | ||
Comment 1•2 years ago
|
||
This has not yet been merged, and it's unclear when it will be merged. Gonna unassign this from myself for now, but happy to prioritize it once upstream has actioned.
| Assignee | ||
Comment 2•2 years ago
|
||
wgpu#3903 has landed! Bumping up in priority, and assigning to myself.
| Assignee | ||
Comment 3•2 years ago
|
||
Hmm, actually, this doesn't seem like a clear-cut win. :jgilbert has noted to me that it's likely important to default to the lowest power profile available for a web browser. Gonna rope in :jimb and :jgilbert to talk this one out; for now, I'll preserve current behavior in the wgpu update in bug 1846558.
Comment 4•2 years ago
•
|
||
The preferred behavior we settled on for WebGL is that:
- request low-power => low-power
- request high-power => high-power
- no preference => low-power (but this was high-power originally)
And also there's a pref for users to override this: webgl.power-preference-override: (for if a user wants the browser to 'always' or 'never' use the high-power option)
Here is where we choose if we ask for HIGH_POWER for creating our GLContext:
https://searchfox.org/mozilla-central/rev/2bf90dc51ce7e8274ce208fbb9d68b3ff535185e/dom/canvas/WebGLContext.cpp#332-341
const auto overrideVal = StaticPrefs::webgl_power_preference_override();
if (overrideVal > 0) {
powerPref = dom::WebGLPowerPreference::High_performance;
} else if (overrideVal < 0) {
powerPref = dom::WebGLPowerPreference::Low_power;
}
if (powerPref == dom::WebGLPowerPreference::High_performance) {
flags |= gl::CreateContextFlags::HIGH_POWER;
}
| Assignee | ||
Updated•2 years ago
|
Comment 5•2 years ago
|
||
I think defaulting to low power when no preference is expressed seems like a perfectly fine behavior. We can add a pref to override this at our leisure.
| Assignee | ||
Comment 6•2 years ago
|
||
:jimb: Ah, okay. In that case, I think we can close this bug without further changes, then.
Description
•