RESOLVED FIXED 84410
Terrible performance on http://alliances.commandandconquer.com/ and http://www.lordofultima.com/
https://bugs.webkit.org/show_bug.cgi?id=84410
Summary Terrible performance on http://alliances.commandandconquer.com/ and http://ww...
Simon Fraser (smfr)
Reported 2012-04-19 18:13:33 PDT
From <http://code.google.com/p/chromium/issues/detail?id=120871> URLs (if applicable): http://alliances.commandandconquer.com/en/ http://www.lordofultima.com/en/ Other browsers tested: Add OK or FAIL after other browsers where you have tested this issue: Safari 5: Firefox 4.x: OKAY (far better) IE 7/8/9: OKAY (far better) What steps will reproduce the problem? 1. go to a page mentioned above 2. start a game 3. ingame performance is really bad while IE and FF have solid 40 to 60 fps What is the expected result? Good performance with at least 30 fps. With the behaviour at this moment the games mentioned above cannot be played with Chrome, What happens instead? Laggy/choppy performance
Attachments
Part 1: use a geometry map to optimize absolute layer bounds (68.06 KB, patch)
2012-05-22 19:02 PDT, Simon Fraser (smfr)
no flags
Patch (75.68 KB, patch)
2012-05-24 16:53 PDT, Simon Fraser (smfr)
hyatt: review+
Radar WebKit Bug Importer
Comment 1 2012-04-19 18:14:17 PDT
Simon Fraser (smfr)
Comment 2 2012-04-19 18:27:22 PDT
Adding a single 3D transform to the page (to turn off overlap testing) takes the CPU usage from 100% to 30% on my machine, using the CC reduction in the chromium bug.
Simon Fraser (smfr)
Comment 3 2012-05-17 14:31:41 PDT
My plans here are to avoid O(N^2) behavior when computing absolute layer bounds to add to the overlap map by storing some data as we walk the layer tree that allows us to map to absolute coords more efficiently.
Adrienne Walker
Comment 4 2012-05-17 14:34:36 PDT
(In reply to comment #3) > My plans here are to avoid O(N^2) behavior when computing absolute layer bounds to add to the overlap map by storing some data as we walk the layer tree that allows us to map to absolute coords more efficiently. That sounds great. I've been having similar thoughts. As you modify what's going into the overlap map, can you see if this fixes the issue in bug 64201?
Simon Fraser (smfr)
Comment 5 2012-05-18 22:13:14 PDT
Ugh, layer->backgroundClipRect(rootRenderLayer(), 0, true) is also super-expensive.
Simon Fraser (smfr)
Comment 6 2012-05-19 07:56:33 PDT
Adrienne Walker
Comment 7 2012-05-19 14:25:56 PDT
(In reply to comment #6) > That was added in http://trac.webkit.org/changeset/91114 In retrospect, I'm pretty sure that we don't need to use temp clip bounds there, which would help immensely.
Simon Fraser (smfr)
Comment 8 2012-05-20 21:56:44 PDT
We do, because the cache rects are cached for painting (relative to repaint containers), and this rect is root-relative.
Simon Fraser (smfr)
Comment 9 2012-05-21 10:56:39 PDT
I think the best option here will be to cache both clipRects for painting, and absolute clip rects.
Adrienne Walker
Comment 10 2012-05-21 11:04:50 PDT
(In reply to comment #8) > We do, because the cache rects are cached for painting (relative to repaint containers), and this rect is root-relative. You said you were planning to store some transform data as you walked the tree; would be possible to reuse some of that data to transform cached clip rects into the right space? Alternatively, RenderLayer::localClipRect gets reused when calculating composited bounds, so maybe that's the extra one to cache.
Simon Fraser (smfr)
Comment 11 2012-05-22 19:02:47 PDT
Created attachment 143434 [details] Part 1: use a geometry map to optimize absolute layer bounds
Dave Hyatt
Comment 12 2012-05-23 10:48:36 PDT
Comment on attachment 143434 [details] Part 1: use a geometry map to optimize absolute layer bounds View in context: https://bugs.webkit.org/attachment.cgi?id=143434&action=review Overall looks nice. I'd like a bit of an explanation regarding why flipped blocks writing modes can't be dealt with. I'm a bit confused about that part. I thought offsetFromContainer did the right thing for those. > Source/WebCore/rendering/RenderGeometryMap.cpp:157 > + // The root get special treatment for fixed position Should be "The root gets" > Source/WebCore/rendering/RenderInline.cpp:1148 > + if (container->isBox() && container->style()->isFlippedBlocksWritingMode()) > + offsetDependsOnPoint = true; Confused regarding why you can't just flip (somewhere) to handle this. > Source/WebCore/rendering/RenderLayerCompositor.cpp:725 > +// absBounds = layer->renderer()->localToAbsoluteQuad(FloatRect(layer->localBoundingBox())).enclosingBoundingBox(); Probably shouldn't leave commented out code in. > Source/WebCore/rendering/RenderLayerCompositor.cpp:734 > - > + Whitespace. > Source/WebCore/rendering/RenderObject.cpp:2060 > + LayoutSize offset; > + if (container->hasOverflowClip()) > + offset = -toRenderBox(container)->scrolledContentOffset(); I'm a little confused about why this has to be special cased. > Source/WebCore/rendering/RenderObject.cpp:2062 > + bool isNonUniform = hasColumns() || (container->isBox() && container->style()->isFlippedBlocksWritingMode()); Is it really that hard to deal with flipped blocks? Don't you just have to flipForWritingMode along the correct axis? > Source/WebCore/rendering/RenderObject.h:885 > + // Pushes state onto RenderGeometryMap about how to map coordinates from this renderer to its condtainer, or ancestorToStopAt (whichever is encountered first). Typo. "condtainer" should be "container"
Simon Fraser (smfr)
Comment 13 2012-05-23 13:53:09 PDT
(In reply to comment #12) > > Source/WebCore/rendering/RenderObject.cpp:2060 > > + LayoutSize offset; > > + if (container->hasOverflowClip()) > > + offset = -toRenderBox(container)->scrolledContentOffset(); > > I'm a little confused about why this has to be special cased. I was following the code in RenderObject::mapLocalToContainer(). However, now I see that RenderObject::offsetFromContainer() takes the scroll offset into account, so perhaps we're doing it twice.
Simon Fraser (smfr)
Comment 14 2012-05-24 16:53:14 PDT
Simon Fraser (smfr)
Comment 15 2012-05-24 16:54:20 PDT
Fixed the patch in response to comments. The RenderObject mapping methods appear to never be called (because they are always overidden. Maybe they should ASSERT_NOT_REACHED?
Dave Hyatt
Comment 16 2012-05-25 11:14:36 PDT
Comment on attachment 143929 [details] Patch r=me. Should follow up with ASSERT_NOT_REACHED and clean those methods up in RenderObject in a future patch.
Simon Fraser (smfr)
Comment 17 2012-05-25 11:18:50 PDT
Followups: bug 87516, bug 87517.
Simon Fraser (smfr)
Comment 18 2012-05-25 14:43:01 PDT
Simon Fraser (smfr)
Comment 19 2012-05-25 15:56:32 PDT
The reduced testcase in the cr bug takes 25% CPU after fixes for this and bug 87212. It used to be 100%.
Adrienne Walker
Comment 20 2012-05-25 16:27:48 PDT
Comment on attachment 143929 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=143929&action=review > Source/WebCore/rendering/RenderGeometryMap.cpp:149 > + if (currStep->m_hasTransform) { > + // If this box has a transform, it acts as a fixed position container for fixed descendants, > + // and may itself also be fixed position. So propagate 'fixed' up only if this box is fixed position. > + inFixed &= currStep->m_isFixedPosition; How does this assignment work if inFixed starts false (which it's initialized to), but this layer has both a transform and is fixed position? Shouldn't inFixed be true in that case? I wonder if this should be "=" instead of "&=". This causes the test in the patch on bug 64201 to break.
Simon Fraser (smfr)
Comment 21 2012-05-25 16:45:00 PDT
(In reply to comment #20) > (From update of attachment 143929 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=143929&action=review > > > Source/WebCore/rendering/RenderGeometryMap.cpp:149 > > + if (currStep->m_hasTransform) { > > + // If this box has a transform, it acts as a fixed position container for fixed descendants, > > + // and may itself also be fixed position. So propagate 'fixed' up only if this box is fixed position. > > + inFixed &= currStep->m_isFixedPosition; > > How does this assignment work if inFixed starts false (which it's initialized to), but this layer has both a transform and is fixed position? Shouldn't inFixed be true in that case? I wonder if this should be "=" instead of "&=". That does look wrong. Please file a new bug. > This causes the test in the patch on bug 64201 to break. Yay, a testcase!
Adrienne Walker
Comment 22 2012-05-25 17:07:30 PDT
(In reply to comment #21) > (In reply to comment #20) > > (From update of attachment 143929 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=143929&action=review > > > > > Source/WebCore/rendering/RenderGeometryMap.cpp:149 > > > + if (currStep->m_hasTransform) { > > > + // If this box has a transform, it acts as a fixed position container for fixed descendants, > > > + // and may itself also be fixed position. So propagate 'fixed' up only if this box is fixed position. > > > + inFixed &= currStep->m_isFixedPosition; > > > > How does this assignment work if inFixed starts false (which it's initialized to), but this layer has both a transform and is fixed position? Shouldn't inFixed be true in that case? I wonder if this should be "=" instead of "&=". > > That does look wrong. Please file a new bug. Bug 64201 covers this. See the updated patch there.
Note You need to log in before you can comment on or make changes to this bug.