Bug 94145 - [chromium] Add the ubercomp WebDelegatedRendererLayer
Summary: [chromium] Add the ubercomp WebDelegatedRendererLayer
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: 95374 95485 95500
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-15 13:46 PDT by Dana Jansens
Modified: 2012-09-14 10:59 PDT (History)
13 users (show)

See Also:


Attachments
Patch (22.62 KB, patch)
2012-08-15 13:52 PDT, Dana Jansens
no flags Details | Formatted Diff | Diff
Patch (22.91 KB, patch)
2012-08-15 14:13 PDT, Dana Jansens
no flags Details | Formatted Diff | Diff
Patch (22.85 KB, patch)
2012-08-24 13:33 PDT, Dana Jansens
no flags Details | Formatted Diff | Diff
Patch (61.03 KB, patch)
2012-08-31 14:45 PDT, Dana Jansens
no flags Details | Formatted Diff | Diff
Patch (67.98 KB, patch)
2012-09-07 16:59 PDT, Dana Jansens
no flags Details | Formatted Diff | Diff
Patch (67.98 KB, patch)
2012-09-07 17:03 PDT, Dana Jansens
no flags Details | Formatted Diff | Diff
Patch (4.91 KB, patch)
2012-09-13 14:09 PDT, Dana Jansens
no flags Details | Formatted Diff | Diff
Patch (5.15 KB, patch)
2012-09-13 17:12 PDT, Dana Jansens
no flags Details | Formatted Diff | Diff
Patch for landing (5.15 KB, patch)
2012-09-14 10:35 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-08-15 13:46:42 PDT
[chromium] Add boilderplate for ubercomp DelegatingRendererLayer
Comment 1 Dana Jansens 2012-08-15 13:52:21 PDT
Created attachment 158633 [details]
Patch
Comment 2 WebKit Review Bot 2012-08-15 13:56:08 PDT
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 3 Peter Beverloo (cr-android ews) 2012-08-15 14:07:06 PDT
Comment on attachment 158633 [details]
Patch

Attachment 158633 [details] did not pass cr-android-ews (chromium-android):
Output: http://queues.webkit.org/results/13504713
Comment 4 Dana Jansens 2012-08-15 14:13:59 PDT
Created attachment 158635 [details]
Patch
Comment 5 Dana Jansens 2012-08-24 13:33:00 PDT
Created attachment 160489 [details]
Patch
Comment 6 Adrienne Walker 2012-08-27 10:05:33 PDT
Comment on attachment 160489 [details]
Patch

