Bug 82107 - [chromium] When prepainting fails, tiles dirty rects may be cleared
Summary: [chromium] When prepainting fails, tiles dirty rects may be cleared
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dana Jansens
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-23 17:43 PDT by Dana Jansens
Modified: 2012-05-17 23:13 PDT (History)
8 users (show)

See Also:


Attachments
Patch (10.37 KB, patch)
2012-03-23 20:43 PDT, Dana Jansens
no flags Details | Formatted Diff | Diff
Patch (10.45 KB, patch)
2012-03-23 22:12 PDT, Dana Jansens
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dana Jansens 2012-03-23 17:43:57 PDT
[chromium] When prepainting fails, tiles dirty rects may be cleared
Comment 1 Dana Jansens 2012-03-23 20:36:26 PDT
This is a super yummy bug. If a layer was prepainting and failed halfway through, it would lose the dirty bit on all the tiles it had already looked at. But those tiles would also have a valid reserved texture and a textureId of 0.

These tiles are no longer considered dirty (even though they are) so they would get pushed to impl, but they have a textureId of 0 so they would not display.

Then when it went to paint the layer if it became visible, those tiles would not be invalid, or dirty. So they would not get updated and keep a textureId of 0 on the impl thread.

Once the tile became dirty thru invalidation, it would paint the invalidated region, leaving the rest black if it was able to do a partial update.

Simple fix: don't clear dirty rects until you know you're going to update the layer.
Comment 2 Dana Jansens 2012-03-23 20:43:51 PDT
Created attachment 133617 [details]
Patch
Comment 3 Adrienne Walker 2012-03-23 21:56:22 PDT
Comment on attachment 133617 [details]
Patch

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

> Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp:160
> +    bool hasTextureIdForTileAt(int i, int j)
> +    {
> +        return CCTiledLayerImpl::hasTextureIdForTileAt(i, j);
> +    }

You could shorten this and the function above to just "using CCTiledLayerImpl::hasTextureIdForTileAt;"

> Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp:505
> +    EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 0));

Was hasTileAt not enough? I would have expected the isValid call to fail during pushPropertiesTo if the textureId was zero.
Comment 4 Dana Jansens 2012-03-23 21:59:23 PDT
Comment on attachment 133617 [details]
Patch

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

>> Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp:160
>> +    }
> 
> You could shorten this and the function above to just "using CCTiledLayerImpl::hasTextureIdForTileAt;"

ah, nice.

>> Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp:505
>> +    EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 0));
> 
> Was hasTileAt not enough? I would have expected the isValid call to fail during pushPropertiesTo if the textureId was zero.

Yeh, it just checks the tile is present. And most tests are okay with that. Making this a condition would make those tests fail at present (lack of calling updater.update()).

bool CCTiledLayerImpl::hasTileAt(int i, int j) const { return m_tiler->tileAt(i, j); }
Comment 5 Dana Jansens 2012-03-23 22:12:50 PDT
Created attachment 133619 [details]
Patch

Using using.

I like having separate checks for hasTileAt() and hasTextureForTileAt(). It lets me check FALSE of the hasTileAt() separately so I can know that I didn't push a dirty texture (I noticed that we were in this situation because of this unit test).
Comment 6 Adrienne Walker 2012-03-23 22:14:37 PDT
(In reply to comment #4)
> (From update of attachment 133617 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=133617&action=review
> 
> >> Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp:505
> >> +    EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 0));
> > 
> > Was hasTileAt not enough? I would have expected the isValid call to fail during pushPropertiesTo if the textureId was zero.
> 
> Yeh, it just checks the tile is present. And most tests are okay with that. Making this a condition would make those tests fail at present (lack of calling updater.update()).
> 
> bool CCTiledLayerImpl::hasTileAt(int i, int j) const { return m_tiler->tileAt(i, j); }

Ah, right.  isValid would still succeed even if textureId is zero.  The texture doesn't care about whether it was allocated or not, just whether its token has been evicted yet.
Comment 7 WebKit Review Bot 2012-03-23 22:54:54 PDT
Comment on attachment 133619 [details]
Patch

Clearing flags on attachment: 133619

Committed r111978: <http://trac.webkit.org/changeset/111978>
Comment 8 WebKit Review Bot 2012-03-23 22:54:59 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Eric Penner 2012-05-17 23:13:47 PDT
This was yummy to track down indeed! ;) It looks like this was a knock-on from the lost-invalidations fix and then this fix didn't quite make it into m18.   I'm going to cherry-pick it.