Steps: 1. On Nightly, enable media.navigator.enabled to true 2. Go to http://neave.com/webcam/html5/ Expected: The page should load similarly to how Chrome loads the page. Actual: The page errors out indicating that the WebGL context was lost, as there is more than 8 live WebGL contexts being used on the page. The developer states that there's 10 WebGL contexts being used here. He claims it used to work on FF 15, but is no longer working on Nightly. Exact Error: Error: WebGL: Exceeded 8 live WebGL contexts for this principal, losing the least recently used one.
Yup, this got changed in bug 617453. We put global and per-principal limits on the max number of WebGL contexts that can be live at the same time, for multiple reasons: - to prevent out-of-memory issues that happen anyway on certain systems when too many OpenGL/Direct3D contexts are used simultaneously. See bug 617453. - to prevent a denial-of-service issue as some system (mostly Mobile) have a global limit on the number of OpenGL contexts, so a page creating many could deny other applications (even outside of the browser) the ability to create any. On desktop, the limits are 16 WebGL contexts for the whole browser, and 8 per principal. Does the page really have a use for more than 8 WebGL contexts? If it's just to allow many different views, a better way to achieve this is by creating a single WebGL context and doing multiple renderings with it, using gl.scissor and gl.viewport. That will be more portable (esp. on mobile devices), will use far less memory, and will perform better, than using separate WebGL contexts. So unless the page is known to have a specific reason to use many contexts, this is "not a bug".
Hm, in Chromium I get this error: [31924:31924:230630519827:ERROR:gl_surface.cc(87)] Not implemented reached in virtual bool gfx::GLSurface::Resize(const gfx::Size&) Anyway, CC'ing a few Chromium engineers, not so much about that, rather about the fact that this is the first real-world complaint that we get about losing oldest-used contexts when a certain limit is exceeded.
Thanks for the feedback on this. I'm the developer of the app mentioned. There's 10 contexts used in total, one for the main large view and 9 others in a 3x3 grid. The grid view is not shown on mobile for performance reasons, so this issue only pertains to desktop. Is there any particular reason why you chose 8 contexts per page? It seems rather arbitrary. Has there been any evidence that 8 is a good number and that 10, 12, 16 or more is too many? Shouldn't contexts be lost based on how much memory is available per machine rather than an arbitrary limit? Each individual WebGL context in the grid is rendered with a drop shadow and is overlaid with text. It could be rendered as a single context but it was done with 9 individual ones for simplicity and an overall easier layout with CSS.
The limits on desktop are definitely arbitrary. I want to keep them powers of two so we don't enter absurdly detailed tweaking; and the global limit should remain twice the per-principal one; but we can certainly try doubling the current limit and see how that fares. The original motivation was running the WebGL conformance tests which was running out of memory after over 100 contexts on the same principal, so we're still well under that scale.
Attachment #660047 - Flags: review?(jgilbert)
Thanks Benoit. 16 per page seems like a reasonable limit.
Attachment #660047 - Flags: review?(jgilbert) → review+
Assignee: nobody → bjacob
Target Milestone: --- → mozilla18
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.