1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 include GraphicsMessages;
7 include MemoryReportTypes;
10 include protocol PAPZInputBridge;
11 include protocol PCompositorManager;
12 include protocol PImageBridge;
13 include protocol PProfiler;
14 include protocol PVRGPU;
15 include protocol PVRManager;
16 include protocol PVideoBridge;
17 include protocol PVsyncBridge;
18 include protocol PUiCompositorController;
19 include protocol PRemoteDecoderManager;
21 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
22 include protocol PSandboxTesting;
25 include "mozilla/ipc/ByteBufUtils.h";
26 include "mozilla/layers/LayersMessageUtils.h";
28 using base::ProcessId from "base/process.h";
29 using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
30 using mozilla::dom::NativeThreadId from "mozilla/dom/NativeThreadId.h";
31 using mozilla::Telemetry::HistogramAccumulation from "mozilla/TelemetryComms.h";
32 using mozilla::Telemetry::KeyedHistogramAccumulation from "mozilla/TelemetryComms.h";
33 using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h";
34 using mozilla::Telemetry::KeyedScalarAction from "mozilla/TelemetryComms.h";
35 using mozilla::Telemetry::ChildEventData from "mozilla/TelemetryComms.h";
36 using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h";
37 using mozilla::gfx::Feature from "gfxFeature.h";
38 using mozilla::gfx::Fallback from "gfxFallback.h";
39 using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
40 using mozilla::layers::OverlayInfo from "mozilla/layers/OverlayInfo.h";
41 using mozilla::layers::SwapChainInfo from "mozilla/layers/OverlayInfo.h";
42 using mozilla::media::MediaCodecsSupported from "MediaCodecsSupport.h";
43 using mozilla::layers::VideoBridgeSource from "mozilla/layers/VideoBridgeUtils.h";
48 struct LayerTreeIdMapping {
53 // This protocol allows the UI process to talk to the GPU process. There is one
54 // instance of this protocol, with the GPUParent living on the main thread of
55 // the GPU process and the GPUChild living on the main thread of the UI process.
56 [NeedsOtherPid, ParentProc=GPU, ChildProc=Parent]
60 // Sent by the UI process to initiate core settings.
61 async Init(GfxVarUpdate[] vars,
62 DevicePrefs devicePrefs,
63 LayerTreeIdMapping[] mapping,
64 GfxInfoFeatureStatus[] features,
65 uint32_t wrNamespace);
67 async InitCompositorManager(Endpoint<PCompositorManagerParent> endpoint, uint32_t aNamespace);
68 async InitVsyncBridge(Endpoint<PVsyncBridgeParent> endpoint);
69 async InitImageBridge(Endpoint<PImageBridgeParent> endpoint);
70 async InitVideoBridge(Endpoint<PVideoBridgeParent> endpoint, VideoBridgeSource aSource);
71 async InitVRManager(Endpoint<PVRManagerParent> endpoint);
72 async InitUiCompositorController(LayersId rootLayerTreeId, Endpoint<PUiCompositorControllerParent> endpoint);
73 async InitAPZInputBridge(LayersId layersId,
74 Endpoint<PAPZInputBridgeParent> endpoint);
75 async InitProfiler(Endpoint<PProfilerChild> endpoint);
76 // Forward GPU process its endpoints to the VR process.
77 async InitVR(Endpoint<PVRGPUChild> endpoint);
78 // Called to update a gfx variable.
79 async UpdateVar(GfxVarUpdate var);
81 async PreferenceUpdate(Pref pref);
83 // Create a new content-process compositor bridge.
84 async NewContentCompositorManager(Endpoint<PCompositorManagerParent> endpoint, ContentParentId childId, uint32_t aNamespace);
85 async NewContentImageBridge(Endpoint<PImageBridgeParent> endpoint, ContentParentId childId);
86 async NewContentVRManager(Endpoint<PVRManagerParent> endpoint, ContentParentId childId);
87 async NewContentRemoteDecoderManager(Endpoint<PRemoteDecoderManagerParent> endpoint, ContentParentId childId);
89 // Called to notify the GPU process of who owns a layersId.
90 sync AddLayerTreeIdMapping(LayerTreeIdMapping mapping);
91 async RemoveLayerTreeIdMapping(LayerTreeIdMapping mapping);
93 // Request the current DeviceStatus from the GPU process. This blocks until
94 // one is available (i.e., Init has completed).
95 sync GetDeviceStatus() returns (GPUDeviceData status);
97 // Request to simulate device reset and to get the updated DeviceStatus from
98 // the GPU process. This blocks until one is available (i.e., Init has completed).
99 async SimulateDeviceReset();
101 // Have a message be broadcasted to the GPU process by the GPU process
103 async NotifyGpuObservers(nsCString aTopic);
105 async RequestMemoryReport(uint32_t generation,
107 bool minimizeMemoryUsage,
108 FileDescriptor? DMDFile)
109 returns (uint32_t aGeneration);
113 // Functions supporting PerfStats data collection.
114 async UpdatePerfStatsCollectionMask(uint64_t aMask);
115 async CollectPerfStatsJSON() returns (nsCString aStats);
117 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
118 async InitSandboxTesting(Endpoint<PSandboxTestingChild> aEndpoint);
121 // Tells the gpu process to flush any pending telemetry.
122 // Used in tests and ping assembly. Buffer contains bincoded Rust structs.
123 // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html
124 async FlushFOGData() returns (ByteBuf buf);
127 // Asks the gpu process to trigger test-only instrumentation.
128 // The unused returned value is to have a promise we can await.
129 async TestTriggerMetrics() returns (bool unused);
131 // Causes the GPU process to crash. Used for tests and diagnostics.
132 async CrashProcess();
135 // Sent when the GPU process has initialized devices. This occurs once, after
137 async InitComplete(GPUDeviceData data);
139 // Sent when APZ detects checkerboarding and apz checkerboard reporting is enabled.
140 async ReportCheckerboard(uint32_t severity, nsCString log);
142 // Graphics errors, analogous to PContent::GraphicsError
143 async GraphicsError(nsCString aError);
145 async InitCrashReporter(NativeThreadId threadId);
147 async CreateVRProcess();
148 async ShutdownVRProcess();
150 // Have a message be broadcasted to the UI process by the UI process
152 async NotifyUiObservers(nsCString aTopic);
154 // Messages for reporting telemetry to the UI process.
155 async AccumulateChildHistograms(HistogramAccumulation[] accumulations);
156 async AccumulateChildKeyedHistograms(KeyedHistogramAccumulation[] accumulations);
157 async UpdateChildScalars(ScalarAction[] actions);
158 async UpdateChildKeyedScalars(KeyedScalarAction[] actions);
159 async RecordChildEvents(ChildEventData[] events);
160 async RecordDiscardedData(DiscardedData data);
162 async DeclareStable();
163 async NotifyDeviceReset(GPUDeviceData status);
164 async NotifyOverlayInfo(OverlayInfo info);
165 async NotifySwapChainInfo(SwapChainInfo info);
166 async NotifyDisableRemoteCanvas();
167 async FlushMemory(nsString reason);
169 async AddMemoryReport(MemoryReport aReport);
171 // Update the UI process after a feature's status has changed. This is used
172 // outside of the normal startup flow.
173 async UpdateFeature(Feature aFeature, FeatureFailure aChange);
175 // Notify about:support/Telemetry that a fallback occurred.
176 async UsedFallback(Fallback aFallback, nsCString message);
178 async BHRThreadHang(HangDetails aDetails);
180 // Update the cached list of codec supported following a check in the
182 async UpdateMediaCodecsSupported(MediaCodecsSupported aSupported);
184 // Sent from time-to-time to limit the amount of telemetry vulnerable to loss
185 // Buffer contains bincoded Rust structs.
186 // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html
187 async FOGData(ByteBuf buf);
191 } // namespace mozilla