gpuweb / gpuweb

Where the GPU for the Web work happens!
http://webgpu.io
Other
4.75k stars 314 forks source link

Permission Policy for WebGPU power usage #3751

Open kainino0x opened 1 year ago

kainino0x commented 1 year ago

Spun off from the 1/04 discussion of #3483. There was interest in considering a permission policy targeted at power usage (rather than privacy). This is easy to write out a strawperson for:

The question is whether "high-performance" is something we want to limit third-party iframes from using by default. There's a tradeoff of protecting the user's battery life vs getting them higher performance.

User agents also are already completely free to ignore the powerPreference in certain contexts, for example heuristically-detected ad iframes, so we may not need a new tool here.

Note, a point raised in https://github.com/gpuweb/gpuweb/issues/3483#issuecomment-1386104455 still applies: iframe embeds that have already shipped (say, a Sketchfab embed added in 2020) will not have this new allow= policy. This will prevent the embedded page from using the high-performance adapter through WebGPU until the embedder updates their site. Bad for cases like Sketchfab VR.

kainino0x commented 1 year ago

Something I should add here is that we can imagine a global permission prompt for sustained high power usage, someday in the future. I'm not aware of any such plans, but it seems realistic. I imagine such a permission would require a prompt even at the top-level, not have a distinction between top-level and iframe.

With regard to WebGPU, such a permission would probably simply affect whether a request for "high-performance" is obeyed. In other words, if there's a discrete GPU, whether it's available to the page. Adding a permission like this would force existing sites down to the integrated GPU by default, gaining access either heuristically, by prompting, or by manual intervention of the user.

kainino0x commented 1 year ago

Meeting: No interest in having a distinction between top-level and iframe, for reasons also covered in #3483. There is interest in giving users more control over access to high-power-usage hardware generally, agnostic to top-level vs iframe, but in not blocking V1 on this.