New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 771792 link

Starred by 3 users

Issue metadata

Status: Verified
Owner:
OOO until 2019-01-24
Closed: Jul 16
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Feature



Sign in to add a comment

Make WebGL context limit configurable

Reported by brian...@gmail.com, Oct 4 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Steps to reproduce the problem:
1. Create more than 16 WebGL contexts in a render process.

What is the expected behavior?
The WebGL context limit should be configurable and/or dynamically determined based on GPU memory, so that users on systems with powerful GPUs and lots of GPU memory can render more than 16 WebGL contexts without losing contexts. 

Ideally, the limit would be determined dynamically based on available GPU memory, but at minimum please expose this via chrome://flags/.

What went wrong?
Context loss beyond 16 contexts.

Did this work before? No 

Does this work in other browsers? N/A

Chrome version: 61.0.3163.100  Channel: stable
OS Version: 10.0
Flash Version: 

We have complex data visualization apps rendering multiple WebGL-based charts at once, and this context loss is a major roadblock. I can't think of any reason that users with 8 or 11 GB of GPU memory should have an arbitrary cap of 16 WebGL contexts.
 

Comment 1 by kbr@chromium.org, Oct 4 2017

Labels: -Pri-2 Pri-3
It's not that simple to know ahead of time how many contexts the underlying system can support well. As a related example, we're even facing problems where just trying to raise the limit of WebGL contexts' back buffer size (Issue 756347) is causing GPU hangs, GPU process crashes and context losses on some operating systems.

I strongly recommend that you work toward reducing the number of WebGL contexts you allocate. You can draw one WebGL canvas's results into other canvases using either the 2D rendering context (drawImage taking a canvas element). You can also use OffscreenCanvas with a WebGL context, OffscreenCanvas.transferToImageBitmap to grab frames from it, and ImageBitmapRenderingContext in the canvases you want to display into.

Comment 2 by kbr@chromium.org, Oct 4 2017

Labels: -Type-Bug Type-Feature

Comment 3 by kbr@chromium.org, Oct 4 2017

Status: Available (was: Unconfirmed)

Comment 4 by brian...@gmail.com, Oct 5 2017

I can see how having Chrome try to determine the context limit could be difficult. But in that case, I'd say just expose it as a flag so that folks can change it themselves to a known good value.

In our case, reducing the number of contexts isn't a viable option. We're using a WebGL charting library (Plotly), and each of the contexts wraps a separate chart. So each one is totally unrelated to the others, and each has separate chart axes, controls, event handlers, and data. So "merging" all of them into one context, or synchronizing offscreen vs. onscreen contexts, essentially translates to: write your own charting engine from scratch. That's man-years of work.

I totally understand that Chrome *has* to impose some default limit on the WebGL context count. But I don't see why exposing that limit as a flag for user modification would be a problem. This is an internal app, so we know what hardware is being used. Exposing the limit as a flag (with applicable warning text) would let folks tune this limit to a more appropriate value.

Comment 5 by kbr@chromium.org, Oct 5 2017

Labels: -Pri-3 Pri-2
OK, if adding an about:flags entry would work for your case we can easily make that change.

Comment 6 by ajha@chromium.org, Oct 26 2017

 Issue 778277  has been merged into this issue.

Comment 7 by brian...@gmail.com, Jan 5 2018

Did anything ever happen with this? KBR seemed to think this would be easy to do, but it doesn't look like the change was ever made.

Thanks,

Brian

Comment 8 by kbr@chromium.org, Jan 9 2018

Owner: kbr@chromium.org
Status: Assigned (was: Available)
Sorry for forgetting about this. Wiring it up now.

Comment 9 by brian...@gmail.com, May 3 2018

KBR, did this ever make it into a release? Thanks.

Comment 10 by kbr@chromium.org, May 4 2018

Sorry, I dropped this on the floor. Will try to push it over the finish line soon.

Comment 11 by brian...@gmail.com, Jun 27 2018

Don't mean to pester, @kbr, but any update on this? Thanks.

Comment 12 by kbr@chromium.org, Jun 30 2018

Status: Started (was: Assigned)
Sorry for dropping this again. https://chromium-review.googlesource.com/1073888 up for review implementing this.

Project Member

Comment 13 by bugdroid1@chromium.org, Jul 13

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/bfea76f48f8af2bd76157cfc0a025b3c81241777

commit bfea76f48f8af2bd76157cfc0a025b3c81241777
Author: Kenneth Russell <kbr@chromium.org>
Date: Fri Jul 13 20:15:45 2018

Make the maximum number of WebGL contexts configurable.

Bug:  771792 
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_layout_tests_slimming_paint_v2;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I34ffae8b8ff4d1372eedcdc0b6549bd68a521b84
Reviewed-on: https://chromium-review.googlesource.com/1073888
Reviewed-by: Antoine Labour <piman@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575044}
[modify] https://crrev.com/bfea76f48f8af2bd76157cfc0a025b3c81241777/content/public/browser/gpu_utils.cc
[modify] https://crrev.com/bfea76f48f8af2bd76157cfc0a025b3c81241777/gpu/config/gpu_feature_info.h
[modify] https://crrev.com/bfea76f48f8af2bd76157cfc0a025b3c81241777/gpu/config/gpu_preferences.h
[modify] https://crrev.com/bfea76f48f8af2bd76157cfc0a025b3c81241777/gpu/config/gpu_switches.cc
[modify] https://crrev.com/bfea76f48f8af2bd76157cfc0a025b3c81241777/gpu/config/gpu_switches.h
[modify] https://crrev.com/bfea76f48f8af2bd76157cfc0a025b3c81241777/gpu/config/gpu_util.cc
[modify] https://crrev.com/bfea76f48f8af2bd76157cfc0a025b3c81241777/gpu/ipc/common/gpu_feature_info.mojom
[modify] https://crrev.com/bfea76f48f8af2bd76157cfc0a025b3c81241777/gpu/ipc/common/gpu_feature_info_struct_traits.h
[modify] https://crrev.com/bfea76f48f8af2bd76157cfc0a025b3c81241777/gpu/ipc/common/gpu_preferences.mojom
[modify] https://crrev.com/bfea76f48f8af2bd76157cfc0a025b3c81241777/gpu/ipc/common/gpu_preferences_struct_traits.h
[modify] https://crrev.com/bfea76f48f8af2bd76157cfc0a025b3c81241777/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
[modify] https://crrev.com/bfea76f48f8af2bd76157cfc0a025b3c81241777/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h
[modify] https://crrev.com/bfea76f48f8af2bd76157cfc0a025b3c81241777/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc
[modify] https://crrev.com/bfea76f48f8af2bd76157cfc0a025b3c81241777/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h

Status: Fixed (was: Started)
This change is currently shipping in Chrome Canary, and using the attached manual test case and the command line flag --max-active-webgl-contexts I verified it's working. (The basic functionality was already covered under an existing automated context_lost test.)

webgl-contexts.html
1.5 KB View Download
@kbr, did this ever make it into vanilla Chrome? I don't see a flag or it on chrome://flags, and it's not clear whether the command line flag is actually doing something. Thanks.
Status: Verified (was: Fixed)
Yes, it's shipping in Chrome Stable as of Chrome 69 (see omahaproxy.appspot.com and plug in the commit hash from above.

Launching Chrome Stable (70.0.3538.110 (Official Build) (64-bit)) with this command line argument:

--max-active-webgl-contexts=32

increases the context limit per the test in #14.

Sign in to add a comment