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"
16 class ChildProfilerController
;
20 class VsyncBridgeParent
;
22 class GPUParent final
: public PGPUParent
{
27 static GPUParent
* GetSingleton();
29 ipc::AsyncBlockers
& AsyncShutdownService() { return mShutdownBlockers
; }
31 // Gets the name of the GPU process, in the format expected by about:memory.
32 // There must be a GPU process active, and the caller must be either in that
33 // process or the parent process.
34 static void GetGPUProcessName(nsACString
& aStr
);
36 // Check for memory pressure and notify the parent process if necessary.
37 static bool MaybeFlushMemory();
39 bool Init(base::ProcessId aParentPid
, const char* aParentBuildID
,
40 mozilla::ipc::ScopedPort aPort
);
41 void NotifyDeviceReset();
42 void NotifyOverlayInfo(layers::OverlayInfo aInfo
);
44 mozilla::ipc::IPCResult
RecvInit(nsTArray
<GfxVarUpdate
>&& vars
,
45 const DevicePrefs
& devicePrefs
,
46 nsTArray
<LayerTreeIdMapping
>&& mappings
,
47 nsTArray
<GfxInfoFeatureStatus
>&& features
,
48 uint32_t wrNamespace
);
49 mozilla::ipc::IPCResult
RecvInitCompositorManager(
50 Endpoint
<PCompositorManagerParent
>&& aEndpoint
);
51 mozilla::ipc::IPCResult
RecvInitVsyncBridge(
52 Endpoint
<PVsyncBridgeParent
>&& aVsyncEndpoint
);
53 mozilla::ipc::IPCResult
RecvInitImageBridge(
54 Endpoint
<PImageBridgeParent
>&& aEndpoint
);
55 mozilla::ipc::IPCResult
RecvInitVideoBridge(
56 Endpoint
<PVideoBridgeParent
>&& aEndpoint
);
57 mozilla::ipc::IPCResult
RecvInitVRManager(
58 Endpoint
<PVRManagerParent
>&& aEndpoint
);
59 mozilla::ipc::IPCResult
RecvInitVR(Endpoint
<PVRGPUChild
>&& aVRGPUChild
);
60 mozilla::ipc::IPCResult
RecvInitUiCompositorController(
61 const LayersId
& aRootLayerTreeId
,
62 Endpoint
<PUiCompositorControllerParent
>&& aEndpoint
);
63 mozilla::ipc::IPCResult
RecvInitAPZInputBridge(
64 const LayersId
& aRootLayerTreeId
,
65 Endpoint
<PAPZInputBridgeParent
>&& aEndpoint
);
66 mozilla::ipc::IPCResult
RecvInitProfiler(
67 Endpoint
<PProfilerChild
>&& aEndpoint
);
68 mozilla::ipc::IPCResult
RecvUpdateVar(const GfxVarUpdate
& pref
);
69 mozilla::ipc::IPCResult
RecvPreferenceUpdate(const Pref
& pref
);
70 mozilla::ipc::IPCResult
RecvNewContentCompositorManager(
71 Endpoint
<PCompositorManagerParent
>&& aEndpoint
);
72 mozilla::ipc::IPCResult
RecvNewContentImageBridge(
73 Endpoint
<PImageBridgeParent
>&& aEndpoint
);
74 mozilla::ipc::IPCResult
RecvNewContentVRManager(
75 Endpoint
<PVRManagerParent
>&& aEndpoint
);
76 mozilla::ipc::IPCResult
RecvNewContentRemoteDecoderManager(
77 Endpoint
<PRemoteDecoderManagerParent
>&& aEndpoint
);
78 mozilla::ipc::IPCResult
RecvGetDeviceStatus(GPUDeviceData
* aOutStatus
);
79 mozilla::ipc::IPCResult
RecvSimulateDeviceReset();
80 mozilla::ipc::IPCResult
RecvAddLayerTreeIdMapping(
81 const LayerTreeIdMapping
& aMapping
);
82 mozilla::ipc::IPCResult
RecvRemoveLayerTreeIdMapping(
83 const LayerTreeIdMapping
& aMapping
);
84 mozilla::ipc::IPCResult
RecvNotifyGpuObservers(const nsCString
& aTopic
);
85 mozilla::ipc::IPCResult
RecvRequestMemoryReport(
86 const uint32_t& generation
, const bool& anonymize
,
87 const bool& minimizeMemoryUsage
,
88 const Maybe
<ipc::FileDescriptor
>& DMDFile
,
89 const RequestMemoryReportResolver
& aResolver
);
90 mozilla::ipc::IPCResult
RecvShutdownVR();
92 mozilla::ipc::IPCResult
RecvUpdatePerfStatsCollectionMask(
93 const uint64_t& aMask
);
94 mozilla::ipc::IPCResult
RecvCollectPerfStatsJSON(
95 CollectPerfStatsJSONResolver
&& aResolver
);
97 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
98 mozilla::ipc::IPCResult
RecvInitSandboxTesting(
99 Endpoint
<PSandboxTestingChild
>&& aEndpoint
);
102 mozilla::ipc::IPCResult
RecvFlushFOGData(FlushFOGDataResolver
&& aResolver
);
104 mozilla::ipc::IPCResult
RecvTestTriggerMetrics(
105 TestTriggerMetricsResolver
&& aResolve
);
107 mozilla::ipc::IPCResult
RecvCrashProcess();
109 void ActorDestroy(ActorDestroyReason aWhy
) override
;
112 const TimeStamp mLaunchTime
;
113 RefPtr
<VsyncBridgeParent
> mVsyncBridge
;
114 RefPtr
<ChildProfilerController
> mProfilerController
;
115 ipc::AsyncBlockers mShutdownBlockers
;
119 } // namespace mozilla
121 #endif // _include_gfx_ipc_GPUParent_h__