OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 module cc.mojom; | 5 module cc.mojom; |
6 | 6 |
7 import "cc/ipc/compositor_frame.mojom"; | 7 import "cc/ipc/compositor_frame.mojom"; |
8 import "cc/ipc/returned_resource.mojom"; | 8 import "cc/ipc/returned_resource.mojom"; |
9 | 9 |
10 // A MojoCompositorFrameSink is an interface for receiving CompositorFrame | 10 // A MojoCompositorFrameSink is an interface for receiving CompositorFrame |
11 // structs. A CompositorFrame contains the complete output meant for display. | 11 // structs. A CompositorFrame contains the complete output meant for display. |
12 // Each time a client has a graphical update, and receives an OnBeginFrame, it | 12 // Each time a client has a graphical update, and receives an OnBeginFrame, it |
13 // is responsible for creating a CompositorFrame to update its portion of the | 13 // is responsible for creating a CompositorFrame to update its portion of the |
14 // screen. | 14 // screen. |
15 interface MojoCompositorFrameSink { | 15 interface MojoCompositorFrameSink { |
16 // After the submitted frame is either drawn for the first time by the display | |
17 // compositor or discarded, the callback will be called. Clients should use | |
18 // this acknowledgement to ratelimit frame submissions. | |
19 // TODO(fsamuel): We should support identifying the CF in the callback. | |
20 SubmitCompositorFrame(cc.mojom.CompositorFrame frame) => (); | |
21 | |
22 // Lets the display compositor know that the client wishes to receive the next | 16 // Lets the display compositor know that the client wishes to receive the next |
23 // BeginFrame event. | 17 // BeginFrame event. |
24 SetNeedsBeginFrame(bool needs_begin_frame); | 18 SetNeedsBeginFrame(bool needs_begin_frame); |
25 | 19 |
20 // For successful swaps, the implementation must call | |
rjkroege
2016/10/20 21:33:17
this is top level documentation for how to use the
Fady Samuel
2016/10/20 23:04:10
Added more details.
| |
21 // DidReceiveCompositorFrameAck() asynchronously when the frame has been | |
22 // processed in order to unthrottle the next frame. | |
23 SubmitCompositorFrame(cc.mojom.CompositorFrame frame); | |
24 | |
26 // TODO(fsamuel): ReadbackBitmap API would be useful here. | 25 // TODO(fsamuel): ReadbackBitmap API would be useful here. |
27 }; | 26 }; |
28 | 27 |
29 interface MojoCompositorFrameSinkClient { | 28 interface MojoCompositorFrameSinkClient { |
30 ReturnResources(ReturnedResourceArray resources); | 29 // Notification that the previous CompositorFrame given to |
30 // SubmitCompositorFrame() has been processed and that another frame | |
31 // can be submitted. This provides backpressure from the display compositor | |
32 // so that frames are submitted only at the rate it can handle them. | |
33 DidReceiveCompositorFrameAck(); | |
rjkroege
2016/10/20 21:33:17
why do we have this given UBF? Let the compositor
Fady Samuel
2016/10/20 23:04:10
Added TODO.
| |
34 | |
35 // Returns resources sent to SubmitCompositorFrame to be reused or freed. | |
36 ReclaimResources(ReturnedResourceArray resources); | |
31 }; | 37 }; |
OLD | NEW |