I'm confused why you want to land the boilerplate separately.  I mean, it seems likely that these classes are probably going to be the ones you need, but it's hard to review something with no functionality.
Comment 7 Dana Jansens 2012-08-27 10:06:50 PDT
Oh, okay. Just trying to keep patch sizes smaller and do this incrementally. I can do it along with stuff inside the layer instead.
Comment 8 Dana Jansens 2012-08-31 14:45:22 PDT
Created attachment 161781 [details]
Patch
Comment 9 Dana Jansens 2012-08-31 14:47:18 PDT
This is what I am picturing for the DRLayer. It has some tests showing what works (and the last test showing what doesn't yet).

It depends on the copy() mechanisms for quads and renderpasses, as well as the new renderpass id pair.

There's some fixmes in the CCDRLayerImpl.cpp file where things need to get filled in still. Also the logic in CCLTHI needs to be improved a bit..
Comment 10 Dana Jansens 2012-08-31 14:49:47 PDT
Rough design sketch is also available here, though it doesn't match 100% what came out in the end. https://docs.google.com/a/google.com/document/d/1R8HOhHD6fFsqtSmH6a9bSlMOruCu5ufF7p5Og-eQGTM/edit
Comment 11 Dana Jansens 2012-09-07 16:59:43 PDT
Created attachment 162908 [details]
Patch
Comment 12 Dana Jansens 2012-09-07 17:00:14 PDT
Here's a fully functioning ubercomp layer for your enjoyment :D
Comment 13 Dana Jansens 2012-09-07 17:03:26 PDT
Created attachment 162910 [details]
Patch

fixing a typo in assert
Comment 14 Adrienne Walker 2012-09-10 12:58:28 PDT
Comment on attachment 162910 [details]
Patch

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

In general, looks great.  A few minor nits:

> Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h:82
> +    void addContributingDelegatedRenderPassLayer(LayerChromium*) { }

Maybe add a comment about why this can be a no-op?

> Source/WebCore/platform/graphics/chromium/cc/CCDelegatedRendererLayerImpl.cpp:52
> +    // FIXME: This could possibly return false even though there are some
> +    // quads present as they could all be from a single layer (or set of
> +    // layers without children). If this happens, then make a test that
> +    // ensures the opacity is being changed on quads in the root RenderPass
> +    // when this layer doesn't own a RenderSurface.

Yeah, I think this is an ok false positive for now.  If that FIXME gets addressed, we're probably going to need to rename descendantDrawsContent, or split it up into the three different cases that CCLTHCommon is looking for when implicitly creating a render surface.

> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:321
> +                if (it->hasContributingDelegatedRenderPasses()) {

This block of code seriously needs at least a comment or two.

> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:322
> +                    for (size_t i = 0; i < frame.renderPasses.size(); ++i) {

Do you have to walk through every render pass here?

> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:325
> +                        if (renderPass == targetRenderPass)
> +                            continue;

This continue is because the delegated layer would have already been asked to append quads for its root pass as a part of whatever target that is drawing into?

> Source/WebKit/chromium/tests/CCDelegatedRendererLayerImplTest.cpp:90
> +class DrawingLayerImpl : public CCSolidColorLayerImpl {
> +public:
> +    static PassOwnPtr<DrawingLayerImpl> create(int id) { return adoptPtr(new DrawingLayerImpl(id)); }
> +protected:
> +    explicit DrawingLayerImpl(int id) : CCSolidColorLayerImpl(id) { setDrawsContent(true); }
> +};

Where does this get used?
Comment 15 Antoine Labour 2012-09-10 13:35:08 PDT
Comment on attachment 162910 [details]
Patch

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

Awesome!

> Source/WebKit/chromium/tests/CCDelegatedRendererLayerImplTest.cpp:190
> +    OwnPtr<CCDelegatedRendererLayerImpl> m_delegatedRendererLayer;

nit: it could be confusing to have all of these as members even though they're all NULL in tests. They could just be local variables in the constructor, right?

> Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp:2580
> +    delegatedRendererLayer->setLayerTreeHostImpl(m_hostImpl.get());

As is, this currently doesn't test much. How hard would it be to add non-trivial render passes to the delegatedRendererLayer here? I think CCDelegatedRendererLayerImpl would need to clear its render passes when losing the context (and wait for the next commit to get the new render passes).

> Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp:2714
> +    delegatedRendererLayer->setLayerTreeHostImpl(m_hostImpl.get());

Same here.
Comment 16 Dana Jansens 2012-09-13 14:04:28 PDT
(In reply to comment #14)
> (From update of attachment 162910 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=162910&action=review
> 
> In general, looks great.  A few minor nits:

ty!

> > Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h:82
> > +    void addContributingDelegatedRenderPassLayer(LayerChromium*) { }
> 
> Maybe add a comment about why this can be a no-op?

Sure.

> > Source/WebCore/platform/graphics/chromium/cc/CCDelegatedRendererLayerImpl.cpp:52
> > +    // FIXME: This could possibly return false even though there are some
> > +    // quads present as they could all be from a single layer (or set of
> > +    // layers without children). If this happens, then make a test that
> > +    // ensures the opacity is being changed on quads in the root RenderPass
> > +    // when this layer doesn't own a RenderSurface.
> 
> Yeah, I think this is an ok false positive for now.  If that FIXME gets addressed, we're probably going to need to rename descendantDrawsContent, or split it up into the three different cases that CCLTHCommon is looking for when implicitly creating a render surface.
> 
> > Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:321
> > +                if (it->hasContributingDelegatedRenderPasses()) {
> 
> This block of code seriously needs at least a comment or two.

k.

> > Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:322
> > +                    for (size_t i = 0; i < frame.renderPasses.size(); ++i) {
> 
> Do you have to walk through every render pass here?

No, we can do better.. It occurs to me that the RenderPass::id structure means we can just iterate by index and check contains() in the hash map to get them all.

> > Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:325
> > +                        if (renderPass == targetRenderPass)
> > +                            continue;
> 
> This continue is because the delegated layer would have already been asked to append quads for its root pass as a part of whatever target that is drawing into?

Yep.

> > Source/WebKit/chromium/tests/CCDelegatedRendererLayerImplTest.cpp:90
> > +class DrawingLayerImpl : public CCSolidColorLayerImpl {
> > +public:
> > +    static PassOwnPtr<DrawingLayerImpl> create(int id) { return adoptPtr(new DrawingLayerImpl(id)); }
> > +protected:
> > +    explicit DrawingLayerImpl(int id) : CCSolidColorLayerImpl(id) { setDrawsContent(true); }
> > +};
> 
> Where does this get used?

Right, I made everything use solid color layer to not need this. Removed.
(In reply to comment #15)
> (From update of attachment 162910 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=162910&action=review
> 
> Awesome!
> 
> > Source/WebKit/chromium/tests/CCDelegatedRendererLayerImplTest.cpp:190
> > +    OwnPtr<CCDelegatedRendererLayerImpl> m_delegatedRendererLayer;
> 
> nit: it could be confusing to have all of these as members even though they're all NULL in tests. They could just be local variables in the constructor, right?

Yeh true. Will do.

> > Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp:2580
> > +    delegatedRendererLayer->setLayerTreeHostImpl(m_hostImpl.get());
> 
> As is, this currently doesn't test much. How hard would it be to add non-trivial render passes to the delegatedRendererLayer here? I think CCDelegatedRendererLayerImpl would need to clear its render passes when losing the context (and wait for the next commit to get the new render passes).

Ya absolutely, thanks for pointing this out.

> > Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp:2714
> > +    delegatedRendererLayer->setLayerTreeHostImpl(m_hostImpl.get());
> 
> Same here.

Same :)
Comment 17 Dana Jansens 2012-09-13 14:09:02 PDT
Created attachment 163961 [details]
Patch

the WebDelegatedRendererLayer header for Platform/. the rest will move to src/cc
Comment 18 James Robinson 2012-09-13 15:23:14 PDT
Comment on attachment 163961 [details]
Patch

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

> Source/Platform/chromium/public/WebDelegatedRendererLayer.h:34
> +// This class represents a layer that renders the output of another
> +// delegating compositor.

Could you expand a bit on how this is used and what it does?

Do we even need this to be exposed in WebKit APIs?  I.e. would WebKit ever construct one of these, or would it only be created by the browser compositor?
Comment 19 Dana Jansens 2012-09-13 16:57:44 PDT
Comment on attachment 163961 [details]
Patch

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

>> Source/Platform/chromium/public/WebDelegatedRendererLayer.h:34
>> +// delegating compositor.
> 
> Could you expand a bit on how this is used and what it does?
> 
> Do we even need this to be exposed in WebKit APIs?  I.e. would WebKit ever construct one of these, or would it only be created by the browser compositor?

The layer holds a set of RenderPasses given to it from another compositor (via RenderWidgetHostViewAura). The current implementation of the layer is expecting to receive the passes directly on the impl thread so there's no methods here. If that changes (based on meeting just now it might) then we would add a setRenderPasses() method to this for the main thread to access from RWHVA.

In my foggy planning mind it is owned by a RenderWidgetViewHostAura. I figured it needs a Web version to create and own the layer, similar to a WebContentLayer or something in the UI. It would be a child of some other aura UI layer.

WebKit will never be constructing them (though I'm not sure where in WebKit we could possibly make one..WebView?).
Comment 20 James Robinson 2012-09-13 17:05:09 PDT
I meant to put that sort of information in a comment in the header file so people reading the file know what is going on.
Comment 21 Dana Jansens 2012-09-13 17:08:27 PDT
(In reply to comment #20)
> I meant to put that sort of information in a comment in the header file so people reading the file know what is going on.

Oh :)
Comment 22 Dana Jansens 2012-09-13 17:12:09 PDT
Created attachment 164005 [details]
Patch
Comment 23 Adrienne Walker 2012-09-14 10:32:50 PDT
Comment on attachment 164005 [details]
Patch

R=me.
Comment 24 Dana Jansens 2012-09-14 10:35:34 PDT
Created attachment 164186 [details]
Patch for landing
Comment 25 WebKit Review Bot 2012-09-14 10:59:19 PDT
Comment on attachment 164186 [details]
Patch for landing

Clearing flags on attachment: 164186

Committed r128630: <http://trac.webkit.org/changeset/128630>
Comment 26 WebKit Review Bot 2012-09-14 10:59:24 PDT
All reviewed patches have been landed.  Closing bug.