[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] option for suggesting "low power" mode at context creation

On 27/09/2012, at 5:26 AM, Florian Bösch <pyalot@gmail.com> wrote:

I like the low/high power selection a lot better than solving the specific problem with an extra call. Note I'm running webglstats, which does also need to create a context to test some more things, which should work on integrated and discrete regardless, so kicking discrete into gear everytime you visit a page embedding the webglstats tracker would be... overkill.

There are other uses of the setting though. I'm not familiar how OSX makes the GPU selection exactly. But if applications could influence it, they could, in theory, offer this as a choice to users. On OSX you can override this with some app, but most people don't have that gfx selector app.

Indeed. This is an unsupported third-party tool. Our system offers users the choice between switching and discrete-always. Unless the app explicitly asks the user, that's the only choice they get (and the app may not get the integrated GPU even if it asks).

For instance, a presentation toolkit based on webgl would likely want to use integrated GPUs when possible. Most of my demos would likely like to get discrete GPUs if possible.

That's why I like the idea of a flag up front to give a suggestion, but I'm not sure which way it should suggest. Like I said, I'm tempted to go for the low-power unless you explicitly say performance is essential. A presentation toolkit, or a 3d chemical model display, or once off renders should be ok on the integrated card. A game or your demos could say "give me the best you've got". 


On Wed, Sep 26, 2012 at 9:15 PM, Dean Jackson <dino@apple.com> wrote:

This topic came up at the F2F meeting. It's not clear if this is a significant/temporary issue or not, and there wasn't any consensus on approach, so I'm sending this to get broader feedback.

Currently, in WebKit (or Apple's port of it), WebGL will always use a discrete GPU on an OS X dual-GPU system. This follows the system behaviour, where any OpenGL application gets the discrete GPU unless it explicitly asks otherwise (and even then it is not guaranteed to get the integrated card, nor stay on it). The idea is that if you're doing OpenGL, you're probably wanting the highest performance possible.

WebGL has no way to indicate one way or the other. This came up recently in a complaint that an older version of the popular _javascript_ library Modernizr was detecting WebGL support by creating a context (and thus firing up the discrete GPU). It then deleted the context (thus reverting to the integrated GPU). This was on a page that had no other WebGL code - it was just detecting the possibility.

It might be nice if at WebGL context creation time you could pass in some flag indicating that you are not concerned with raw performance, or that the system can opt into a lower power mode if possible. For example, it could be that your WebGL only draws once to create a background image for the page. A game that wants to run at 60fps would not request this mode.

canvasEl.getContext("webgl", { suggestLowPower: true });

NOTE: I have no good ideas for the naming of anything here

This is just a hint. If you requested antialiasing and low-power, the desire for AA would win (if only the discrete GPU supported it, for example).

Another suggestion was a list of priorities:

canvasEl.getContext("webgl", { priorities: ["performance", "poweruse"])

(where the priority values would be constants defined in the spec, not arbitrary strings)

Yet another option would be to always use low-power mode on these system configurations. We don't really have control over if/when the system will decide to automatically upgrade though, so some benchmarks would suffer.

And yet another option is to avoid the initial problem by having a method to indicate whether WebGL is supported: canvasEl.supportsContext("webgl"). I've proposed this to HTML5 (or HTML.next) and the reaction is an almost 50/50 split. Obviously, you'd still need to create a context to know for sure.

At the moment I'm actually tempted to turn on low-power mode for all dual-GPU systems on OS X and see what the performance fallout is.


You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl