Chromium Code Reviews| 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 ui.gpu.mojom; | 5 module ui.gpu.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 | |
| 11 // Indicates whether the submitted CompositorFrame has been drawn to the display | |
| 12 // or has been skipped (e.g. another frame may have been submitted before | |
| 13 // vblank). | |
| 14 enum CompositorFrameDrawStatus { | |
| 15 DRAW_SKIPPED, | |
| 16 DRAWN | |
| 17 }; | |
| 18 | |
| 19 // A CompositorFrameSinkFactory represents a single Display client. | 10 // A CompositorFrameSinkFactory represents a single Display client. |
| 20 // The client (a process) can use this interface to create | 11 // The client (a process) can use this interface to create |
| 21 // CompositorFrameSinks. | 12 // CompositorFrameSinks. |
| 22 // TODO(fsamuel): This needs a better name. | 13 // TODO(fsamuel): This needs a better name. |
| 23 interface CompositorFrameSinkFactory { | 14 interface CompositorFrameSinkFactory { |
| 24 // Requests a CompositorFrameSink interface from the display compositor. | 15 // Requests a CompositorFrameSink interface from the display compositor. |
| 25 // A CompositorFrameSink has an associated ID consisting of three components: | 16 // A CompositorFrameSink has an associated ID consisting of three components: |
| 26 // 1. Namespace picked by the service associated with this | 17 // 1. Namespace picked by the service associated with this |
| 27 // CompositorFrameSinkFactory. | 18 // CompositorFrameSinkFactory. |
| 28 // 2. |local_id| which is a monotonically increasing ID allocated by the | 19 // 2. |local_id| which is a monotonically increasing ID allocated by the |
| 29 // client. | 20 // client. |
| 30 // 3. |nonce| is a cryptographically secure random number making this Sink | 21 // 3. |nonce| is a cryptographically secure random number making this Sink |
| 31 // unguessable by other clients. | 22 // unguessable by other clients. |
| 32 CreateCompositorFrameSink(uint32 local_id, | 23 CreateCompositorFrameSink(uint32 local_id, |
| 33 uint64 nonce, | 24 uint64 nonce, |
| 34 CompositorFrameSink& sink, | 25 CompositorFrameSink& sink, |
| 35 CompositorFrameSinkClient client); | 26 CompositorFrameSinkClient client); |
| 36 }; | 27 }; |
| 37 | 28 |
| 38 // A CompositorFrameSink is an interface for receiving CompositorFrame structs. | 29 // A CompositorFrameSink is an interface for receiving CompositorFrame structs. |
| 39 // A CompositorFrame contains the complete output meant for display. Each time a | 30 // A CompositorFrame contains the complete output meant for display. Each time a |
| 40 // client has a graphical update, and receives an OnBeginFrame, it is | 31 // client has a graphical update, and receives an OnBeginFrame, it is |
| 41 // responsible for creating a CompositorFrame to update its portion of the | 32 // responsible for creating a CompositorFrame to update its portion of the |
| 42 // screen. | 33 // screen. |
| 43 interface CompositorFrameSink { | 34 interface CompositorFrameSink { |
| 44 // After the submitted frame is either drawn for the first time by the display | 35 // After the submitted frame is either drawn for the first time by the display |
|
sky
2016/07/20 15:56:35
Update description.
Fady Samuel
2016/07/20 20:31:33
Done.
| |
| 45 // compositor or discarded, the callback will be called with the status of the | 36 // compositor or discarded, the callback will be called with the status of the |
| 46 // submitted frame. Clients should use this acknowledgement to ratelimit frame | 37 // submitted frame. Clients should use this acknowledgement to ratelimit frame |
| 47 // submissions. | 38 // submissions. |
| 48 // TODO(fsamuel): We should support identifying the CF in the callback. | 39 // TODO(fsamuel): We should support identifying the CF in the callback. |
| 49 SubmitCompositorFrame(cc.mojom.CompositorFrame frame) => | 40 SubmitCompositorFrame(cc.mojom.CompositorFrame frame) => (); |
| 50 (CompositorFrameDrawStatus status); | |
| 51 | 41 |
| 52 // Lets the display compositor know that the client wishes to receive the next | 42 // Lets the display compositor know that the client wishes to receive the next |
| 53 // BeginFrame event. | 43 // BeginFrame event. |
| 54 SetNeedsBeginFrame(bool needs_begin_frame); | 44 SetNeedsBeginFrame(bool needs_begin_frame); |
| 55 | 45 |
| 56 // TODO(fsamuel): ReadbackBitmap API would be useful here. | 46 // TODO(fsamuel): ReadbackBitmap API would be useful here. |
| 57 }; | 47 }; |
| 58 | 48 |
| 59 interface CompositorFrameSinkClient { | 49 interface CompositorFrameSinkClient { |
| 60 ReturnResources(array<cc.mojom.ReturnedResource> resources); | 50 ReturnResources(array<cc.mojom.ReturnedResource> resources); |
| 61 }; | 51 }; |
| 62 | 52 |
| 63 // This is a public interface implemented by Display clients. | 53 // This is a public interface implemented by Display clients. |
| 64 // Each client implements a single instance of the DisplayClient interface. | 54 // Each client implements a single instance of the DisplayClient interface. |
| 65 interface DisplayClient { | 55 interface DisplayClient { |
| 66 // Clients can register CompositorFrameSinks via the provided |factory|. | 56 // Clients can register CompositorFrameSinks via the provided |factory|. |
| 67 OnClientCreated(uint32 client_id, CompositorFrameSinkFactory factory); | 57 OnClientCreated(uint32 client_id, CompositorFrameSinkFactory factory); |
| 68 | 58 |
| 69 // TODO(fsamuel): OnBeginFrame needs to take a BeginFrameArgs instance per | 59 // TODO(fsamuel): OnBeginFrame needs to take a BeginFrameArgs instance per |
| 70 // cc/output/begin_frame_args.h. | 60 // cc/output/begin_frame_args.h. |
| 71 OnBeginFrame(); | 61 OnBeginFrame(); |
| 72 }; | 62 }; |
| OLD | NEW |