Chromium Code Reviews| 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 | |
|
rjkroege
2016/05/25 19:14:20
the client picks the nonce? Clients can lie. Shoul
Fady Samuel
2016/05/25 21:55:34
Privileged clients will pick a cryptographically s
| |
| 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. | |
|
rjkroege
2016/05/25 19:14:19
Why would the CompositorFrame be discarded?
Fady Samuel
2016/05/25 21:55:34
If the client is submitting frames faster than the
| |
| 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 interface DisplayClient { | |
|
rjkroege
2016/05/25 19:14:20
If only musws get OnRootClientCreated, why is this
Fady Samuel
2016/05/25 21:55:34
Things like OnBeginFrame would overlap. I don't wa
| |
| 62 // The Mus Window Server is a root client, and so it will receive this | |
| 63 // callback. There can only be one root CompositorFrameSink per Display and so | |
| 64 // it does not get a CompositorFrameSinkFactory. | |
| 65 OnRootClientCreated(CompositorFrameSink sink, | |
| 66 CompositorFrameSinkClient& client); | |
| 67 | |
| 68 // Non-root clients will receive this callback. Clients can create | |
| 69 // CompositorFrameSinks via the provided |factory|. | |
| 70 OnClientCreated(uint32 client_id, CompositorFrameSinkFactory factory); | |
|
rjkroege
2016/05/25 19:14:20
question for my education: mojom maps uint32 to ui
Fady Samuel
2016/05/25 21:55:34
Yes.
| |
| 71 | |
| 72 // TODO(fsamuel): Add BeginFrameArgs. | |
| 73 // See cc/output/begin_frame_args.h. | |
|
rjkroege
2016/05/25 19:14:20
words to the effect of "OnBeginFrame needs to take
Fady Samuel
2016/05/25 21:55:34
Acknowledged.
| |
| 74 OnBeginFrame(); | |
| 75 }; | |
| 76 | |
| 77 // This is a privileged API to be used only by the Mus Window Server. | |
| 78 // There is one Display per accelerated widget. This corresponds to a physical | |
| 79 // display on Chrome OS, and a window on other Chrome platforms. | |
| 80 interface Display { | |
| 81 // Each client (process) has a unique |client_id| and implements the | |
| 82 // DisplayClient interface. | |
| 83 CreateClient(uint32 client_id, DisplayClient& client); | |
|
rjkroege
2016/05/25 19:14:20
bike-shedding: CreateRootClient or CreateWindowTre
Fady Samuel
2016/05/25 21:55:34
This does not create a root client and it should n
| |
| 84 }; | |
| 85 | |
| 86 // This is a privileged API to be used only by the Mus Window Server. | |
| 87 // There should be only one DisplayCompositor connection. | |
| 88 interface DisplayCompositor { | |
| 89 CreateDisplay(int32 accelerated_widget, | |
| 90 Display& display, | |
| 91 DisplayClient client); | |
| 92 }; | |
| OLD | NEW |