Bug 99220 - [chromium] Compositor frame metadata API
Summary: [chromium] Compositor frame metadata API
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexandre Elias
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-12 17:19 PDT by Alexandre Elias
Modified: 2013-04-15 08:51 PDT (History)
12 users (show)

See Also:


Attachments
Patch (5.80 KB, patch)
2012-10-12 17:30 PDT, Alexandre Elias
jamesr: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandre Elias 2012-10-12 17:19:14 PDT
[chromium] Compositor frame metadata API
Comment 1 Alexandre Elias 2012-10-12 17:30:11 PDT
Created attachment 168518 [details]
Patch
Comment 2 WebKit Review Bot 2012-10-12 17:33:29 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 Adam Barth 2012-10-12 17:41:29 PDT
Comment on attachment 168518 [details]
Patch

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

> Source/Platform/chromium/public/WebCompositorFrameMetadata.h:35
> +struct WebCompositorFrameMetadata {

Should this struct have a constructor that initializes the scalars?
Comment 4 Alexandre Elias 2012-10-12 17:45:57 PDT
I'm not sure that would provide a lot of value.  There will be exactly one piece of code producing these in the compositor.  We may as well omit the constructor for readability.
Comment 5 James Robinson 2012-10-14 20:26:07 PDT
This seems a bit weird.  Why isn't this sent along with the frame?  It looks like WebKit will not be producing or consuming this data, so why is it in a WebKit API?
Comment 6 Alexandre Elias 2012-10-14 20:45:32 PDT
Well, this information needs to arrive at RenderWidgetHost.  So my thinking is it would cover all cases:

- In non-ubercomp mode, the structure will be received by the renderer WebCompositorOutputSurface implementation and sent up via special IPC.
- In ubercomp mode, the structure will be included in the WebCompositorFrame subclass.  Then the browser CC implementation will call out to the browser WebCompositorOutputSurface implementation which will call the method on RenderWidgetHost.

I'm open to an alternative approach though.
Comment 7 Nat Duca 2012-10-15 10:24:55 PDT
I think you should find a way to make a single call that contains metadata and, in ubercomp mode, the frame data. Its seriously brain damaged to have two separate calls here... on many levels. One, its unintuitive, and two, its going to require two ipcs. Recall all the pain we've had in the past with ipcs causing descheds.
Comment 8 Alexandre Elias 2012-10-15 11:19:52 PDT
We've been shipping with these extra IPCs on M18 for a long time with some simple rate limiting in render_view_impl, it hasn't turned up as a cause of performance problems in a while.  We won't be shipping M24 with ubercomp so we need that as a stopgap.

Anyway, for the more important long-run use case, there's also the question of how best to send the metadata from CC to RenderWidgetHost.  For that, this would work, or we could do something like this alternate API:

class WebCompositorFrameMetadataObserver {
public:
  void didChangeFrameMetadata(const WebCompositorFrameMetadata&) = 0;
};

class WebLayerTreeView {
public:
...
  void registerFrameMetadataObserver(WebCompositorFrameMetadataObserver*);
...
};
Comment 9 James Robinson 2012-10-15 12:19:42 PDT
(In reply to comment #8)
> We've been shipping with these extra IPCs on M18 for a long time with some simple rate limiting in render_view_impl, it hasn't turned up as a cause of performance problems in a while.  We won't be shipping M24 with ubercomp so we need that as a stopgap.
> 
> Anyway, for the more important long-run use case, there's also the question of how best to send the metadata from CC to RenderWidgetHost.  For that, this would work, or we could do something like this alternate API:
> 
> class WebCompositorFrameMetadataObserver {
> public:
>   void didChangeFrameMetadata(const WebCompositorFrameMetadata&) = 0;
> };
> 
> class WebLayerTreeView {
> public:
> ...
>   void registerFrameMetadataObserver(WebCompositorFrameMetadataObserver*);
> ...
> };

I don't see why this has to touch WebKit APIs at all.  content/renderer provides the implementation of WebCompositorOutputSurface and the consumer of the frames, why not provide a subclass with more data and downcast where necessary?
Comment 10 Alexandre Elias 2012-10-15 12:23:57 PDT
There's an implementation of WebCompositorOutputSurface in the layout tests.  It doesn't care about the metadata but it would crash if you tried that downcast+call.
Comment 11 James Robinson 2012-10-15 12:30:17 PDT
content/... will never see that type.  In the DumpRenderTree case, DRT is providing the WebCompositorOutputSurface.
Comment 12 Alexandre Elias 2012-10-15 12:38:35 PDT
OK, now I understand your proposal better.

So we should change the GLRenderer and SoftwareRenderer to send out a WebCompositorFrame that only contains metadata and is otherwise empty?  That should work although seems a bit weird in itself.
Comment 13 Dana Jansens 2012-10-15 12:41:47 PDT
(In reply to comment #12)
> OK, now I understand your proposal better.
> 
> So we should change the GLRenderer and SoftwareRenderer to send out a WebCompositorFrame that only contains metadata and is otherwise empty?  That should work although seems a bit weird in itself.

Can it be refactored into cc::renderer perhaps?
Comment 14 James Robinson 2012-10-15 12:44:26 PDT
(In reply to comment #12)
> OK, now I understand your proposal better.
> 
> So we should change the GLRenderer and SoftwareRenderer to send out a WebCompositorFrame that only contains metadata and is otherwise empty?  That should work although seems a bit weird in itself.

We would only send metadata with real frames, wouldn't we?  I think it's in addition to a normal frame  not instead of.
Comment 15 James Robinson 2012-10-15 13:45:03 PDT
Comment on attachment 168518 [details]
Patch

We talked a bit offline and think we have an approach that doesn't require patching WebKit.