Bug 93305 - Add optional debug logging for tiled scrolling
Summary: Add optional debug logging for tiled scrolling
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-06 16:09 PDT by Tim Horton
Modified: 2012-08-09 10:31 PDT (History)
8 users (show)

See Also:


Attachments
patch (26.74 KB, patch)
2012-08-08 14:30 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
style (26.74 KB, patch)
2012-08-08 14:31 PDT, Tim Horton
simon.fraser: review-
Details | Formatted Diff | Diff
revised patch (27.92 KB, patch)
2012-08-08 16:10 PDT, Tim Horton
buildbot: commit-queue-
Details | Formatted Diff | Diff
humorously, fix mac build (28.24 KB, patch)
2012-08-08 18:43 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
negate the offset like it used to be (28.33 KB, patch)
2012-08-08 18:59 PDT, Tim Horton
simon.fraser: review-
Details | Formatted Diff | Diff
typo'd 'layer' for 'sublayer' (28.35 KB, patch)
2012-08-08 19:50 PDT, Tim Horton
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 2012-08-06 16:09:31 PDT
It'd be nice if we could log when painting can't keep up with tiled scrolling (i.e. the "white flash" (or black, as the case may be) that people see when they scroll too fast).
Comment 1 Tim Horton 2012-08-06 16:09:51 PDT
This can't use a log channel because it needs to work in release mode.
Comment 2 Tim Horton 2012-08-08 14:30:33 PDT
Created attachment 157297 [details]
patch
Comment 3 Tim Horton 2012-08-08 14:31:32 PDT
Created attachment 157298 [details]
style
Comment 4 Simon Fraser (smfr) 2012-08-08 14:48:29 PDT
Comment on attachment 157298 [details]
style

View in context: https://bugs.webkit.org/attachment.cgi?id=157298&action=review

> Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm:299
> +void ScrollingTreeNodeMac::logExposedUnfilledArea()

This needs a big scarey comment (or an assertion) about being called on the scrolling thread.

> Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm:301
> +    Region paintedTileCoveredVisibleRegion;

Too many adjectives!

> Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm:310
> +        NSArray* sublayers = [[layer sublayers] copy];

You're leaking the array.

> Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm:312
> +        for (CALayer* sublayer in sublayers)
> +            layerQueue.append(sublayer);

Not sure why you descend into sublayers here like this; can't you assume something about layer tree structure?

> Source/WebCore/platform/graphics/TiledBacking.h:45
> +    bool scrollingPerformanceLoggingEnabled() { return m_scrollingPerformanceLoggingEnabled; }

const please.

> Source/WebCore/platform/graphics/ca/mac/TileCache.h:72
> +    IntRect visibleRect() { return m_visibleRect; }
> +    unsigned blankPixelCount();

const please.

> Source/WebCore/platform/graphics/ca/mac/TileCache.mm:320
> +        RetainPtr<WebTileLayer>& tileLayer = it->second;

Probably simpler as WebTileLayer* tileLayer = it->second.get()

> Source/WebCore/platform/graphics/ca/mac/TileCache.mm:332
> +        IntRect visiblePart([tileLayer.get() frame]);
> +        visiblePart.intersect(m_visibleRect);
> +
> +        if(!visiblePart.isEmpty() && [tileLayer.get() repaintCount])
> +            paintedTileCoveredVisibleRegion.unite(visiblePart);
> +    }
> +
> +    Region uncoveredRegion(m_visibleRect);
> +    uncoveredRegion.subtract(paintedTileCoveredVisibleRegion);
> +
> +    return uncoveredRegion.totalArea();

This seems similar to the logExposedUnfilledArea() code. Why do you need both?

missing space after if

> Source/WebCore/platform/graphics/ca/mac/WebTileLayer.mm:68
> +- (unsigned)repaintCount
> +{
> +    return _repaintCount;
> +}

Do we waste cycles maintaining _repaintCount even when not showing counters?

> Source/WebCore/platform/graphics/ca/mac/WebTileLayer.mm:75
> +    if([self repaintCount] == 1 && !visiblePart.isEmpty())

