Closed Bug 1841840 (webgpu-omit-power-pref) Opened 1 year ago Closed 11 months ago

WebGPU is constrained to low power devices when `GPURequestDeviceOptions.powerPreference` is not set

Categories

(Core :: Graphics: WebGPU, defect, P2)

defect

Tracking

()

RESOLVED INVALID

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:support PDF attachment); is this related to wgpu#3903?

Looks like it eventually turns into not setting the WGPURequestAdapterOptions::power_preference setting after a default constructor (i.e., … options = {}). I'm assuming that because <wgpu::RequestAdapterOptions as Default>::default currently returns LowPower, and the FFI definition of WGPUPowerPreference_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.

Status: NEW → ASSIGNED

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: egubler → nobody
Status: ASSIGNED → NEW
Priority: P1 → P2

wgpu#3903 has landed! Bumping up in priority, and assigning to myself.

Assignee: nobody → egubler
Status: NEW → ASSIGNED
Priority: P2 → P1
Depends on: 1846558

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.

Flags: needinfo?(jimb)
Flags: needinfo?(jgilbert)

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;
    }
Flags: needinfo?(jgilbert)
Priority: P1 → P2

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.

Flags: needinfo?(jimb)

:jimb: Ah, okay. In that case, I think we can close this bug without further changes, then.

Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.