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