2016-11-15 06:26:00 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2016-06-11 05:27:24 +03:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=99: */
|
|
|
|
/* 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-09-21 12:24:44 +03:00
|
|
|
#ifdef XP_WIN
|
|
|
|
#include "WMF.h"
|
|
|
|
#endif
|
2016-06-11 05:27:24 +03:00
|
|
|
#include "GPUParent.h"
|
|
|
|
#include "gfxConfig.h"
|
2016-07-20 07:11:44 +03:00
|
|
|
#include "gfxPlatform.h"
|
2016-06-27 09:33:20 +03:00
|
|
|
#include "gfxPrefs.h"
|
2016-06-11 05:27:24 +03:00
|
|
|
#include "GPUProcessHost.h"
|
|
|
|
#include "mozilla/Assertions.h"
|
2017-01-03 23:13:36 +03:00
|
|
|
#include "mozilla/Telemetry.h"
|
|
|
|
#include "mozilla/TimeStamp.h"
|
2017-01-27 03:35:54 +03:00
|
|
|
#include "mozilla/dom/MemoryReportRequest.h"
|
|
|
|
#include "mozilla/dom/VideoDecoderManagerChild.h"
|
|
|
|
#include "mozilla/dom/VideoDecoderManagerParent.h"
|
2016-10-15 23:04:00 +03:00
|
|
|
#include "mozilla/gfx/2D.h"
|
2016-08-04 21:33:42 +03:00
|
|
|
#include "mozilla/gfx/gfxVars.h"
|
2016-10-12 00:25:41 +03:00
|
|
|
#include "mozilla/ipc/CrashReporterClient.h"
|
2016-06-11 05:27:24 +03:00
|
|
|
#include "mozilla/ipc/ProcessChild.h"
|
2016-08-29 16:18:00 +03:00
|
|
|
#include "mozilla/layers/APZThreadUtils.h"
|
2016-08-31 23:00:00 +03:00
|
|
|
#include "mozilla/layers/APZCTreeManager.h"
|
2016-07-18 07:24:28 +03:00
|
|
|
#include "mozilla/layers/CompositorBridgeParent.h"
|
2017-06-14 18:39:59 +03:00
|
|
|
#include "mozilla/layers/CompositorManagerParent.h"
|
2016-07-18 07:24:28 +03:00
|
|
|
#include "mozilla/layers/CompositorThread.h"
|
2016-07-20 10:19:27 +03:00
|
|
|
#include "mozilla/layers/ImageBridgeParent.h"
|
2016-08-16 23:59:13 +03:00
|
|
|
#include "mozilla/layers/LayerTreeOwnerTracker.h"
|
2017-01-05 22:04:38 +03:00
|
|
|
#include "mozilla/layers/UiCompositorControllerParent.h"
|
2017-06-24 00:23:14 +03:00
|
|
|
#include "mozilla/layers/MemoryReportingMLGPU.h"
|
2017-02-03 04:22:49 +03:00
|
|
|
#include "mozilla/webrender/RenderThread.h"
|
2016-10-12 10:08:36 +03:00
|
|
|
#include "nsDebugImpl.h"
|
|
|
|
#include "nsExceptionHandler.h"
|
|
|
|
#include "nsThreadManager.h"
|
2016-08-30 08:05:00 +03:00
|
|
|
#include "prenv.h"
|
2016-10-12 10:08:36 +03:00
|
|
|
#include "ProcessUtils.h"
|
2016-07-21 10:14:59 +03:00
|
|
|
#include "VRManager.h"
|
|
|
|
#include "VRManagerParent.h"
|
|
|
|
#include "VsyncBridgeParent.h"
|
2016-08-21 06:59:10 +03:00
|
|
|
#if defined(XP_WIN)
|
2016-08-24 01:18:55 +03:00
|
|
|
# include "mozilla/gfx/DeviceManagerDx.h"
|
2017-01-27 03:35:54 +03:00
|
|
|
# include <process.h>
|
2016-08-21 06:59:10 +03:00
|
|
|
#endif
|
2016-08-30 08:05:00 +03:00
|
|
|
#ifdef MOZ_WIDGET_GTK
|
|
|
|
# include <gtk/gtk.h>
|
|
|
|
#endif
|
2017-05-30 22:06:14 +03:00
|
|
|
#ifdef MOZ_GECKO_PROFILER
|
|
|
|
#include "ChildProfilerController.h"
|
|
|
|
#endif
|
2016-06-11 05:27:24 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
|
|
|
|
using namespace ipc;
|
2016-07-18 07:24:28 +03:00
|
|
|
using namespace layers;
|
2016-06-11 05:27:24 +03:00
|
|
|
|
2016-09-22 08:38:44 +03:00
|
|
|
static GPUParent* sGPUParent;
|
|
|
|
|
2016-06-11 05:27:24 +03:00
|
|
|
GPUParent::GPUParent()
|
2017-01-03 23:13:36 +03:00
|
|
|
: mLaunchTime(TimeStamp::Now())
|
2016-06-11 05:27:24 +03:00
|
|
|
{
|
2016-09-22 08:38:44 +03:00
|
|
|
sGPUParent = this;
|
2016-06-11 05:27:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
GPUParent::~GPUParent()
|
|
|
|
{
|
2016-09-22 08:38:44 +03:00
|
|
|
sGPUParent = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* static */ GPUParent*
|
|
|
|
GPUParent::GetSingleton()
|
|
|
|
{
|
|
|
|
return sGPUParent;
|
2016-06-11 05:27:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
GPUParent::Init(base::ProcessId aParentPid,
|
|
|
|
MessageLoop* aIOLoop,
|
|
|
|
IPC::Channel* aChannel)
|
|
|
|
{
|
2016-10-12 10:08:36 +03:00
|
|
|
// Initialize the thread manager before starting IPC. Otherwise, messages
|
|
|
|
// may be posted to the main thread and we won't be able to process them.
|
|
|
|
if (NS_WARN_IF(NS_FAILED(nsThreadManager::get().Init()))) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Now it's safe to start IPC.
|
2016-06-11 05:27:24 +03:00
|
|
|
if (NS_WARN_IF(!Open(aChannel, aParentPid, aIOLoop))) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-08-23 08:57:36 +03:00
|
|
|
nsDebugImpl::SetMultiprocessMode("GPU");
|
|
|
|
|
2016-10-12 00:25:41 +03:00
|
|
|
#ifdef MOZ_CRASHREPORTER
|
|
|
|
// Init crash reporter support.
|
|
|
|
CrashReporterClient::InitSingleton(this);
|
|
|
|
#endif
|
|
|
|
|
2016-06-27 09:33:20 +03:00
|
|
|
// Ensure gfxPrefs are initialized.
|
|
|
|
gfxPrefs::GetSingleton();
|
2016-08-13 22:25:18 +03:00
|
|
|
gfxConfig::Init();
|
2016-08-04 21:33:42 +03:00
|
|
|
gfxVars::Initialize();
|
2016-08-23 08:57:36 +03:00
|
|
|
gfxPlatform::InitNullMetadata();
|
2016-10-04 01:48:11 +03:00
|
|
|
// Ensure our Factory is initialised, mainly for gfx logging to work.
|
|
|
|
gfxPlatform::InitMoz2DLogging();
|
2017-06-24 00:23:14 +03:00
|
|
|
mlg::InitializeMemoryReporters();
|
2016-08-21 06:59:10 +03:00
|
|
|
#if defined(XP_WIN)
|
2016-08-24 01:18:55 +03:00
|
|
|
DeviceManagerDx::Init();
|
2016-08-21 06:59:10 +03:00
|
|
|
#endif
|
2016-10-31 08:35:56 +03:00
|
|
|
|
2016-08-23 08:57:36 +03:00
|
|
|
if (NS_FAILED(NS_InitMinimalXPCOM())) {
|
|
|
|
return false;
|
|
|
|
}
|
2016-10-31 08:35:56 +03:00
|
|
|
|
2016-07-18 07:24:28 +03:00
|
|
|
CompositorThreadHolder::Start();
|
2016-08-29 16:18:00 +03:00
|
|
|
APZThreadUtils::SetControllerThread(CompositorThreadHolder::Loop());
|
2016-08-31 23:00:00 +03:00
|
|
|
APZCTreeManager::InitializeGlobalState();
|
2016-08-16 23:59:13 +03:00
|
|
|
LayerTreeOwnerTracker::Initialize();
|
2016-08-24 22:47:11 +03:00
|
|
|
mozilla::ipc::SetThisProcessName("GPU Process");
|
2016-09-21 12:24:44 +03:00
|
|
|
#ifdef XP_WIN
|
|
|
|
wmf::MFStartup();
|
|
|
|
#endif
|
2016-06-27 09:33:20 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-11-06 22:01:52 +03:00
|
|
|
void
|
|
|
|
GPUParent::NotifyDeviceReset()
|
|
|
|
{
|
|
|
|
if (!NS_IsMainThread()) {
|
2017-06-12 22:34:10 +03:00
|
|
|
NS_DispatchToMainThread(
|
|
|
|
NS_NewRunnableFunction("gfx::GPUParent::NotifyDeviceReset", []() -> void {
|
|
|
|
GPUParent::GetSingleton()->NotifyDeviceReset();
|
|
|
|
}));
|
2016-11-06 22:01:52 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reset and reinitialize the compositor devices
|
|
|
|
#ifdef XP_WIN
|
|
|
|
if (!DeviceManagerDx::Get()->MaybeResetAndReacquireDevices()) {
|
|
|
|
// If the device doesn't need to be reset then the device
|
|
|
|
// has already been reset by a previous NotifyDeviceReset message.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Notify the main process that there's been a device reset
|
|
|
|
// and that they should reset their compositors and repaint
|
2017-04-05 10:17:36 +03:00
|
|
|
GPUDeviceData data;
|
|
|
|
RecvGetDeviceStatus(&data);
|
|
|
|
Unused << SendNotifyDeviceReset(data);
|
2016-11-06 22:01:52 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-08-04 21:33:42 +03:00
|
|
|
GPUParent::RecvInit(nsTArray<GfxPrefSetting>&& prefs,
|
2016-08-21 06:59:10 +03:00
|
|
|
nsTArray<GfxVarUpdate>&& vars,
|
2017-04-04 01:13:38 +03:00
|
|
|
const DevicePrefs& devicePrefs,
|
|
|
|
nsTArray<LayerTreeIdMapping>&& aMappings)
|
2016-06-27 09:33:20 +03:00
|
|
|
{
|
2016-07-20 23:55:07 +03:00
|
|
|
const nsTArray<gfxPrefs::Pref*>& globalPrefs = gfxPrefs::all();
|
|
|
|
for (auto& setting : prefs) {
|
|
|
|
gfxPrefs::Pref* pref = globalPrefs[setting.index()];
|
2016-06-27 09:33:20 +03:00
|
|
|
pref->SetCachedValue(setting.value());
|
|
|
|
}
|
2016-08-04 21:33:42 +03:00
|
|
|
for (const auto& var : vars) {
|
|
|
|
gfxVars::ApplyUpdate(var);
|
|
|
|
}
|
2016-08-21 06:59:10 +03:00
|
|
|
|
|
|
|
// Inherit device preferences.
|
|
|
|
gfxConfig::Inherit(Feature::HW_COMPOSITING, devicePrefs.hwCompositing());
|
|
|
|
gfxConfig::Inherit(Feature::D3D11_COMPOSITING, devicePrefs.d3d11Compositing());
|
|
|
|
gfxConfig::Inherit(Feature::OPENGL_COMPOSITING, devicePrefs.oglCompositing());
|
2017-06-24 00:23:12 +03:00
|
|
|
gfxConfig::Inherit(Feature::ADVANCED_LAYERS, devicePrefs.advancedLayers());
|
2016-08-21 06:59:10 +03:00
|
|
|
gfxConfig::Inherit(Feature::DIRECT2D, devicePrefs.useD2D1());
|
|
|
|
|
2017-04-04 01:13:38 +03:00
|
|
|
for (const LayerTreeIdMapping& map : aMappings) {
|
|
|
|
LayerTreeOwnerTracker::Get()->Map(map.layersId(), map.ownerId());
|
|
|
|
}
|
|
|
|
|
2016-08-21 06:59:10 +03:00
|
|
|
#if defined(XP_WIN)
|
|
|
|
if (gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) {
|
2016-08-24 01:18:55 +03:00
|
|
|
DeviceManagerDx::Get()->CreateCompositorDevices();
|
2016-08-21 06:59:10 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-08-30 08:05:00 +03:00
|
|
|
#if defined(MOZ_WIDGET_GTK)
|
|
|
|
char* display_name = PR_GetEnv("DISPLAY");
|
|
|
|
if (display_name) {
|
|
|
|
int argc = 3;
|
|
|
|
char option_name[] = "--display";
|
|
|
|
char* argv[] = {
|
|
|
|
// argv0 is unused because g_set_prgname() was called in
|
|
|
|
// XRE_InitChildProcess().
|
|
|
|
nullptr,
|
|
|
|
option_name,
|
|
|
|
display_name,
|
|
|
|
nullptr
|
|
|
|
};
|
|
|
|
char** argvp = argv;
|
|
|
|
gtk_init(&argc, &argvp);
|
|
|
|
} else {
|
|
|
|
gtk_init(nullptr, nullptr);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-02-07 06:22:44 +03:00
|
|
|
// Make sure to do this *after* we update gfxVars above.
|
|
|
|
if (gfxVars::UseWebRender()) {
|
|
|
|
wr::RenderThread::Start();
|
|
|
|
}
|
|
|
|
|
2016-11-23 04:40:54 +03:00
|
|
|
VRManager::ManagerInit();
|
2016-08-21 06:59:11 +03:00
|
|
|
// Send a message to the UI process that we're done.
|
|
|
|
GPUDeviceData data;
|
|
|
|
RecvGetDeviceStatus(&data);
|
|
|
|
Unused << SendInitComplete(data);
|
|
|
|
|
2017-01-03 23:13:36 +03:00
|
|
|
Telemetry::AccumulateTimeDelta(Telemetry::GPU_PROCESS_INITIALIZATION_TIME_MS, mLaunchTime);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-07-19 21:56:06 +03:00
|
|
|
}
|
2016-06-27 09:33:20 +03:00
|
|
|
|
2017-06-14 18:39:59 +03:00
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
GPUParent::RecvInitCompositorManager(Endpoint<PCompositorManagerParent>&& aEndpoint)
|
|
|
|
{
|
|
|
|
CompositorManagerParent::Create(Move(aEndpoint));
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-07-19 21:56:06 +03:00
|
|
|
GPUParent::RecvInitVsyncBridge(Endpoint<PVsyncBridgeParent>&& aVsyncEndpoint)
|
|
|
|
{
|
2016-10-12 10:08:36 +03:00
|
|
|
mVsyncBridge = VsyncBridgeParent::Start(Move(aVsyncEndpoint));
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-06-11 05:27:24 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-07-20 10:19:27 +03:00
|
|
|
GPUParent::RecvInitImageBridge(Endpoint<PImageBridgeParent>&& aEndpoint)
|
|
|
|
{
|
|
|
|
ImageBridgeParent::CreateForGPUProcess(Move(aEndpoint));
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-07-20 10:19:27 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-07-21 10:14:59 +03:00
|
|
|
GPUParent::RecvInitVRManager(Endpoint<PVRManagerParent>&& aEndpoint)
|
|
|
|
{
|
|
|
|
VRManagerParent::CreateForGPUProcess(Move(aEndpoint));
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-07-21 10:14:59 +03:00
|
|
|
}
|
|
|
|
|
2017-01-05 22:04:38 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2017-04-06 01:42:50 +03:00
|
|
|
GPUParent::RecvInitUiCompositorController(const uint64_t& aRootLayerTreeId, Endpoint<PUiCompositorControllerParent>&& aEndpoint)
|
2017-01-05 22:04:38 +03:00
|
|
|
{
|
2017-04-06 01:42:50 +03:00
|
|
|
UiCompositorControllerParent::Start(aRootLayerTreeId, Move(aEndpoint));
|
2017-01-05 22:04:38 +03:00
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2017-05-30 22:06:14 +03:00
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
GPUParent::RecvInitProfiler(Endpoint<PProfilerChild>&& aEndpoint)
|
|
|
|
{
|
|
|
|
#ifdef MOZ_GECKO_PROFILER
|
|
|
|
mProfilerController = ChildProfilerController::Create(Move(aEndpoint));
|
|
|
|
#endif
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-06-27 09:33:20 +03:00
|
|
|
GPUParent::RecvUpdatePref(const GfxPrefSetting& setting)
|
2016-06-11 05:27:24 +03:00
|
|
|
{
|
2016-06-27 09:33:20 +03:00
|
|
|
gfxPrefs::Pref* pref = gfxPrefs::all()[setting.index()];
|
|
|
|
pref->SetCachedValue(setting.value());
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-06-11 05:27:24 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-08-04 21:33:42 +03:00
|
|
|
GPUParent::RecvUpdateVar(const GfxVarUpdate& aUpdate)
|
|
|
|
{
|
|
|
|
gfxVars::ApplyUpdate(aUpdate);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-08-04 21:33:42 +03:00
|
|
|
}
|
|
|
|
|
2016-08-21 06:59:11 +03:00
|
|
|
static void
|
|
|
|
CopyFeatureChange(Feature aFeature, FeatureChange* aOut)
|
|
|
|
{
|
|
|
|
FeatureState& feature = gfxConfig::GetFeature(aFeature);
|
|
|
|
if (feature.DisabledByDefault() || feature.IsEnabled()) {
|
|
|
|
// No change:
|
|
|
|
// - Disabled-by-default means the parent process told us not to use this feature.
|
|
|
|
// - Enabled means we were told to use this feature, and we didn't discover anything
|
|
|
|
// that would prevent us from doing so.
|
|
|
|
*aOut = null_t();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_ASSERT(!feature.IsEnabled());
|
|
|
|
|
|
|
|
nsCString message;
|
|
|
|
message.AssignASCII(feature.GetFailureMessage());
|
|
|
|
|
|
|
|
*aOut = FeatureFailure(feature.GetValue(), message, feature.GetFailureId());
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-08-21 06:59:11 +03:00
|
|
|
GPUParent::RecvGetDeviceStatus(GPUDeviceData* aOut)
|
|
|
|
{
|
|
|
|
CopyFeatureChange(Feature::D3D11_COMPOSITING, &aOut->d3d11Compositing());
|
|
|
|
CopyFeatureChange(Feature::OPENGL_COMPOSITING, &aOut->oglCompositing());
|
2017-06-24 00:23:12 +03:00
|
|
|
CopyFeatureChange(Feature::ADVANCED_LAYERS, &aOut->advancedLayers());
|
2016-08-21 06:59:11 +03:00
|
|
|
|
|
|
|
#if defined(XP_WIN)
|
2016-08-24 01:18:55 +03:00
|
|
|
if (DeviceManagerDx* dm = DeviceManagerDx::Get()) {
|
2016-08-26 23:37:00 +03:00
|
|
|
D3D11DeviceStatus deviceStatus;
|
|
|
|
dm->ExportDeviceInfo(&deviceStatus);
|
|
|
|
aOut->gpuDevice() = deviceStatus;
|
2016-08-21 06:59:11 +03:00
|
|
|
}
|
2016-08-26 23:37:00 +03:00
|
|
|
#else
|
|
|
|
aOut->gpuDevice() = null_t();
|
2016-08-21 06:59:11 +03:00
|
|
|
#endif
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-08-21 06:59:11 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2017-06-14 18:39:59 +03:00
|
|
|
GPUParent::RecvNewContentCompositorManager(Endpoint<PCompositorManagerParent>&& aEndpoint)
|
2016-07-18 07:24:28 +03:00
|
|
|
{
|
2017-06-14 18:39:59 +03:00
|
|
|
CompositorManagerParent::Create(Move(aEndpoint));
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-07-18 07:24:28 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-07-20 10:19:27 +03:00
|
|
|
GPUParent::RecvNewContentImageBridge(Endpoint<PImageBridgeParent>&& aEndpoint)
|
|
|
|
{
|
2016-11-15 06:26:00 +03:00
|
|
|
if (!ImageBridgeParent::CreateForContent(Move(aEndpoint))) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2016-07-20 10:19:27 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-07-21 10:14:59 +03:00
|
|
|
GPUParent::RecvNewContentVRManager(Endpoint<PVRManagerParent>&& aEndpoint)
|
|
|
|
{
|
2016-11-15 06:26:00 +03:00
|
|
|
if (!VRManagerParent::CreateForContent(Move(aEndpoint))) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2016-07-21 10:14:59 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-09-21 12:25:33 +03:00
|
|
|
GPUParent::RecvNewContentVideoDecoderManager(Endpoint<PVideoDecoderManagerParent>&& aEndpoint)
|
|
|
|
{
|
2016-11-15 06:26:00 +03:00
|
|
|
if (!dom::VideoDecoderManagerParent::CreateForContent(Move(aEndpoint))) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2016-09-21 12:25:33 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2017-04-04 01:13:38 +03:00
|
|
|
GPUParent::RecvAddLayerTreeIdMapping(const LayerTreeIdMapping& aMapping)
|
2016-08-17 19:11:00 +03:00
|
|
|
{
|
2017-04-04 01:13:38 +03:00
|
|
|
LayerTreeOwnerTracker::Get()->Map(aMapping.layersId(), aMapping.ownerId());
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-08-17 19:11:00 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-11-02 23:55:07 +03:00
|
|
|
GPUParent::RecvRemoveLayerTreeIdMapping(const LayerTreeIdMapping& aMapping)
|
2016-08-16 23:59:13 +03:00
|
|
|
{
|
2016-11-02 23:55:07 +03:00
|
|
|
LayerTreeOwnerTracker::Get()->Unmap(aMapping.layersId(), aMapping.ownerId());
|
|
|
|
CompositorBridgeParent::DeallocateLayerTreeId(aMapping.layersId());
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-08-16 23:59:13 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-10-15 15:45:02 +03:00
|
|
|
GPUParent::RecvNotifyGpuObservers(const nsCString& aTopic)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
|
|
|
|
MOZ_ASSERT(obsSvc);
|
|
|
|
if (obsSvc) {
|
|
|
|
obsSvc->NotifyObservers(nullptr, aTopic.get(), nullptr);
|
|
|
|
}
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-10-15 15:45:02 +03:00
|
|
|
}
|
|
|
|
|
2017-01-27 03:35:54 +03:00
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
GPUParent::RecvRequestMemoryReport(const uint32_t& aGeneration,
|
|
|
|
const bool& aAnonymize,
|
|
|
|
const bool& aMinimizeMemoryUsage,
|
|
|
|
const MaybeFileDesc& aDMDFile)
|
|
|
|
{
|
|
|
|
nsPrintfCString processName("GPU (pid %u)", (unsigned)getpid());
|
|
|
|
|
|
|
|
mozilla::dom::MemoryReportRequestClient::Start(
|
|
|
|
aGeneration, aAnonymize, aMinimizeMemoryUsage, aDMDFile, processName);
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2016-06-11 05:27:24 +03:00
|
|
|
void
|
|
|
|
GPUParent::ActorDestroy(ActorDestroyReason aWhy)
|
|
|
|
{
|
|
|
|
if (AbnormalShutdown == aWhy) {
|
|
|
|
NS_WARNING("Shutting down GPU process early due to a crash!");
|
|
|
|
ProcessChild::QuickExit();
|
|
|
|
}
|
|
|
|
|
2016-09-21 12:24:44 +03:00
|
|
|
#ifdef XP_WIN
|
|
|
|
wmf::MFShutdown();
|
|
|
|
#endif
|
|
|
|
|
2016-06-11 05:37:03 +03:00
|
|
|
#ifndef NS_FREE_PERMANENT_DATA
|
|
|
|
// No point in going through XPCOM shutdown because we don't keep persistent
|
2016-08-23 03:25:52 +03:00
|
|
|
// state.
|
2016-06-11 05:37:03 +03:00
|
|
|
ProcessChild::QuickExit();
|
|
|
|
#endif
|
2016-07-18 07:24:28 +03:00
|
|
|
|
2017-05-30 22:06:14 +03:00
|
|
|
#ifdef MOZ_GECKO_PROFILER
|
|
|
|
if (mProfilerController) {
|
|
|
|
mProfilerController->Shutdown();
|
|
|
|
mProfilerController = nullptr;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-07-19 21:56:06 +03:00
|
|
|
if (mVsyncBridge) {
|
|
|
|
mVsyncBridge->Shutdown();
|
2016-10-12 10:08:36 +03:00
|
|
|
mVsyncBridge = nullptr;
|
2016-07-19 21:56:06 +03:00
|
|
|
}
|
2016-11-11 05:02:32 +03:00
|
|
|
dom::VideoDecoderManagerParent::ShutdownVideoBridge();
|
2016-07-18 07:24:28 +03:00
|
|
|
CompositorThreadHolder::Shutdown();
|
2017-02-07 06:22:44 +03:00
|
|
|
if (gfxVars::UseWebRender()) {
|
|
|
|
wr::RenderThread::ShutDown();
|
|
|
|
}
|
2016-10-15 23:04:00 +03:00
|
|
|
Factory::ShutDown();
|
2016-08-21 06:59:10 +03:00
|
|
|
#if defined(XP_WIN)
|
2016-08-24 01:18:55 +03:00
|
|
|
DeviceManagerDx::Shutdown();
|
2016-08-21 06:59:10 +03:00
|
|
|
#endif
|
2016-08-16 23:59:13 +03:00
|
|
|
LayerTreeOwnerTracker::Shutdown();
|
2016-08-13 22:25:18 +03:00
|
|
|
gfxVars::Shutdown();
|
|
|
|
gfxConfig::Shutdown();
|
|
|
|
gfxPrefs::DestroySingleton();
|
2016-10-12 00:25:41 +03:00
|
|
|
#ifdef MOZ_CRASHREPORTER
|
|
|
|
CrashReporterClient::DestroySingleton();
|
|
|
|
#endif
|
2016-07-18 07:24:28 +03:00
|
|
|
XRE_ShutdownChildProcess();
|
2016-06-11 05:27:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|