2016-06-11 02:27:24 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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/. */
|
|
|
|
|
2016-08-04 18:33:42 +00:00
|
|
|
include GraphicsMessages;
|
2017-01-27 00:35:54 +00:00
|
|
|
include MemoryReportTypes;
|
2018-01-10 22:27:18 +00:00
|
|
|
include HangTypes;
|
2019-05-25 10:12:51 +00:00
|
|
|
include PrefsTypes;
|
2018-03-16 20:28:19 +00:00
|
|
|
include protocol PAPZInputBridge;
|
2017-06-14 15:39:59 +00:00
|
|
|
include protocol PCompositorManager;
|
2016-07-20 07:19:27 +00:00
|
|
|
include protocol PImageBridge;
|
2017-05-30 19:06:14 +00:00
|
|
|
include protocol PProfiler;
|
2018-08-07 05:47:18 +00:00
|
|
|
include protocol PVRGPU;
|
2016-07-21 07:14:59 +00:00
|
|
|
include protocol PVRManager;
|
2019-11-04 03:41:57 +00:00
|
|
|
include protocol PVideoBridge;
|
2016-07-19 18:56:06 +00:00
|
|
|
include protocol PVsyncBridge;
|
2017-01-05 19:04:38 +00:00
|
|
|
include protocol PUiCompositorController;
|
2019-06-11 02:01:34 +00:00
|
|
|
include protocol PRemoteDecoderManager;
|
2016-07-18 04:24:28 +00:00
|
|
|
|
2019-10-14 15:26:47 +00:00
|
|
|
#if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
|
|
|
|
include protocol PSandboxTesting;
|
|
|
|
#endif
|
|
|
|
|
2021-12-01 14:35:08 +00:00
|
|
|
include "mozilla/ipc/ByteBufUtils.h";
|
2020-11-23 16:03:32 +00:00
|
|
|
include "mozilla/layers/LayersMessageUtils.h";
|
|
|
|
|
2016-08-16 20:59:13 +00:00
|
|
|
using base::ProcessId from "base/process.h";
|
2023-12-05 15:23:37 +00:00
|
|
|
using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
|
2020-07-15 13:24:20 +00:00
|
|
|
using mozilla::dom::NativeThreadId from "mozilla/dom/NativeThreadId.h";
|
2017-09-13 09:20:36 +00:00
|
|
|
using mozilla::Telemetry::HistogramAccumulation from "mozilla/TelemetryComms.h";
|
|
|
|
using mozilla::Telemetry::KeyedHistogramAccumulation from "mozilla/TelemetryComms.h";
|
2017-01-16 04:12:00 +00:00
|
|
|
using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h";
|
|
|
|
using mozilla::Telemetry::KeyedScalarAction from "mozilla/TelemetryComms.h";
|
2017-02-14 13:43:51 +00:00
|
|
|
using mozilla::Telemetry::ChildEventData from "mozilla/TelemetryComms.h";
|
2017-06-09 13:53:42 +00:00
|
|
|
using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h";
|
2017-06-23 21:23:12 +00:00
|
|
|
using mozilla::gfx::Feature from "gfxFeature.h";
|
2017-07-11 07:13:26 +00:00
|
|
|
using mozilla::gfx::Fallback from "gfxFallback.h";
|
2018-03-24 23:06:01 +00:00
|
|
|
using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
|
2022-05-11 15:10:30 +00:00
|
|
|
using mozilla::layers::OverlayInfo from "mozilla/layers/OverlayInfo.h";
|
2022-10-26 05:42:49 +00:00
|
|
|
using mozilla::layers::SwapChainInfo from "mozilla/layers/OverlayInfo.h";
|
2022-07-22 23:08:08 +00:00
|
|
|
using mozilla::media::MediaCodecsSupported from "MediaCodecsSupport.h";
|
2022-09-03 00:53:59 +00:00
|
|
|
using mozilla::layers::VideoBridgeSource from "mozilla/layers/VideoBridgeUtils.h";
|
2024-03-01 04:00:59 +00:00
|
|
|
using mozilla::hal::BatteryInformation from "mozilla/hal_sandbox/PHal.h";
|
2016-06-27 06:33:20 +00:00
|
|
|
|
2016-06-11 02:27:24 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
|
2016-11-02 20:55:07 +00:00
|
|
|
struct LayerTreeIdMapping {
|
2018-03-24 23:06:01 +00:00
|
|
|
LayersId layersId;
|
2016-11-02 20:55:07 +00:00
|
|
|
ProcessId ownerId;
|
|
|
|
};
|
|
|
|
|
2018-03-16 20:28:19 +00:00
|
|
|
// This protocol allows the UI process to talk to the GPU process. There is one
|
|
|
|
// instance of this protocol, with the GPUParent living on the main thread of
|
|
|
|
// the GPU process and the GPUChild living on the main thread of the UI process.
|
Bug 1867360 - Require toplevel protocols to specify which processes they expect to be bound in, r=decoder,ipc-reviewers,necko-reviewers,media-playback-reviewers,profiler-reviewers,win-reviewers,aosmond,rkraesig,mccr8,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D195485
2024-01-18 23:07:18 +00:00
|
|
|
[NeedsOtherPid, ParentProc=GPU, ChildProc=Parent]
|
2016-06-11 02:27:24 +00:00
|
|
|
sync protocol PGPU
|
|
|
|
{
|
|
|
|
parent:
|
2016-06-27 06:33:20 +00:00
|
|
|
// Sent by the UI process to initiate core settings.
|
2019-05-26 14:31:27 +00:00
|
|
|
async Init(GfxVarUpdate[] vars,
|
2017-04-03 22:13:38 +00:00
|
|
|
DevicePrefs devicePrefs,
|
2020-08-07 21:31:53 +00:00
|
|
|
LayerTreeIdMapping[] mapping,
|
2022-02-18 15:59:12 +00:00
|
|
|
GfxInfoFeatureStatus[] features,
|
|
|
|
uint32_t wrNamespace);
|
2016-06-27 06:33:20 +00:00
|
|
|
|
2023-12-10 22:46:06 +00:00
|
|
|
async InitCompositorManager(Endpoint<PCompositorManagerParent> endpoint, uint32_t aNamespace);
|
2016-07-20 07:19:27 +00:00
|
|
|
async InitVsyncBridge(Endpoint<PVsyncBridgeParent> endpoint);
|
|
|
|
async InitImageBridge(Endpoint<PImageBridgeParent> endpoint);
|
2022-09-03 00:53:59 +00:00
|
|
|
async InitVideoBridge(Endpoint<PVideoBridgeParent> endpoint, VideoBridgeSource aSource);
|
2016-07-21 07:14:59 +00:00
|
|
|
async InitVRManager(Endpoint<PVRManagerParent> endpoint);
|
2018-03-24 23:06:01 +00:00
|
|
|
async InitUiCompositorController(LayersId rootLayerTreeId, Endpoint<PUiCompositorControllerParent> endpoint);
|
Bug 1340301 - Ensure APZ functions are called from correct threads on Android with GPU process. r=botond
On Android the APZ controller thread is the android UI thread, rather
than the Gecko main thread as on other platforms. There some places
where the main thread requires to call IAPZCTreeManager functions that
must run on the controller thread. Currently we use the function
DispatchToControllerThread() prior to calling various IAPZCTreeManager
APIs to achieve this.
This works just fine for now, as there is no GPU process on
Android. However, once we do add a GPU process we will encounter
issues:
Firstly, there will now be a cross-process APZInputBridge rather than
using an in-process APZCTreeManager. The PAPZInputBridge protocol is
managed by PGPU, and therefore must run on the main thread in the
parent process. The input we require to send over the bridge, however,
originates from the UI thread.
To solve this we can convert PAPZInputBridge to a top-level protocol,
and bind it to the UI thread on Android. We can then send input
directly from the UI thread without issues.
Secondly, the PAPZCTreeManager protocol must also run from the main
thread in the parent process, as it is managed by
PCompositorBridge. Unlike PAPZInputBridge we cannot convert
PAPZCTreeManager in to a top level protocol, as it relies on the
ordering guarantees with PCompositorBridge.
We must therefore ensure that we only dispatch IAPZCTreeManager calls
to the controller thread when using an in-process
APZCTreeManager. Out-of-process calls, on the other hand, must be
dispatched to the main thread where we can send IPDL commands from. To
do this, we move the dispatch logic away from the callsites of
IAPZCTreeManager APIs, and in to the APZCTreeManager and
APZCTreeManagerChild implementations themselves.
Differential Revision: https://phabricator.services.mozilla.com/D131120
2021-11-20 09:49:14 +00:00
|
|
|
async InitAPZInputBridge(LayersId layersId,
|
|
|
|
Endpoint<PAPZInputBridgeParent> endpoint);
|
2017-05-30 19:06:14 +00:00
|
|
|
async InitProfiler(Endpoint<PProfilerChild> endpoint);
|
2018-08-07 05:47:18 +00:00
|
|
|
// Forward GPU process its endpoints to the VR process.
|
|
|
|
async InitVR(Endpoint<PVRGPUChild> endpoint);
|
2019-05-26 14:31:27 +00:00
|
|
|
// Called to update a gfx variable.
|
2016-08-04 18:33:42 +00:00
|
|
|
async UpdateVar(GfxVarUpdate var);
|
2016-07-18 04:24:28 +00:00
|
|
|
|
2019-05-25 10:12:51 +00:00
|
|
|
async PreferenceUpdate(Pref pref);
|
2024-02-22 01:59:40 +00:00
|
|
|
async ScreenInformationChanged();
|
2024-03-01 04:00:59 +00:00
|
|
|
async NotifyBatteryInfo(BatteryInformation aBatteryInfo);
|
2019-05-25 10:12:51 +00:00
|
|
|
|
2016-07-18 04:24:28 +00:00
|
|
|
// Create a new content-process compositor bridge.
|
2023-12-10 22:46:06 +00:00
|
|
|
async NewContentCompositorManager(Endpoint<PCompositorManagerParent> endpoint, ContentParentId childId, uint32_t aNamespace);
|
2023-12-05 15:23:37 +00:00
|
|
|
async NewContentImageBridge(Endpoint<PImageBridgeParent> endpoint, ContentParentId childId);
|
|
|
|
async NewContentVRManager(Endpoint<PVRManagerParent> endpoint, ContentParentId childId);
|
|
|
|
async NewContentRemoteDecoderManager(Endpoint<PRemoteDecoderManagerParent> endpoint, ContentParentId childId);
|
2016-08-17 16:11:00 +00:00
|
|
|
|
2016-08-16 20:59:13 +00:00
|
|
|
// Called to notify the GPU process of who owns a layersId.
|
2017-04-03 22:13:38 +00:00
|
|
|
sync AddLayerTreeIdMapping(LayerTreeIdMapping mapping);
|
2016-11-02 20:55:07 +00:00
|
|
|
async RemoveLayerTreeIdMapping(LayerTreeIdMapping mapping);
|
2016-08-16 20:59:13 +00:00
|
|
|
|
2016-08-21 03:59:11 +00:00
|
|
|
// Request the current DeviceStatus from the GPU process. This blocks until
|
|
|
|
// one is available (i.e., Init has completed).
|
|
|
|
sync GetDeviceStatus() returns (GPUDeviceData status);
|
|
|
|
|
2017-11-03 08:06:37 +00:00
|
|
|
// Request to simulate device reset and to get the updated DeviceStatus from
|
|
|
|
// the GPU process. This blocks until one is available (i.e., Init has completed).
|
2022-03-08 23:14:28 +00:00
|
|
|
async SimulateDeviceReset();
|
2017-11-03 08:06:37 +00:00
|
|
|
|
2016-10-15 12:45:02 +00:00
|
|
|
// Have a message be broadcasted to the GPU process by the GPU process
|
|
|
|
// observer service.
|
|
|
|
async NotifyGpuObservers(nsCString aTopic);
|
|
|
|
|
2017-01-27 00:35:54 +00:00
|
|
|
async RequestMemoryReport(uint32_t generation,
|
|
|
|
bool anonymize,
|
|
|
|
bool minimizeMemoryUsage,
|
2020-08-03 18:29:45 +00:00
|
|
|
FileDescriptor? DMDFile)
|
|
|
|
returns (uint32_t aGeneration);
|
|
|
|
|
2018-08-07 05:47:18 +00:00
|
|
|
async ShutdownVR();
|
2017-01-27 00:35:54 +00:00
|
|
|
|
2019-05-21 19:01:31 +00:00
|
|
|
// Functions supporting PerfStats data collection.
|
|
|
|
async UpdatePerfStatsCollectionMask(uint64_t aMask);
|
|
|
|
async CollectPerfStatsJSON() returns (nsCString aStats);
|
|
|
|
|
2019-10-14 15:26:47 +00:00
|
|
|
#if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
|
|
|
|
async InitSandboxTesting(Endpoint<PSandboxTestingChild> aEndpoint);
|
|
|
|
#endif
|
|
|
|
|
2021-12-01 14:35:08 +00:00
|
|
|
// Tells the gpu process to flush any pending telemetry.
|
|
|
|
// Used in tests and ping assembly. Buffer contains bincoded Rust structs.
|
|
|
|
// https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html
|
|
|
|
async FlushFOGData() returns (ByteBuf buf);
|
|
|
|
|
2021-12-01 14:35:08 +00:00
|
|
|
// Test-only method.
|
|
|
|
// Asks the gpu process to trigger test-only instrumentation.
|
2021-12-15 22:18:32 +00:00
|
|
|
// The unused returned value is to have a promise we can await.
|
|
|
|
async TestTriggerMetrics() returns (bool unused);
|
2021-12-01 14:35:08 +00:00
|
|
|
|
2021-12-08 19:08:17 +00:00
|
|
|
// Causes the GPU process to crash. Used for tests and diagnostics.
|
|
|
|
async CrashProcess();
|
|
|
|
|
2016-08-21 03:59:11 +00:00
|
|
|
child:
|
|
|
|
// Sent when the GPU process has initialized devices. This occurs once, after
|
|
|
|
// Init().
|
|
|
|
async InitComplete(GPUDeviceData data);
|
2016-09-22 05:38:44 +00:00
|
|
|
|
|
|
|
// Sent when APZ detects checkerboarding and apz checkerboard reporting is enabled.
|
|
|
|
async ReportCheckerboard(uint32_t severity, nsCString log);
|
2016-09-30 21:31:06 +00:00
|
|
|
|
|
|
|
// Graphics errors, analogous to PContent::GraphicsError
|
|
|
|
async GraphicsError(nsCString aError);
|
2016-10-11 21:25:41 +00:00
|
|
|
|
2020-04-08 06:55:40 +00:00
|
|
|
async InitCrashReporter(NativeThreadId threadId);
|
2016-10-15 12:45:02 +00:00
|
|
|
|
2018-08-07 05:47:18 +00:00
|
|
|
async CreateVRProcess();
|
2019-01-03 20:28:52 +00:00
|
|
|
async ShutdownVRProcess();
|
2018-08-07 05:47:18 +00:00
|
|
|
|
2016-10-15 12:45:02 +00:00
|
|
|
// Have a message be broadcasted to the UI process by the UI process
|
|
|
|
// observer service.
|
|
|
|
async NotifyUiObservers(nsCString aTopic);
|
2016-10-31 05:35:57 +00:00
|
|
|
|
|
|
|
// Messages for reporting telemetry to the UI process.
|
2017-09-13 09:20:36 +00:00
|
|
|
async AccumulateChildHistograms(HistogramAccumulation[] accumulations);
|
|
|
|
async AccumulateChildKeyedHistograms(KeyedHistogramAccumulation[] accumulations);
|
2017-01-16 04:12:00 +00:00
|
|
|
async UpdateChildScalars(ScalarAction[] actions);
|
|
|
|
async UpdateChildKeyedScalars(KeyedScalarAction[] actions);
|
2017-02-14 13:43:51 +00:00
|
|
|
async RecordChildEvents(ChildEventData[] events);
|
2017-06-09 13:53:42 +00:00
|
|
|
async RecordDiscardedData(DiscardedData data);
|
2016-11-06 19:01:52 +00:00
|
|
|
|
2021-05-06 19:47:38 +00:00
|
|
|
async DeclareStable();
|
2024-05-14 01:55:08 +00:00
|
|
|
async NotifyDeviceReset(GPUDeviceData status);
|
2022-05-11 15:10:30 +00:00
|
|
|
async NotifyOverlayInfo(OverlayInfo info);
|
2022-10-26 05:42:49 +00:00
|
|
|
async NotifySwapChainInfo(SwapChainInfo info);
|
2023-09-25 16:18:35 +00:00
|
|
|
async NotifyDisableRemoteCanvas();
|
2021-02-25 15:38:45 +00:00
|
|
|
async FlushMemory(nsString reason);
|
2017-01-27 00:35:54 +00:00
|
|
|
|
|
|
|
async AddMemoryReport(MemoryReport aReport);
|
2017-06-23 21:23:12 +00:00
|
|
|
|
|
|
|
// Update the UI process after a feature's status has changed. This is used
|
|
|
|
// outside of the normal startup flow.
|
|
|
|
async UpdateFeature(Feature aFeature, FeatureFailure aChange);
|
2017-07-11 07:13:26 +00:00
|
|
|
|
|
|
|
// Notify about:support/Telemetry that a fallback occurred.
|
|
|
|
async UsedFallback(Fallback aFallback, nsCString message);
|
2017-07-20 16:49:28 +00:00
|
|
|
|
|
|
|
async BHRThreadHang(HangDetails aDetails);
|
2021-01-06 09:05:31 +00:00
|
|
|
|
|
|
|
// Update the cached list of codec supported following a check in the
|
|
|
|
// GPU parent.
|
|
|
|
async UpdateMediaCodecsSupported(MediaCodecsSupported aSupported);
|
2021-12-01 14:35:08 +00:00
|
|
|
|
|
|
|
// Sent from time-to-time to limit the amount of telemetry vulnerable to loss
|
|
|
|
// Buffer contains bincoded Rust structs.
|
|
|
|
// https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html
|
|
|
|
async FOGData(ByteBuf buf);
|
2016-06-11 02:27:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|