summaryrefslogtreecommitdiffstats
path: root/mojo/services/surfaces/public/interfaces/surfaces.mojom
blob: caaddedef6784aeedfa68f6927089263a55b565d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// 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 "mojo/services/geometry/public/interfaces/geometry.mojom";
import "mojo/services/gpu/public/interfaces/command_buffer.mojom";
import "mojo/services/gpu/public/interfaces/viewport_parameter_listener.mojom";
import "mojo/services/surfaces/public/interfaces/quads.mojom";
import "mojo/services/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 {
  // The id's local field is allocated by the caller and must be unique. The
  // id_namespace field on the id may be 0 or this connection's namespace.
  CreateSurface(SurfaceId id);

  // 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(SurfaceId id, Frame frame) => ();
  DestroySurface(SurfaceId id);

  CreateGLES2BoundSurface(CommandBuffer gles2_client,
                          SurfaceId id,
                          Size size,
                          ViewportParameterListener& listener);
};