Closed Bug 1008216 Opened 11 years ago Closed 8 years ago

WebGL rendering is not performed fully parallel to JavaScript execution.

Categories

(Core :: Graphics: CanvasWebGL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jujjyl, Unassigned)

References

Details

(Whiteboard: [games] webgl-perf)

1. Visit https://dl.dropboxusercontent.com/u/40949268/Bugs/webl_parallelism_test.html 2. Follow the steps to repro on the page. Observed: When GPU is fully utilized, increasing CPU load also impacts GPU performance, indicating that a CPU-GPU sync point occurs each frame. In Firefox, when the GPU is fully saturated with work, each added millisecond of CPU work also increases the total rAF interval time, when instead it should be come "for free" while the GPU is being bottlenecked in rendering. To compare the behavior between browsers, I measured how many triangles and how much CPU work could be performed while targeting the 16.67 msec average rAF interval, and the results were: Firefox 29.0 and Firefox 32.0a1 (2014-05-09) performed identically: 65 triangles / 0 msecs of CPU work: rAF interval of 16.67 msecs 65 triangles / 10 msecs of CPU work: rAF interval of 40 msecs - here, each msec of added JS overhead also accounts to total frametime, instead of being processed while the GPU is busy working. Opera 21.0.1432.57: 100 triangles / 0 msecs of CPU work: rAF interval of 16.67 msecs 100 triangles / 14 msecs of CPU work: rAF interval of 16.67 msecs Chrome 34.0.1847.131 m: 100 triangles / 0 msecs of CPU work: rAF interval of 16.67 msecs 100 triangles / 14 msecs of CPU work: rAF interval of 16.67 msecs IE 11.0.9600.16521 update 11.0.4: 400 triangles / 0 msecs of CPU work: rAF interval of 16.67 msecs 400 triangles / 15 msecs of CPU work: rAF interval of 16.67 msecs The results indicate that Firefox is suffering from per-frame CPU-GPU sync points which cause the JavaScript execution and GPU rendering to occur sequentially, instead of in parallel. In comparison, other browsers perform pretty well, and CPU workload doesn't affect GPU performance. IE 11 performs most excellently here, and gives very stable rAF intervals where the CPU can fully operate while the GPU is rendering, and interestingly, the GPU is able to push through 6x more triangles. Expected: CPU and GPU should be able to perform work fully parallel when no pipeline sync operations are performed by the WebGL code.
Whiteboard: [games]
I'm also seeing the same issue occur on B2G devices, here's a phone-friendly version of the same page: https://dl.dropboxusercontent.com/u/40949268/Bugs/webgl_parallelism_test_mobile.html On my LG Leo device (B2G trunk "1.5" from late March), the behavior is identical to Firefox on Windows - increasing CPU workload hammers GPU performance, so it looks like CPU and GPU are syncing each frame. Firefox on OSX performs well, like other desktop browsers do - there isn't a sync occurring. Haven't tested on linux or Firefox on Android.
(In reply to Jukka Jylänki from comment #3) > The bug https://bugzilla.mozilla.org/show_bug.cgi?id=988573 is possibly > related. Not directly -- that's explicitly done due to a lack of synchronization on B2G, which is being fixed. This bug is about the same happening on desktop which is surprising.. though on windows we do have d3d9/d3d11 interop going on which could be hurting.
(In reply to Vladimir Vukicevic [:vlad] [:vladv] from comment #4) > (In reply to Jukka Jylänki from comment #3) > > The bug https://bugzilla.mozilla.org/show_bug.cgi?id=988573 is possibly > > related. > > Not directly -- that's explicitly done due to a lack of synchronization on > B2G, which is being fixed. This bug is about the same happening on desktop > which is surprising.. though on windows we do have d3d9/d3d11 interop going > on which could be hurting. Windows is currently one of our slowest platforms, since we need to use glFinish right now. We don't have another sync prim set up on Windows yet.
Also, B2G based on <17 versions of android will not get the new native fence sync stuff.
Jeff, do you know if the T2 Mobile FFOS reference phone is sufficiently new?
(In reply to Jukka Jylänki from comment #7) > Jeff, do you know if the T2 Mobile FFOS reference phone is sufficiently new? I do not know.
OS: Windows 7 → All
Hardware: x86 → All
Blocks: 1014011
No longer blocks: 1014011
Whiteboard: [games] → [games] webgl-perf
Testing this out in Firefox today, the blocking effect no longer occurs, so closing as fixed.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.