gecko-dev/gfx/ipc/PGPU.ipdl

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

195 lines
8.1 KiB
Plaintext
Raw Normal View History

/* -*- 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/. */
include GraphicsMessages;
include MemoryReportTypes;
include HangTypes;
include PrefsTypes;
include protocol PAPZInputBridge;
include protocol PCompositorManager;
include protocol PImageBridge;
include protocol PProfiler;
include protocol PVRGPU;
include protocol PVRManager;
include protocol PVideoBridge;
include protocol PVsyncBridge;
include protocol PUiCompositorController;
include protocol PRemoteDecoderManager;
#if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
include protocol PSandboxTesting;
#endif
include "mozilla/ipc/ByteBufUtils.h";
include "mozilla/layers/LayersMessageUtils.h";
using base::ProcessId from "base/process.h";
using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
using mozilla::dom::NativeThreadId from "mozilla/dom/NativeThreadId.h";
using mozilla::Telemetry::HistogramAccumulation from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::KeyedHistogramAccumulation from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::KeyedScalarAction from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::ChildEventData from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h";
using mozilla::gfx::Feature from "gfxFeature.h";
using mozilla::gfx::Fallback from "gfxFallback.h";
using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
using mozilla::layers::OverlayInfo from "mozilla/layers/OverlayInfo.h";
using mozilla::layers::SwapChainInfo from "mozilla/layers/OverlayInfo.h";
using mozilla::media::MediaCodecsSupported from "MediaCodecsSupport.h";
using mozilla::layers::VideoBridgeSource from "mozilla/layers/VideoBridgeUtils.h";
using mozilla::hal::BatteryInformation from "mozilla/hal_sandbox/PHal.h";
namespace mozilla {
namespace gfx {
struct LayerTreeIdMapping {
LayersId layersId;
ProcessId ownerId;
};
// 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.
[NeedsOtherPid, ParentProc=GPU, ChildProc=Parent]
sync protocol PGPU
{
parent:
// Sent by the UI process to initiate core settings.
async Init(GfxVarUpdate[] vars,
DevicePrefs devicePrefs,
LayerTreeIdMapping[] mapping,
GfxInfoFeatureStatus[] features,
uint32_t wrNamespace);
async InitCompositorManager(Endpoint<PCompositorManagerParent> endpoint, uint32_t aNamespace);
async InitVsyncBridge(Endpoint<PVsyncBridgeParent> endpoint);
async InitImageBridge(Endpoint<PImageBridgeParent> endpoint);
async InitVideoBridge(Endpoint<PVideoBridgeParent> endpoint, VideoBridgeSource aSource);
async InitVRManager(Endpoint<PVRManagerParent> endpoint);
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);
async InitProfiler(Endpoint<PProfilerChild> endpoint);
// Forward GPU process its endpoints to the VR process.
async InitVR(Endpoint<PVRGPUChild> endpoint);
// Called to update a gfx variable.
async UpdateVar(GfxVarUpdate var);
async PreferenceUpdate(Pref pref);
async ScreenInformationChanged();
async NotifyBatteryInfo(BatteryInformation aBatteryInfo);
// Create a new content-process compositor bridge.
async NewContentCompositorManager(Endpoint<PCompositorManagerParent> endpoint, ContentParentId childId, uint32_t aNamespace);
async NewContentImageBridge(Endpoint<PImageBridgeParent> endpoint, ContentParentId childId);
async NewContentVRManager(Endpoint<PVRManagerParent> endpoint, ContentParentId childId);
async NewContentRemoteDecoderManager(Endpoint<PRemoteDecoderManagerParent> endpoint, ContentParentId childId);
// Called to notify the GPU process of who owns a layersId.
sync AddLayerTreeIdMapping(LayerTreeIdMapping mapping);
async RemoveLayerTreeIdMapping(LayerTreeIdMapping mapping);
// Request the current DeviceStatus from the GPU process. This blocks until
// one is available (i.e., Init has completed).
sync GetDeviceStatus() returns (GPUDeviceData status);
// 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).
async SimulateDeviceReset();
// Have a message be broadcasted to the GPU process by the GPU process
// observer service.
async NotifyGpuObservers(nsCString aTopic);
async RequestMemoryReport(uint32_t generation,
bool anonymize,
bool minimizeMemoryUsage,
FileDescriptor? DMDFile)
returns (uint32_t aGeneration);
async ShutdownVR();
// Functions supporting PerfStats data collection.
async UpdatePerfStatsCollectionMask(uint64_t aMask);
async CollectPerfStatsJSON() returns (nsCString aStats);
#if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
async InitSandboxTesting(Endpoint<PSandboxTestingChild> aEndpoint);
#endif
// 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);
// Test-only method.
// Asks the gpu process to trigger test-only instrumentation.
// The unused returned value is to have a promise we can await.
async TestTriggerMetrics() returns (bool unused);
// Causes the GPU process to crash. Used for tests and diagnostics.
async CrashProcess();
child:
// Sent when the GPU process has initialized devices. This occurs once, after
// Init().
async InitComplete(GPUDeviceData data);
// Sent when APZ detects checkerboarding and apz checkerboard reporting is enabled.
async ReportCheckerboard(uint32_t severity, nsCString log);
// Graphics errors, analogous to PContent::GraphicsError
async GraphicsError(nsCString aError);
Bug 1614933 - Gather content processes' crash annotations at exception time instead of using IPC; r=froydnj Crash annotations in content processes are currently sent over IPC via shared memory buffers. To pave the way for the Rust rewrite of the exception handler we are removing this code and gathering all the crash annotations within the content processes themselves. This patch causes annotations to be stored in the global table of each content process. They are then streamed out to the parent process by the exception handler together with the exception-time annotations. This has a number of benefits: * we have one less channel to exchange data between content processes and the parent process * we save memory because we don't need to allocate the shared memory buffers * annotations are faster because we don't stream them all out every time one changes * we won't truncate annotations anymore if we run out of space in the shared segment. * we don't need delayed annotations anymore, so we can get rid of the associated machinery As I refactored the code I tried to adjust all the obsolete comments, consolidate shared code and remove the redundant steps that were sometimes present. In many places we had two entire crash annotation tables we merged to change just a couple; that comes from the fact that historically we loaded them from disk. Now it doesn't matter anymore and we can just go ahead and change the ones we care about. Differential Revision: https://phabricator.services.mozilla.com/D62586 --HG-- extra : moz-landing-system : lando
2020-04-08 06:55:40 +00:00
async InitCrashReporter(NativeThreadId threadId);
async CreateVRProcess();
async ShutdownVRProcess();
// Have a message be broadcasted to the UI process by the UI process
// observer service.
async NotifyUiObservers(nsCString aTopic);
// Messages for reporting telemetry to the UI process.
async AccumulateChildHistograms(HistogramAccumulation[] accumulations);
async AccumulateChildKeyedHistograms(KeyedHistogramAccumulation[] accumulations);
async UpdateChildScalars(ScalarAction[] actions);
async UpdateChildKeyedScalars(KeyedScalarAction[] actions);
async RecordChildEvents(ChildEventData[] events);
async RecordDiscardedData(DiscardedData data);
async DeclareStable();
async NotifyDeviceReset(GPUDeviceData status);
async NotifyOverlayInfo(OverlayInfo info);
async NotifySwapChainInfo(SwapChainInfo info);
async NotifyDisableRemoteCanvas();
async FlushMemory(nsString reason);
async AddMemoryReport(MemoryReport aReport);
// 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);
// Notify about:support/Telemetry that a fallback occurred.
async UsedFallback(Fallback aFallback, nsCString message);
async BHRThreadHang(HangDetails aDetails);
// Update the cached list of codec supported following a check in the
// GPU parent.
async UpdateMediaCodecsSupported(MediaCodecsSupported aSupported);
// 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);
};
} // namespace gfx
} // namespace mozilla