|  | // Copyright 2014 The Chromium Authors. All rights reserved. | 
|  | // Use of this source code is governed by a BSD-style license that can be | 
|  | // found in the LICENSE file. | 
|  |  | 
|  | module mojo; | 
|  |  | 
|  | import "geometry/public/interfaces/geometry.mojom"; | 
|  | import "gpu/public/interfaces/command_buffer.mojom"; | 
|  | import "gpu/public/interfaces/viewport_parameter_listener.mojom"; | 
|  | import "surfaces/public/interfaces/quads.mojom"; | 
|  | import "surfaces/public/interfaces/surface_id.mojom"; | 
|  |  | 
|  | enum ResourceFormat { | 
|  | RGBA_8888, | 
|  | RGBA_4444, | 
|  | BGRA_8888, | 
|  | ALPHA_8, | 
|  | LUMINANCE_8, | 
|  | RGB_565, | 
|  | ETC1, | 
|  | }; | 
|  |  | 
|  | struct Mailbox { | 
|  | array<int8, 64> name; | 
|  | }; | 
|  |  | 
|  | struct MailboxHolder { | 
|  | Mailbox mailbox; | 
|  | uint32 texture_target; | 
|  | uint32 sync_point; | 
|  | }; | 
|  |  | 
|  | struct TransferableResource { | 
|  | uint32 id; | 
|  | ResourceFormat format; | 
|  | uint32 filter; | 
|  | Size size; | 
|  | MailboxHolder mailbox_holder; | 
|  | bool is_repeated; | 
|  | bool is_software; | 
|  | }; | 
|  |  | 
|  | struct ReturnedResource { | 
|  | uint32 id; | 
|  | uint32 sync_point; | 
|  | int32 count; | 
|  | bool lost; | 
|  | }; | 
|  |  | 
|  | struct Frame { | 
|  | array<TransferableResource> resources; | 
|  | array<Pass> passes; | 
|  | }; | 
|  |  | 
|  | interface SurfaceClient { | 
|  | // This sets the id namespace for this connection. This method will be invoked | 
|  | // exactly once when a new connection is established. | 
|  | SetIdNamespace(uint32 id_namespace); | 
|  | ReturnResources(array<ReturnedResource> resources); | 
|  | }; | 
|  |  | 
|  | [Client=SurfaceClient] | 
|  | interface Surface { | 
|  | CreateSurface(uint32 id_local); | 
|  |  | 
|  | // The client can only submit frames to surfaces created with this | 
|  | // connection.  After the submitted frame is drawn for the first time, the | 
|  | // surface will respond to the SubmitFrame message. Clients should use this | 
|  | // acknowledgement to ratelimit frame submissions. | 
|  | SubmitFrame(uint32 id_local, Frame frame) => (); | 
|  | DestroySurface(uint32 id_local); | 
|  |  | 
|  | CreateGLES2BoundSurface(CommandBuffer gles2_client, | 
|  | uint32 id_local, | 
|  | Size size, | 
|  | ViewportParameterListener& listener); | 
|  | }; |