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"; | |
|
sky
2016/05/26 16:00:45
WDYT of putting these interfaces in a different na
Fady Samuel
2016/05/26 19:37:30
Moved to mus.gpu.mojom and moved mojoms. I've upda
| |
| 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 | |
|
sky
2016/05/26 16:00:45
nit: end with '.'
Fady Samuel
2016/05/26 19:37:30
Done.
| |
| 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 // TODO(fsamuel): We should support identifying the CF in the callback. | |
| 47 SubmitCompositorFrame(CompositorFrame frame) => | |
| 48 (CompositorFrameDrawStatus status); | |
| 49 | |
| 50 // Lets the display compositor know that the client wishes to receive the next | |
| 51 // BeginFrame event. | |
| 52 SetNeedsBeginFrame(bool needs_begin_frame); | |
| 53 | |
| 54 // TODO(fsamuel): ReadbackBitmap API would be useful here. | |
| 55 }; | |
| 56 | |
| 57 interface CompositorFrameSinkClient { | |
| 58 ReturnResources(array<ReturnedResource> resources); | |
| 59 }; | |
| 60 | |
| 61 // This is a public interface implemented by Display clients. | |
| 62 // Each client implements a single instance of the DisplayClient interface. | |
| 63 interface DisplayClient { | |
| 64 // Clients can register CompositorFrameSinks via the provided |factory|. | |
| 65 OnClientCreated(uint32 client_id, CompositorFrameSinkFactory factory); | |
| 66 | |
| 67 // TODO(fsamuel): OnBeginFrame needs to take a BeginFrameArgs instance per | |
| 68 // cc/output/begin_frame_args.h. | |
| 69 OnBeginFrame(); | |
| 70 }; | |
| OLD | NEW |