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";
44 using mozilla::hal::BatteryInformation from "mozilla/hal_sandbox/PHal.h";
49 struct LayerTreeIdMapping {
54 // This protocol allows the UI process to talk to the GPU process. There is one
55 // instance of this protocol, with the GPUParent living on the main thread of
56 // the GPU process and the GPUChild living on the main thread of the UI process.
57 [NeedsOtherPid, ParentProc=GPU, ChildProc=Parent]
61 // Sent by the UI process to initiate core settings.
62 async Init(GfxVarUpdate[] vars,
63 DevicePrefs devicePrefs,
64 LayerTreeIdMapping[] mapping,
65 GfxInfoFeatureStatus[] features,
66 uint32_t wrNamespace);
68 async InitCompositorManager(Endpoint<PCompositorManagerParent> endpoint, uint32_t aNamespace);
69 async InitVsyncBridge(Endpoint<PVsyncBridgeParent> endpoint);
70 async InitImageBridge(Endpoint<PImageBridgeParent> endpoint);
71 async InitVideoBridge(Endpoint<PVideoBridgeParent> endpoint, VideoBridgeSource aSource);
72 async InitVRManager(Endpoint<PVRManagerParent> endpoint);
73 async InitUiCompositorController(LayersId rootLayerTreeId, Endpoint<PUiCompositorControllerParent> endpoint);
74 async InitAPZInputBridge(LayersId layersId,
75 Endpoint<PAPZInputBridgeParent> endpoint);
76 async InitProfiler(Endpoint<PProfilerChild> endpoint);
77 // Forward GPU process its endpoints to the VR process.
78 async InitVR(Endpoint<PVRGPUChild> endpoint);
79 // Called to update a gfx variable.
80 async UpdateVar(GfxVarUpdate var);
82 async PreferenceUpdate(Pref pref);
83 async ScreenInformationChanged();
84 async NotifyBatteryInfo(BatteryInformation aBatteryInfo);
86 // Create a new content-process compositor bridge.
87 async NewContentCompositorManager(Endpoint<PCompositorManagerParent> endpoint, ContentParentId childId, uint32_t aNamespace);
88 async NewContentImageBridge(Endpoint<PImageBridgeParent> endpoint, ContentParentId childId);
89 async NewContentVRManager(Endpoint<PVRManagerParent> endpoint, ContentParentId childId);
90 async NewContentRemoteDecoderManager(Endpoint<PRemoteDecoderManagerParent> endpoint, ContentParentId childId);
92 // Called to notify the GPU process of who owns a layersId.
93 sync AddLayerTreeIdMapping(LayerTreeIdMapping mapping);
94 async RemoveLayerTreeIdMapping(LayerTreeIdMapping mapping);
96 // Request the current DeviceStatus from the GPU process. This blocks until
97 // one is available (i.e., Init has completed).
98 sync GetDeviceStatus() returns (GPUDeviceData status);
100 // Request to simulate device reset and to get the updated DeviceStatus from
101 // the GPU process. This blocks until one is available (i.e., Init has completed).
102 async SimulateDeviceReset();
104 // Have a message be broadcasted to the GPU process by the GPU process
106 async NotifyGpuObservers(nsCString aTopic);
108 async RequestMemoryReport(uint32_t generation,
110 bool minimizeMemoryUsage,
111 FileDescriptor? DMDFile)
112 returns (uint32_t aGeneration);
116 // Functions supporting PerfStats data collection.
117 async UpdatePerfStatsCollectionMask(uint64_t aMask);
118 async CollectPerfStatsJSON() returns (nsCString aStats);
120 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
121 async InitSandboxTesting(Endpoint<PSandboxTestingChild> aEndpoint);
124 // Tells the gpu process to flush any pending telemetry.
125 // Used in tests and ping assembly. Buffer contains bincoded Rust structs.
126 // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html
127 async FlushFOGData() returns (ByteBuf buf);
130 // Asks the gpu process to trigger test-only instrumentation.
131 // The unused returned value is to have a promise we can await.
132 async TestTriggerMetrics() returns (bool unused);
134 // Causes the GPU process to crash. Used for tests and diagnostics.
135 async CrashProcess();
138 // Sent when the GPU process has initialized devices. This occurs once, after
140 async InitComplete(GPUDeviceData data);
142 // Sent when APZ detects checkerboarding and apz checkerboard reporting is enabled.
143 async ReportCheckerboard(uint32_t severity, nsCString log);
145 // Graphics errors, analogous to PContent::GraphicsError
146 async GraphicsError(nsCString aError);
148 async InitCrashReporter(NativeThreadId threadId);
150 async CreateVRProcess();
151 async ShutdownVRProcess();
153 // Have a message be broadcasted to the UI process by the UI process
155 async NotifyUiObservers(nsCString aTopic);
157 // Messages for reporting telemetry to the UI process.
158 async AccumulateChildHistograms(HistogramAccumulation[] accumulations);
159 async AccumulateChildKeyedHistograms(KeyedHistogramAccumulation[] accumulations);
160 async UpdateChildScalars(ScalarAction[] actions);
161 async UpdateChildKeyedScalars(KeyedScalarAction[] actions);
162 async RecordChildEvents(ChildEventData[] events);
163 async RecordDiscardedData(DiscardedData data);
165 async DeclareStable();
166 async NotifyDeviceReset(GPUDeviceData status);
167 async NotifyOverlayInfo(OverlayInfo info);
168 async NotifySwapChainInfo(SwapChainInfo info);
169 async NotifyDisableRemoteCanvas();
170 async FlushMemory(nsString reason);
172 async AddMemoryReport(MemoryReport aReport);
174 // Update the UI process after a feature's status has changed. This is used
175 // outside of the normal startup flow.
176 async UpdateFeature(Feature aFeature, FeatureFailure aChange);
178 // Notify about:support/Telemetry that a fallback occurred.
179 async UsedFallback(Fallback aFallback, nsCString message);
181 async BHRThreadHang(HangDetails aDetails);
183 // Update the cached list of codec supported following a check in the
185 async UpdateMediaCodecsSupported(MediaCodecsSupported aSupported);
187 // Sent from time-to-time to limit the amount of telemetry vulnerable to loss
188 // Buffer contains bincoded Rust structs.
189 // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html
190 async FOGData(ByteBuf buf);
194 } // namespace mozilla