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 // Submits a CompositorFrame to the display compositor that will be presented |
| 21 // to screen the next time frames from all CompositorFrameSinks are aggregated |
| 22 // to produce a display CompositorFrame. |
| 23 // For successful swaps, the implementation must call |
| 24 // DidReceiveCompositorFrameAck() asynchronously when the frame has been |
| 25 // processed in order to unthrottle the next frame. |
| 26 SubmitCompositorFrame(cc.mojom.CompositorFrame frame); |
| 27 |
26 // TODO(fsamuel): ReadbackBitmap API would be useful here. | 28 // TODO(fsamuel): ReadbackBitmap API would be useful here. |
27 }; | 29 }; |
28 | 30 |
29 interface MojoCompositorFrameSinkClient { | 31 interface MojoCompositorFrameSinkClient { |
30 ReturnResources(ReturnedResourceArray resources); | 32 // Notification that the previous CompositorFrame given to |
| 33 // SubmitCompositorFrame() has been processed and that another frame |
| 34 // can be submitted. This provides backpressure from the display compositor |
| 35 // so that frames are submitted only at the rate it can handle them. |
| 36 // TODO(fsamuel): This method ought not be necessary with unified BeginFrame. |
| 37 // However, there's a fair amount of cleanup and refactoring necessary to get |
| 38 // rid of it. |
| 39 DidReceiveCompositorFrameAck(); |
| 40 |
| 41 // Returns resources sent to SubmitCompositorFrame to be reused or freed. |
| 42 ReclaimResources(ReturnedResourceArray resources); |
31 }; | 43 }; |
OLD | NEW |