Space after if
Comment 5 Tim Horton 2012-08-08 16:10:47 PDT
Created attachment 157321 [details]
revised patch
Comment 6 Tim Horton 2012-08-08 16:12:42 PDT
(In reply to comment #4)
> (From update of attachment 157298 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=157298&action=review
> 
> > Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm:299
> > +void ScrollingTreeNodeMac::logExposedUnfilledArea()
> 
> This needs a big scarey comment (or an assertion) about being called on the scrolling thread.

That whole file lives on the scrolling thread, as far as I can tell. It seems like this would be a bit out of place.

> Not sure why you descend into sublayers here like this; can't you assume something about layer tree structure?

The new patch assumes more, and won't crawl the whole tree, but I'm still not sure how to get straight to the tiles.

> This seems similar to the logExposedUnfilledArea() code. Why do you need both?

Fixed.

> Do we waste cycles maintaining _repaintCount even when not showing counters?

We do! We should file a bug, since that behavior already existed, and we should only maintain _repaintCount when scrolling performance logging or layer repaint counters are enabled.
Comment 7 Build Bot 2012-08-08 18:39:49 PDT
Comment on attachment 157321 [details]
revised patch

Attachment 157321 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/13462323
Comment 8 Tim Horton 2012-08-08 18:43:10 PDT
Created attachment 157362 [details]
humorously, fix mac build
Comment 9 Tim Horton 2012-08-08 18:59:14 PDT
Created attachment 157368 [details]
negate the offset like it used to be
Comment 10 Tim Horton 2012-08-08 19:50:42 PDT
Created attachment 157373 [details]
typo'd 'layer' for 'sublayer'
Comment 11 Simon Fraser (smfr) 2012-08-08 19:51:59 PDT
Comment on attachment 157368 [details]
negate the offset like it used to be

View in context: https://bugs.webkit.org/attachment.cgi?id=157368&action=review

> Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm:319
> +            break;

When you break here you still leak sublayers.
Comment 12 Tim Horton 2012-08-08 19:52:48 PDT
(In reply to comment #11)
> (From update of attachment 157368 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=157368&action=review
> 
> > Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm:319
> > +            break;
> 
> When you break here you still leak sublayers.

I caught that in my later patch (though failed to note that in my comment, hoping nobody would notice that patch :D).
Comment 13 Simon Fraser (smfr) 2012-08-08 19:58:07 PDT
Comment on attachment 157373 [details]
typo'd 'layer' for 'sublayer'

View in context: https://bugs.webkit.org/attachment.cgi?id=157373&action=review

> Source/WebCore/platform/graphics/ca/mac/TileCache.h:71
> +    IntRect visibleRect() { return m_visibleRect; }

const

> Source/WebCore/platform/graphics/ca/mac/TileCache.mm:317
> +    Vector<RetainPtr<WebTileLayer> > tiles(m_tiles.size());

Vector<RetainPtr<WebTileLayer> > could use a typedef.

> Source/WebCore/platform/graphics/ca/mac/TileCache.mm:323
> +unsigned TileCache::blankPixelCountForTiles(Vector<RetainPtr<WebTileLayer> > tiles, IntRect visibleRect, IntPoint tileTranslation)

Please pass the vector by const reference.

> Source/WebCore/platform/graphics/ca/mac/TileCache.mm:327
> +    for (Vector<RetainPtr<WebTileLayer> >::const_iterator it = tiles.begin(), end = tiles.end(); it != end; ++it) {

Does declaring end here work on all versions of gcc/clang we care about? We don't normally do it this way.
Comment 14 Tim Horton 2012-08-08 20:10:50 PDT
(In reply to comment #13)
> > Source/WebCore/platform/graphics/ca/mac/TileCache.mm:327
> > +    for (Vector<RetainPtr<WebTileLayer> >::const_iterator it = tiles.begin(), end = tiles.end(); it != end; ++it) {
> 
> Does declaring end here work on all versions of gcc/clang we care about? We don't normally do it this way.

Anders uses that in a few places in TileCache.mm; I'm pretty sure it works everywhere. I don't think it's an unusual feature. Perhaps we should use it more often :)

Thanks, Simon!
Comment 15 Tim Horton 2012-08-08 20:14:24 PDT
I'm going to let the Mac EWS finish before landing since it already found one build failure I don't see with my clang.
Comment 16 Tim Horton 2012-08-08 21:07:44 PDT
(In reply to comment #14)
> (In reply to comment #13)
> > > Source/WebCore/platform/graphics/ca/mac/TileCache.mm:327
> > > +    for (Vector<RetainPtr<WebTileLayer> >::const_iterator it = tiles.begin(), end = tiles.end(); it != end; ++it) {
> > 
> > Does declaring end here work on all versions of gcc/clang we care about? We don't normally do it this way.
> 
> Anders uses that in a few places in TileCache.mm; I'm pretty sure it works everywhere. I don't think it's an unusual feature. Perhaps we should use it more often :)
> 
> Thanks, Simon!

smfr: r still=you with s/currentTime/monotonicallyIncreasingTime/? :) (still waiting for ews and finding bugs where there are none)
Comment 17 Tim Horton 2012-08-09 00:27:07 PDT
http://trac.webkit.org/changeset/125156
Comment 18 Simon Fraser (smfr) 2012-08-09 10:31:57 PDT
Sure!