tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PGPU.ipdl (8380B)


      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/. */
      5 
      6 include CrashReporterInitArgs;
      7 include GraphicsMessages;
      8 include MemoryReportTypes;
      9 include HangTypes;
     10 include PrefsTypes;
     11 include protocol PAPZInputBridge;
     12 include protocol PCompositorManager;
     13 include protocol PImageBridge;
     14 include protocol PProfiler;
     15 include protocol PVRGPU;
     16 include protocol PVRManager;
     17 include protocol PVideoBridge;
     18 include protocol PVsyncBridge;
     19 include protocol PUiCompositorController;
     20 include protocol PRemoteMediaManager;
     21 
     22 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
     23 include protocol PSandboxTesting;
     24 #endif
     25 
     26 include "mozilla/ipc/ByteBufUtils.h";
     27 include "mozilla/layers/LayersMessageUtils.h";
     28 
     29 using base::ProcessId from "base/process.h";
     30 using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
     31 using mozilla::dom::NativeThreadId from "mozilla/dom/NativeThreadId.h";
     32 using mozilla::Telemetry::HistogramAccumulation from "mozilla/TelemetryComms.h";
     33 using mozilla::Telemetry::KeyedHistogramAccumulation from "mozilla/TelemetryComms.h";
     34 using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h";
     35 using mozilla::Telemetry::KeyedScalarAction from "mozilla/TelemetryComms.h";
     36 using mozilla::Telemetry::ChildEventData from "mozilla/TelemetryComms.h";
     37 using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h";
     38 using mozilla::gfx::Feature from "gfxFeature.h";
     39 using mozilla::gfx::Fallback from "gfxFallback.h";
     40 using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
     41 using mozilla::layers::OverlayInfo from "mozilla/layers/OverlayInfo.h";
     42 using mozilla::layers::SwapChainInfo from "mozilla/layers/OverlayInfo.h";
     43 using mozilla::media::MediaCodecsSupported from "MediaCodecsSupport.h";
     44 using mozilla::layers::VideoBridgeSource from "mozilla/layers/VideoBridgeUtils.h";
     45 using mozilla::hal::BatteryInformation from "mozilla/hal_sandbox/PHal.h";
     46 using mozilla::gfx::DeviceResetReason from "mozilla/gfx/Types.h";
     47 using mozilla::gfx::DeviceResetDetectPlace from "mozilla/gfx/Types.h";
     48 
     49 namespace mozilla {
     50 namespace gfx {
     51 
     52 struct LayerTreeIdMapping {
     53   LayersId layersId;
     54   ProcessId ownerId;
     55 };
     56 
     57 // This protocol allows the UI process to talk to the GPU process. There is one
     58 // instance of this protocol, with the GPUParent living on the main thread of
     59 // the GPU process and the GPUChild living on the main thread of the UI process.
     60 [NeedsOtherPid, ParentProc=GPU, ChildProc=Parent]
     61 sync protocol PGPU
     62 {
     63 parent:
     64   // Sent by the UI process to initiate core settings.
     65   async Init(GfxVarUpdate[] vars,
     66              DevicePrefs devicePrefs,
     67              LayerTreeIdMapping[] mapping,
     68              GfxInfoFeatureStatus[] features,
     69              uint32_t wrNamespace) returns (GPUDeviceData data);
     70 
     71   async InitCompositorManager(Endpoint<PCompositorManagerParent> endpoint, uint32_t aNamespace);
     72   async InitVsyncBridge(Endpoint<PVsyncBridgeParent> endpoint);
     73   async InitImageBridge(Endpoint<PImageBridgeParent> endpoint);
     74   async InitVideoBridge(Endpoint<PVideoBridgeParent> endpoint, VideoBridgeSource aSource);
     75   async InitVRManager(Endpoint<PVRManagerParent> endpoint);
     76   async InitUiCompositorController(LayersId rootLayerTreeId, Endpoint<PUiCompositorControllerParent> endpoint);
     77   async InitAPZInputBridge(LayersId layersId,
     78                            Endpoint<PAPZInputBridgeParent> endpoint);
     79   async InitProfiler(Endpoint<PProfilerChild> endpoint);
     80   // Forward GPU process its endpoints to the VR process.
     81   async InitVR(Endpoint<PVRGPUChild> endpoint);
     82   // Called to update a gfx variable.
     83   async UpdateVar(GfxVarUpdate[] var);
     84 
     85   async PreferenceUpdate(Pref pref);
     86   async ScreenInformationChanged();
     87   async NotifyBatteryInfo(BatteryInformation aBatteryInfo);
     88 
     89   // Create a new content-process compositor bridge.
     90   async NewContentCompositorManager(Endpoint<PCompositorManagerParent> endpoint, ContentParentId childId, uint32_t aNamespace);
     91   async NewContentImageBridge(Endpoint<PImageBridgeParent> endpoint, ContentParentId childId);
     92   async NewContentVRManager(Endpoint<PVRManagerParent> endpoint, ContentParentId childId);
     93   async NewContentRemoteMediaManager(Endpoint<PRemoteMediaManagerParent> endpoint, ContentParentId childId);
     94 
     95   // Called to notify the GPU process of who owns a layersId.
     96   sync AddLayerTreeIdMapping(LayerTreeIdMapping mapping);
     97   async RemoveLayerTreeIdMapping(LayerTreeIdMapping mapping);
     98 
     99   // Request the current DeviceStatus from the GPU process. This blocks until
    100   // one is available (i.e., Init has completed).
    101   sync GetDeviceStatus() returns (GPUDeviceData status);
    102 
    103   // Request to simulate device reset and to get the updated DeviceStatus from
    104   // the GPU process. This blocks until one is available (i.e., Init has completed).
    105   async SimulateDeviceReset();
    106 
    107   // Have a message be broadcasted to the GPU process by the GPU process
    108   // observer service.
    109   async NotifyGpuObservers(nsCString aTopic);
    110 
    111   async RequestMemoryReport(uint32_t generation,
    112                             bool anonymize,
    113                             bool minimizeMemoryUsage,
    114                             FileDescriptor? DMDFile)
    115       returns (uint32_t aGeneration);
    116 
    117   async ShutdownVR();
    118 
    119   // Functions supporting PerfStats data collection.
    120   async UpdatePerfStatsCollectionMask(uint64_t aMask);
    121   async CollectPerfStatsJSON() returns (nsCString aStats);
    122 
    123 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
    124   async InitSandboxTesting(Endpoint<PSandboxTestingChild> aEndpoint);
    125 #endif
    126 
    127   // Tells the gpu process to flush any pending telemetry.
    128   // Used in tests and ping assembly. Buffer contains bincoded Rust structs.
    129   // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html
    130   async FlushFOGData() returns (ByteBuf buf);
    131 
    132   // Test-only method.
    133   // Asks the gpu process to trigger test-only instrumentation.
    134   // The unused returned value is to have a promise we can await.
    135   async TestTriggerMetrics() returns (bool unused);
    136 
    137   // Causes the GPU process to crash. Used for tests and diagnostics.
    138   async CrashProcess();
    139 
    140 child:
    141   // Sent when APZ detects checkerboarding and apz checkerboard reporting is enabled.
    142   async ReportCheckerboard(uint32_t severity, nsCString log);
    143 
    144   // Graphics errors, analogous to PContent::GraphicsError
    145   async GraphicsError(nsCString aError);
    146 
    147   async InitCrashReporter(CrashReporterInitArgs aInitArgs);
    148 
    149   async CreateVRProcess();
    150   async ShutdownVRProcess();
    151 
    152   // Have a message be broadcasted to the UI process by the UI process
    153   // observer service.
    154   async NotifyUiObservers(nsCString aTopic);
    155 
    156   // Messages for reporting telemetry to the UI process.
    157   async AccumulateChildHistograms(HistogramAccumulation[] accumulations);
    158   async AccumulateChildKeyedHistograms(KeyedHistogramAccumulation[] accumulations);
    159   async UpdateChildScalars(ScalarAction[] actions);
    160   async UpdateChildKeyedScalars(KeyedScalarAction[] actions);
    161   async RecordChildEvents(ChildEventData[] events);
    162   async RecordDiscardedData(DiscardedData data);
    163 
    164   async DeclareStable();
    165   async NotifyDeviceReset(GPUDeviceData status, DeviceResetReason reason, DeviceResetDetectPlace place);
    166   async NotifyOverlayInfo(OverlayInfo info);
    167   async NotifySwapChainInfo(SwapChainInfo info);
    168   async NotifyDisableRemoteCanvas();
    169   async FlushMemory(nsString reason);
    170 
    171   async AddMemoryReport(MemoryReport aReport);
    172 
    173   // Update the UI process after a feature's status has changed. This is used
    174   // outside of the normal startup flow.
    175   async UpdateFeature(Feature aFeature, FeatureFailure aChange);
    176 
    177   // Notify about:support/Telemetry that a fallback occurred.
    178   async UsedFallback(Fallback aFallback, nsCString message);
    179 
    180   async BHRThreadHang(HangDetails aDetails);
    181 
    182   // Update the cached list of codec supported following a check in the
    183   // GPU parent.
    184   async UpdateMediaCodecsSupported(MediaCodecsSupported aSupported);
    185 
    186   // Sent from time-to-time to limit the amount of telemetry vulnerable to loss
    187   // Buffer contains bincoded Rust structs.
    188   // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html
    189   async FOGData(ByteBuf buf);
    190 };
    191 
    192 } // namespace gfx
    193 } // namespace mozilla