summaryrefslogtreecommitdiffstats
path: root/gfx/layers/ipc/PCompositorManager.ipdl
blob: 7d3bf7c23a77931b36d539ef2c0d229626908d46 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * vim: sw=2 ts=8 et :
 */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

include protocol PCanvasManager;
include protocol PCompositorBridge;
include LayersSurfaces;
include "mozilla/GfxMessageUtils.h";
include "mozilla/layers/WebRenderMessageUtils.h";

using struct mozilla::void_t from "mozilla/ipc/IPCCore.h";
using mozilla::TimeDuration from "mozilla/TimeStamp.h";
using mozilla::CSSToLayoutDeviceScale from "Units.h";
using mozilla::gfx::IntSize from "mozilla/gfx/2D.h";
[MoveOnly] using mozilla::ipc::SharedMemoryBasic::Handle from "mozilla/ipc/SharedMemoryBasic.h";
using mozilla::layers::CompositorOptions from "mozilla/layers/LayersMessageUtils.h";
using mozilla::wr::ExternalImageId from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::MemoryReport from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::WebRenderError from "mozilla/webrender/WebRenderTypes.h";
using mozilla::layers::SharedSurfacesMemoryReport from "mozilla/layers/SharedSurfacesMemoryReport.h";

namespace mozilla {
namespace layers {

struct WidgetCompositorOptions {
  CSSToLayoutDeviceScale scale;
  TimeDuration vsyncRate;
  CompositorOptions options;
  bool useExternalSurfaceSize;
  IntSize surfaceSize;
  uint64_t innerWindowId;
};

struct ContentCompositorOptions {
};

struct SameProcessWidgetCompositorOptions {
};

union CompositorBridgeOptions {
  ContentCompositorOptions;
  WidgetCompositorOptions;
  SameProcessWidgetCompositorOptions;
};

/**
 * The PCompositorManager protocol is the top-level protocol between the
 * compositor thread and the creators of compositors. It exists in the
 * following conditions:
 * - One PCompositorManager between the GPU process and each content process.
 *   If the GPU/UI processes are combined, there is one PCompositorManager
 *   between the combined GPU/UI process and each content process.
 * - One PCompositorManager between the GPU process and the UI process. If
 *   they are combined, there is still one PCompositorManager, but both the
 *   child and parent live in the same process.
 * The intention for this protocol is to facilitate communication with the
 * compositor thread for compositor data that is only shared once, rather than
 * per PCompositorBridge instance.
 */
[ManualDealloc, NeedsOtherPid]
sync protocol PCompositorManager
{
  manages PCompositorBridge;

parent:
  /**
   * There are three variants of a PCompositorBridge protocol, each of which can
   * only be created by certain processes and configurations:
   * - A "content" PCompositorBridge is requested by each content process,
   *   representing the drawable area for Web content.
   * - A "widget" PCompositorBridge is requested by the UI process for each
   *   "top level browser window" for chrome and such.
   * - A "same process widget" PCompositorBridge is requested by the combined
   *   GPU/UI process for each "top level browser window" as above.
   * See gfx/layers/ipc/PCompositorBridge.ipdl for more details.
   */
  async PCompositorBridge(CompositorBridgeOptions options);

  async AddSharedSurface(ExternalImageId aId, SurfaceDescriptorShared aDesc);
  async RemoveSharedSurface(ExternalImageId aId);
  async ReportSharedSurfacesMemory() returns (SharedSurfacesMemoryReport aReport);

  async NotifyMemoryPressure();

  async ReportMemory() returns (MemoryReport aReport);

  async InitCanvasManager(Endpoint<PCanvasManagerParent> endpoint);

child:
  async NotifyWebRenderError(WebRenderError error);
};

} // layers
} // mozilla