Bug 80339 - [chromium] Notify CCLayerImpl tree of context loss and restoration
Summary: [chromium] Notify CCLayerImpl tree of context loss and restoration
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Kenneth Russell
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-05 15:30 PST by Kenneth Russell
Modified: 2012-03-05 20:15 PST (History)
5 users (show)

See Also:


Attachments
Patch (11.49 KB, patch)
2012-03-05 17:14 PST, Kenneth Russell
no flags Details | Formatted Diff | Diff
Patch (11.65 KB, patch)
2012-03-05 18:36 PST, Kenneth Russell
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Russell 2012-03-05 15:30:30 PST
There are some situations where CCLayerImpls don't use managed textures, typically because doing so would either be unwieldy or not really correct from an accounting standpoint. CCPluginLayerImpl, which is now used to render Core Animation plugins on Mac OS, is one example. http://crbug.com/113125 describes a situation where forcing loss of context while Flash is rendering causes bad breakage because the CCPluginLayerImpl continues to reference a stale texture ID. After offline discussion it sounds like the best solution is to give CCLayerImpls the possibility of explicitly responding to context loss and recreation.
Comment 1 Kenneth Russell 2012-03-05 17:14:36 PST
Created attachment 130241 [details]
Patch
Comment 2 James Robinson 2012-03-05 17:26:14 PST
Comment on attachment 130241 [details]
Patch

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

> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:712
> +    for (size_t i = 0; i < current->children().size(); ++i)

this won't hit mask and replica layers - is that OK (i.e. can plugins ever be masks or reflections or inside masks or reflections?). you can hit these by recurring on the mask/replica pointers in addition to children

we also have iterator types in CCLayerIterator.h. They are more complicated, but if you use them you don't need to worry about exactly how the tree structure is organized, you can just use the iterator and rely on it to hit everything
Comment 3 Dana Jansens 2012-03-05 17:31:55 PST
Comment on attachment 130241 [details]
Patch

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

>> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:712
>> +    for (size_t i = 0; i < current->children().size(); ++i)
> 
> this won't hit mask and replica layers - is that OK (i.e. can plugins ever be masks or reflections or inside masks or reflections?). you can hit these by recurring on the mask/replica pointers in addition to children
> 
> we also have iterator types in CCLayerIterator.h. They are more complicated, but if you use them you don't need to worry about exactly how the tree structure is organized, you can just use the iterator and rely on it to hit everything

The iterators need a Surface-Layer list from calcDrawTransformsEtc, so I'm not sure it's relevant here. This looks like a simple layer-tree walk.
Comment 4 Kenneth Russell 2012-03-05 17:38:33 PST
(In reply to comment #3)
> (From update of attachment 130241 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=130241&action=review
> 
> >> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:712
> >> +    for (size_t i = 0; i < current->children().size(); ++i)
> > 
> > this won't hit mask and replica layers - is that OK (i.e. can plugins ever be masks or reflections or inside masks or reflections?). you can hit these by recurring on the mask/replica pointers in addition to children
> > 
> > we also have iterator types in CCLayerIterator.h. They are more complicated, but if you use them you don't need to worry about exactly how the tree structure is organized, you can just use the iterator and rely on it to hit everything
> 
> The iterators need a Surface-Layer list from calcDrawTransformsEtc, so I'm not sure it's relevant here. This looks like a simple layer-tree walk.

Yes, looking at the uses of CCLayerIterator it looks like some other entity is responsible for building up the LayerList through which it iterates. I think this patch is what we want.
Comment 5 James Robinson 2012-03-05 17:49:50 PST
Comment on attachment 130241 [details]
Patch

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

>>>> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:712
>>>> +    for (size_t i = 0; i < current->children().size(); ++i)
>>> 
>>> this won't hit mask and replica layers - is that OK (i.e. can plugins ever be masks or reflections or inside masks or reflections?). you can hit these by recurring on the mask/replica pointers in addition to children
>>> 
>>> we also have iterator types in CCLayerIterator.h. They are more complicated, but if you use them you don't need to worry about exactly how the tree structure is organized, you can just use the iterator and rely on it to hit everything
>> 
>> The iterators need a Surface-Layer list from calcDrawTransformsEtc, so I'm not sure it's relevant here. This looks like a simple layer-tree walk.
> 
> Yes, looking at the uses of CCLayerIterator it looks like some other entity is responsible for building up the LayerList through which it iterates. I think this patch is what we want.

It's what you want if it's OK to skip masks and replicas (since they aren't in the children list) - is that the desired behavior or not?
Comment 6 Kenneth Russell 2012-03-05 18:15:21 PST
(In reply to comment #5)
> (From update of attachment 130241 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=130241&action=review
> 
> >>>> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:712
> >>>> +    for (size_t i = 0; i < current->children().size(); ++i)
> >>> 
> >>> this won't hit mask and replica layers - is that OK (i.e. can plugins ever be masks or reflections or inside masks or reflections?). you can hit these by recurring on the mask/replica pointers in addition to children
> >>> 
> >>> we also have iterator types in CCLayerIterator.h. They are more complicated, but if you use them you don't need to worry about exactly how the tree structure is organized, you can just use the iterator and rely on it to hit everything
> >> 
> >> The iterators need a Surface-Layer list from calcDrawTransformsEtc, so I'm not sure it's relevant here. This looks like a simple layer-tree walk.
> > 
> > Yes, looking at the uses of CCLayerIterator it looks like some other entity is responsible for building up the LayerList through which it iterates. I think this patch is what we want.
> 
> It's what you want if it's OK to skip masks and replicas (since they aren't in the children list) - is that the desired behavior or not?

Per our offline discussion it's a fair point that the recursion loop should probably traverse mask and replica layers. I was mainly talking about the complexity of building up a LayerList. New patch coming up.
Comment 7 Kenneth Russell 2012-03-05 18:36:26 PST
Created attachment 130261 [details]
Patch
Comment 8 James Robinson 2012-03-05 18:37:33 PST
Comment on attachment 130261 [details]
Patch

R=me
Comment 9 WebKit Review Bot 2012-03-05 20:15:44 PST
Comment on attachment 130261 [details]
Patch

Clearing flags on attachment: 130261

Committed r109839: <http://trac.webkit.org/changeset/109839>
Comment 10 WebKit Review Bot 2012-03-05 20:15:48 PST
All reviewed patches have been landed.  Closing bug.