Move GLES2, GPU & Surfaces into the ViewManager directory. This does not merge the...
[chromium-blink-merge.git] / components / view_manager / public / interfaces / surfaces.mojom
blob2413e77cbd3b99b453c019b163061ad7d430ebb9
1 // Copyright 2014 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.
5 module mojo;
7 import "components/view_manager/public/interfaces/quads.mojom";
8 import "components/view_manager/public/interfaces/surface_id.mojom";
9 import "ui/mojo/geometry/geometry.mojom";
11 enum ResourceFormat {
12   RGBA_8888,
13   RGBA_4444,
14   BGRA_8888,
15   ALPHA_8,
16   LUMINANCE_8,
17   RGB_565,
18   ETC1,
21 struct Mailbox {
22   array<int8, 64> name;
25 struct MailboxHolder {
26   Mailbox mailbox;
27   uint32 texture_target;
28   uint32 sync_point;
31 struct TransferableResource {
32   uint32 id;
33   ResourceFormat format;
34   uint32 filter;
35   Size size;
36   MailboxHolder mailbox_holder;
37   bool is_repeated;
38   bool is_software;
41 struct ReturnedResource {
42   uint32 id;
43   uint32 sync_point;
44   int32 count;
45   bool lost;
48 struct Frame {
49   array<TransferableResource> resources;
50   array<Pass> passes;
53 interface ResourceReturner {
54   ReturnResources(array<ReturnedResource> resources);
57 interface Surface {
58   // Request the id namespace for this connection. Fully qualified surface ids
59   // are the combination of the id_namespace for the connection that created the
60   // surface and the id_local component allocated by the caller.
61   GetIdNamespace() => (uint32 id_namespace);
63   // Sets a ResourceReturner that will receive unused resources.
64   SetResourceReturner(ResourceReturner returner);
66   // Creates a new surface with the given local identifier. Once a surface is
67   // created the caller may submit frames to it or destroy it using the local
68   // identifier. The caller can also produce a fully qualified surface id that
69   // can be embedded in frames produces by different connections.
70   CreateSurface(uint32 id_local);
72   // After the submitted frame is drawn for the first time, the surface will
73   // respond to the SubmitFrame message. Clients should use this acknowledgement
74   // to ratelimit frame submissions.
75   SubmitFrame(uint32 id_local, Frame frame) => ();
76   DestroySurface(uint32 id_local);