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

Issue 608873 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocked on:
issue 608576

Blocking:
issue 606676
issue 663197



Sign in to add a comment

Marking WebGL canvas as changed can be slow

Project Member Reported by vmi...@chromium.org, May 3 2016

Issue description

Version: r390575
OS: All

We call WebGLRenderingContextBase::markContextChanged for all WebGL commands that result in frame buffer changes such as ::clear() and ::drawArrays().

On the Animometer WebGL test which does many small draw calls, this marking accounts for 5~10% of the main thread runtime.

This stack may benefit from an early out, when a <canvas> has already been marked changed in the current frame.

 -> blink::WebGLRenderingContextBase::markContextChanged
 -> blink::LayoutBoxModelObject::contentChanged
 -> blink::PaintLayer::contentChanged
 -> blink::CompositedLayerMapping::contentChanged
 -> blink::GraphicsLayer::setContentNeedsDisplay
 -> cc_blink::WebLayerImpl::invalidate()
 -> cc::TextureLayer::SetNeedsDisplayRect
 -> ...

Repro instructions:

1) Visit https://pr.gg/animometer/developer.html
2) Select from Suites: 3D Graphics > WebGL
3) Run benchmark.
 
Blocking: 606676
Labels: -Type-Bug -Pri-3 Pri-2 Type-Feature
Owner: bajones@chromium.org
Status: Started (was: Available)

Comment 3 by kbr@chromium.org, May 10 2016

Blockedon: 608576
Blocking this on  Issue 608576  since the performance test will be added under that bug.

Comment 4 by dk...@chromium.org, May 20 2016

What's the status here now that 608576 is resolved?
bajones@ Any luck here?

Comment 6 by kbr@chromium.org, Oct 6 2016

Owner: kbr@chromium.org
Status: Assigned (was: Started)
I'll take this from Brandon.

https://codereview.chromium.org/1947763002/ was the work-in-progress.

Comment 7 by kbr@chromium.org, Nov 8 2016

Blocking: 663197

Comment 8 by kbr@chromium.org, Nov 16 2016

Owner: kainino@chromium.org
Kai, could you take on the investigation of this bug? We need to start with Brandon's old patch and see why it was failing the printing layout tests.

Status: Started (was: Assigned)
I have a passing version of the patch here:

https://codereview.chromium.org/2510583004/

I haven't seen any performance changes (tested teapots demo from 638085, as well as animometer), but I haven't yet run any profiling.
FTR, that patch landed but didn't post a message in this bug, for some reason.
https://codereview.chromium.org/2510583004

Leaving open at least until we figure out whether it had an effect. I've started some work on profiling it and will post results here.

Comment 11 by kbr@chromium.org, Dec 2 2016

Thanks Kai for updating. I also found that comments aren't being applied to bugs when CLs land and filed Issue 670756 about it.

On my desktop it turns out the Animometer is now GPU-process bound (which used to not be true), hence no difference in the framerate.

For the following benchmark, I was able to measure some performance differences in about:tracing.
http://browserbench.org/MotionMark/developer.html?test-interval=30&display=minimal&tiles=big&controller=fixed&frame-rate=50&kalman-process-error=1&kalman-measurement-error=4&time-measurement=performance&suite-name=3DGraphics&test-name=WebGL&complexity=5000

Without patch: avg time in v8::Execute: 8.712 ms
With    patch: avg time in v8::Execute: 7.494 ms

For the aquarium demo
http://webglsamples.org/aquarium/aquarium.html
cranked up to 10,000 fish, I _may_ have seen a small performance improvement (roughly 50 -> 53 FPS), but the variance is very high so it's hard to measure.

I haven't yet managed to run profiling that can see anything in markContextChanged, though.

Comment 13 by kbr@chromium.org, Dec 6 2016

Thanks for following up Kai. Good investigation.

If it seems like we're facing diminishing returns in this investigation please feel free to close this as fixed.

I'd like to at least have a concrete result for the actual performance of markContextChanged before closing it. It shouldn't be that hard but I need to figure out how to get a more detailed profile. (Victor mentioned setting enable_profiling = true.)
Project Member

Comment 15 by bugdroid1@chromium.org, Apr 3 2017

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

commit 5f8b467781b1b08d611e1d05f31c10dee5538edb
Author: capn <capn@chromium.org>
Date: Mon Apr 03 21:16:06 2017

Fix non-anti-aliased frame update.

m_contentsCangeCommitted (now renamed to m_contentsChangeResolved) was
not getting set on non-anti-aliased DrawingBuffers, causing us to always
skip setting m_animationFrameInProgress to true. This in turn skips
calling glReadPixels() for CPU-composited frames.

BUG= 707298 , 608873 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2793653002
Cr-Commit-Position: refs/heads/master@{#461542}

[modify] https://crrev.com/5f8b467781b1b08d611e1d05f31c10dee5538edb/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
[modify] https://crrev.com/5f8b467781b1b08d611e1d05f31c10dee5538edb/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h

Project Member

Comment 16 by bugdroid1@chromium.org, Apr 14 2017

Labels: merge-merged-3029
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3c777beab66117a31006f039de191c9a9dccefc7

commit 3c777beab66117a31006f039de191c9a9dccefc7
Author: Kenneth Russell <kbr@chromium.org>
Date: Fri Apr 14 23:04:29 2017

Fix non-anti-aliased frame update.

m_contentsCangeCommitted (now renamed to m_contentsChangeResolved) was
not getting set on non-anti-aliased DrawingBuffers, causing us to always
skip setting m_animationFrameInProgress to true. This in turn skips
calling glReadPixels() for CPU-composited frames.

BUG= 707298 , 608873 
TBR=kbr@chromium.org
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2793653002
Cr-Commit-Position: refs/heads/master@{#461542}
(cherry picked from commit 5f8b467781b1b08d611e1d05f31c10dee5538edb)

Review-Url: https://codereview.chromium.org/2810333009 .
Cr-Commit-Position: refs/branch-heads/3029@{#724}
Cr-Branched-From: 939b32ee5ba05c396eef3fd992822fcca9a2e262-refs/heads/master@{#454471}

[modify] https://crrev.com/3c777beab66117a31006f039de191c9a9dccefc7/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
[modify] https://crrev.com/3c777beab66117a31006f039de191c9a9dccefc7/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h

Labels: -Type-Feature OS-All Type-Bug
Status: Fixed (was: Started)
Finally came back to this and did some profiling with a Chrome profiling build. I ran Animometer for about 1 minute with and without my patch (#10). Results seem good:
                                              | unpatched     | patched
WebGLRenderingContextBase::MarkContextChanged | 0.44% / 0.52% | not in profile
WebGLRenderingContextBase::drawArrays         | 0.46% / 4.36% | 0.62% / 3.21%

(First number is in the function, second number is in the function and its children, I think.)

Comment 18 by kbr@chromium.org, May 23 2017

Great Kai! Thanks for pushing this over the finish line.

Sign in to add a comment