OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 module mus.mojom; | |
6 | |
7 import "components/mus/public/interfaces/compositor_frame.mojom"; | |
8 | |
9 // Indicates whether the submitted CompositorFrame has been drawn to the display | |
10 // or has been skipped (e.g. another frame may have been submitted before | |
11 // vblank). | |
12 enum CompositorFrameDrawStatus { | |
13 DRAW_SKIPPED, | |
14 DRAWN | |
15 }; | |
16 | |
17 // A CompositorFrameSinkFactory represents a single Display client. | |
18 // The client (a process) can use this interface to create | |
19 // CompositorFrameSinks. | |
20 // TODO(fsamuel): This needs a better name. | |
21 interface CompositorFrameSinkFactory { | |
22 // Requests a CompositorFrameSink interface from the display compositor. | |
23 // A CompositorFrameSink has an associated ID consisting of three components: | |
24 // 1. Namespace picked by the service associated with this | |
25 // CompositorFrameSinkFactory | |
26 // 2. |local_id| which is a monotonically increasing ID allocated by the | |
27 // client. | |
28 // 3. |nonce| is a cryptographically secure random number making this Sink | |
29 // unguessable by other clients. | |
30 CreateCompositorFrameSink(uint32 local_id, | |
31 uint64 nonce, | |
32 CompositorFrameSink& sink, | |
33 CompositorFrameSinkClient client); | |
34 }; | |
35 | |
36 // A CompositorFrameSink is an interface for receiving CompositorFrame structs. | |
37 // A CompositorFrame contains the complete output meant for display. Each time a | |
38 // client has a graphical update, and receives an OnBeginFrame, it is | |
39 // responsible for creating a CompositorFrame to update its portion of the | |
40 // screen. | |
41 interface CompositorFrameSink { | |
42 // After the submitted frame is either drawn for the first time by the display | |
43 // compositor or discarded, the callback will be called with the status of the | |
44 // submitted frame. Clients should use this acknowledgement to ratelimit frame | |
45 // submissions. | |
46 SubmitCompositorFrame(CompositorFrame frame) => | |
47 (CompositorFrameDrawStatus status); | |
48 | |
49 // Lets the display compositor know that the client wishes to receive the next | |
50 // BeginFrame event. | |
51 SetNeedsBeginFrame(bool needs_begin_frame); | |
52 | |
53 // TODO(fsamuel): ReadbackBitmap API would be useful here. | |
54 }; | |
55 | |
56 interface CompositorFrameSinkClient { | |
57 ReturnResources(array<ReturnedResource> resources); | |
58 }; | |
59 | |
60 // This is a public interface implemented by Display clients. | |
61 // Each client implements a single instance of the DisplayClient interface. | |
62 interface DisplayClient { | |
63 // The Mus Window Server is a root client, and so it will receive this | |
64 // callback. There can only be one root CompositorFrameSink per Display and so | |
65 // it does not get a CompositorFrameSinkFactory. | |
66 OnRootClientCreated(CompositorFrameSink sink, | |
67 CompositorFrameSinkClient& client); | |
68 | |
69 // Non-root clients will receive this callback. Clients can create | |
70 // CompositorFrameSinks via the provided |factory|. | |
71 OnClientCreated(uint32 client_id, CompositorFrameSinkFactory factory); | |
72 | |
73 // TODO(fsamuel): OnBeginFrame needs to take a BeginFrameArgs instance per | |
74 // cc/output/begin_frame_args.h. | |
75 OnBeginFrame(); | |
76 }; | |
77 | |
78 // This is a privileged API to be used only by the Mus Window Server. | |
rjkroege
2016/05/25 22:25:33
I thought we'd agreed that you'd split apart the m
Fady Samuel
2016/05/25 22:50:22
We did. Done.
| |
79 // There is one Display per accelerated widget. This corresponds to a physical | |
80 // display on Chrome OS, and a window on other Chrome platforms. | |
81 interface Display { | |
82 // Each client (process) has a unique |client_id| and implements the | |
83 // DisplayClient interface. | |
84 CreateClient(uint32 client_id, DisplayClient& client); | |
85 }; | |
86 | |
87 // This is a privileged API to be used only by the Mus Window Server. | |
88 // There should be only one DisplayCompositor connection. | |
89 interface DisplayCompositor { | |
90 CreateDisplay(int32 accelerated_widget, | |
91 Display& display, | |
92 DisplayClient client); | |
93 }; | |
OLD | NEW |