summaryrefslogtreecommitdiffstats
path: root/components/view_manager/public/interfaces/command_buffer.mojom
blob: 9a5bc39ea3b7e50321743224e2b6f04e5740be55 (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
// 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 "components/view_manager/public/interfaces/gpu_capabilities.mojom";
import "ui/mojo/geometry/geometry.mojom";

struct CommandBufferState {
  int32 num_entries;
  int32 get_offset;
  int32 put_offset;
  int32 token;
  int32 error;  // TODO(piman): enum
  int32 context_lost_reason;  // TODO(piman): enum
  uint32 generation;
};

interface CommandBufferSyncClient {
  DidInitialize(bool success, GpuCapabilities capabilities);
  DidMakeProgress(CommandBufferState state);
};

interface CommandBufferSyncPointClient {
  DidInsertSyncPoint(uint32 sync_point);
};

interface CommandBufferLostContextObserver {
  DidLoseContext(int32 context_lost_reason);
};

interface CommandBuffer {
  // Initialize attempts to initialize the command buffer. Success or failure
  // will be communicated via the CommandBufferSyncClient DidInitialize() call.
  // If the context is lost after creation the LostContext method on the
  // CommandBufferLostContextObserver's will be called then this pipe will be
  // closed.
  Initialize(CommandBufferSyncClient sync_client,
             CommandBufferSyncPointClient sync_point_client,
             CommandBufferLostContextObserver lost_observer,
             handle<shared_buffer> shared_state);
  SetGetBuffer(int32 buffer);
  Flush(int32 put_offset);
  MakeProgress(int32 last_get_offset);
  RegisterTransferBuffer(
      int32 id, handle<shared_buffer> transfer_buffer, uint32 size);
  DestroyTransferBuffer(int32 id);

  // InsertSyncPoint returns the sync point returned via DidInsertSyncPoint.
  // If |retire| is true, the sync point is retired on insertion. Otherwise,
  // explicitly call RetireSyncPoint to retire it.
  InsertSyncPoint(bool retire);
  RetireSyncPoint(uint32 sync_point);
  Echo() => ();

  CreateImage(int32 id,
              handle memory_handle,
              int32 type,
              Size size,
              int32 format,
              int32 internal_format);
  DestroyImage(int32 id);
};