Bug 1890689 accumulate input in LargerReceiverBlockSizeThanDesiredBuffering GTest...
[gecko.git] / gfx / ipc / GPUParent.h
blob4c01761e77d4bde1dacec1b3cb8b56c13d7927c7
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef _include_gfx_ipc_GPUParent_h__
7 #define _include_gfx_ipc_GPUParent_h__
9 #include "mozilla/RefPtr.h"
10 #include "mozilla/gfx/PGPUParent.h"
11 #include "mozilla/ipc/AsyncBlockers.h"
12 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
13 # include "mozilla/PSandboxTestingChild.h"
14 #endif
16 namespace mozilla {
18 class TimeStamp;
19 class ChildProfilerController;
21 namespace gfx {
23 class VsyncBridgeParent;
25 class GPUParent final : public PGPUParent {
26 public:
27 NS_INLINE_DECL_REFCOUNTING(GPUParent, final)
29 GPUParent();
31 static GPUParent* GetSingleton();
33 ipc::AsyncBlockers& AsyncShutdownService() { return mShutdownBlockers; }
35 // Gets the name of the GPU process, in the format expected by about:memory.
36 // There must be a GPU process active, and the caller must be either in that
37 // process or the parent process.
38 static void GetGPUProcessName(nsACString& aStr);
40 // Check for memory pressure and notify the parent process if necessary.
41 static bool MaybeFlushMemory();
43 bool Init(mozilla::ipc::UntypedEndpoint&& aEndpoint,
44 const char* aParentBuildID);
45 void NotifyDeviceReset();
46 void NotifyOverlayInfo(layers::OverlayInfo aInfo);
47 void NotifySwapChainInfo(layers::SwapChainInfo aInfo);
48 void NotifyDisableRemoteCanvas();
50 mozilla::ipc::IPCResult RecvInit(nsTArray<GfxVarUpdate>&& vars,
51 const DevicePrefs& devicePrefs,
52 nsTArray<LayerTreeIdMapping>&& mappings,
53 nsTArray<GfxInfoFeatureStatus>&& features,
54 uint32_t wrNamespace);
55 mozilla::ipc::IPCResult RecvInitCompositorManager(
56 Endpoint<PCompositorManagerParent>&& aEndpoint, uint32_t aNamespace);
57 mozilla::ipc::IPCResult RecvInitVsyncBridge(
58 Endpoint<PVsyncBridgeParent>&& aVsyncEndpoint);
59 mozilla::ipc::IPCResult RecvInitImageBridge(
60 Endpoint<PImageBridgeParent>&& aEndpoint);
61 mozilla::ipc::IPCResult RecvInitVideoBridge(
62 Endpoint<PVideoBridgeParent>&& aEndpoint,
63 const layers::VideoBridgeSource& aSource);
64 mozilla::ipc::IPCResult RecvInitVRManager(
65 Endpoint<PVRManagerParent>&& aEndpoint);
66 mozilla::ipc::IPCResult RecvInitVR(Endpoint<PVRGPUChild>&& aVRGPUChild);
67 mozilla::ipc::IPCResult RecvInitUiCompositorController(
68 const LayersId& aRootLayerTreeId,
69 Endpoint<PUiCompositorControllerParent>&& aEndpoint);
70 mozilla::ipc::IPCResult RecvInitAPZInputBridge(
71 const LayersId& aRootLayerTreeId,
72 Endpoint<PAPZInputBridgeParent>&& aEndpoint);
73 mozilla::ipc::IPCResult RecvInitProfiler(
74 Endpoint<PProfilerChild>&& aEndpoint);
75 mozilla::ipc::IPCResult RecvUpdateVar(const GfxVarUpdate& pref);
76 mozilla::ipc::IPCResult RecvPreferenceUpdate(const Pref& pref);
77 mozilla::ipc::IPCResult RecvScreenInformationChanged();
78 mozilla::ipc::IPCResult RecvNotifyBatteryInfo(
79 const BatteryInformation& aBatteryInfo);
80 mozilla::ipc::IPCResult RecvNewContentCompositorManager(
81 Endpoint<PCompositorManagerParent>&& aEndpoint,
82 const ContentParentId& aChildId, uint32_t aNamespace);
83 mozilla::ipc::IPCResult RecvNewContentImageBridge(
84 Endpoint<PImageBridgeParent>&& aEndpoint,
85 const ContentParentId& aChildId);
86 mozilla::ipc::IPCResult RecvNewContentVRManager(
87 Endpoint<PVRManagerParent>&& aEndpoint, const ContentParentId& aChildId);
88 mozilla::ipc::IPCResult RecvNewContentRemoteDecoderManager(
89 Endpoint<PRemoteDecoderManagerParent>&& aEndpoint,
90 const ContentParentId& aChildId);
91 mozilla::ipc::IPCResult RecvGetDeviceStatus(GPUDeviceData* aOutStatus);
92 mozilla::ipc::IPCResult RecvSimulateDeviceReset();
93 mozilla::ipc::IPCResult RecvAddLayerTreeIdMapping(
94 const LayerTreeIdMapping& aMapping);
95 mozilla::ipc::IPCResult RecvRemoveLayerTreeIdMapping(
96 const LayerTreeIdMapping& aMapping);
97 mozilla::ipc::IPCResult RecvNotifyGpuObservers(const nsCString& aTopic);
98 mozilla::ipc::IPCResult RecvRequestMemoryReport(
99 const uint32_t& generation, const bool& anonymize,
100 const bool& minimizeMemoryUsage,
101 const Maybe<ipc::FileDescriptor>& DMDFile,
102 const RequestMemoryReportResolver& aResolver);
103 mozilla::ipc::IPCResult RecvShutdownVR();
105 mozilla::ipc::IPCResult RecvUpdatePerfStatsCollectionMask(
106 const uint64_t& aMask);
107 mozilla::ipc::IPCResult RecvCollectPerfStatsJSON(
108 CollectPerfStatsJSONResolver&& aResolver);
110 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
111 mozilla::ipc::IPCResult RecvInitSandboxTesting(
112 Endpoint<PSandboxTestingChild>&& aEndpoint);
113 #endif
115 mozilla::ipc::IPCResult RecvFlushFOGData(FlushFOGDataResolver&& aResolver);
117 mozilla::ipc::IPCResult RecvTestTriggerMetrics(
118 TestTriggerMetricsResolver&& aResolve);
120 mozilla::ipc::IPCResult RecvCrashProcess();
122 void ActorDestroy(ActorDestroyReason aWhy) override;
124 private:
125 ~GPUParent();
127 const TimeStamp mLaunchTime;
128 RefPtr<VsyncBridgeParent> mVsyncBridge;
129 RefPtr<ChildProfilerController> mProfilerController;
130 ipc::AsyncBlockers mShutdownBlockers;
133 } // namespace gfx
134 } // namespace mozilla
136 #endif // _include_gfx_ipc_GPUParent_h__