2020-05-04 04:01:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* 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 "mozilla/gfx/gfxConfigManager.h"
|
|
|
|
#include "mozilla/gfx/gfxVars.h"
|
|
|
|
#include "mozilla/Preferences.h"
|
2021-02-18 16:26:29 +03:00
|
|
|
#include "mozilla/Components.h"
|
2020-05-04 04:01:53 +03:00
|
|
|
#include "mozilla/StaticPrefs_gfx.h"
|
|
|
|
#include "mozilla/StaticPrefs_layers.h"
|
|
|
|
#include "gfxConfig.h"
|
|
|
|
#include "gfxPlatform.h"
|
|
|
|
#include "nsIGfxInfo.h"
|
2020-11-23 19:21:38 +03:00
|
|
|
#include "nsPrintfCString.h"
|
2020-05-04 04:01:53 +03:00
|
|
|
#include "nsXULAppAPI.h"
|
|
|
|
|
|
|
|
#ifdef XP_WIN
|
|
|
|
# include "mozilla/WindowsVersion.h"
|
|
|
|
# include "mozilla/gfx/DeviceManagerDx.h"
|
|
|
|
# include "mozilla/gfx/DisplayConfigWindows.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
|
|
|
|
void gfxConfigManager::Init() {
|
|
|
|
MOZ_ASSERT(XRE_IsParentProcess());
|
|
|
|
|
|
|
|
EmplaceUserPref("gfx.webrender.compositor", mWrCompositorEnabled);
|
|
|
|
mWrForceEnabled = gfxPlatform::WebRenderPrefEnabled();
|
2020-11-20 20:38:53 +03:00
|
|
|
mWrSoftwareForceEnabled = StaticPrefs::gfx_webrender_software_AtStartup();
|
2020-05-04 04:01:53 +03:00
|
|
|
mWrCompositorForceEnabled =
|
|
|
|
StaticPrefs::gfx_webrender_compositor_force_enabled_AtStartup();
|
|
|
|
mGPUProcessAllowSoftware =
|
|
|
|
StaticPrefs::layers_gpu_process_allow_software_AtStartup();
|
2022-01-21 19:24:06 +03:00
|
|
|
mWrForcePartialPresent =
|
|
|
|
StaticPrefs::gfx_webrender_force_partial_present_AtStartup();
|
2020-05-04 04:01:53 +03:00
|
|
|
mWrPartialPresent =
|
|
|
|
StaticPrefs::gfx_webrender_max_partial_present_rects_AtStartup() > 0;
|
2021-04-12 18:14:12 +03:00
|
|
|
EmplaceUserPref(StaticPrefs::GetPrefName_gfx_webrender_program_binary_disk(),
|
|
|
|
mWrShaderCache);
|
2021-02-11 16:47:59 +03:00
|
|
|
mWrOptimizedShaders =
|
|
|
|
StaticPrefs::gfx_webrender_use_optimized_shaders_AtStartup();
|
2020-05-04 04:01:53 +03:00
|
|
|
#ifdef XP_WIN
|
|
|
|
mWrForceAngle = StaticPrefs::gfx_webrender_force_angle_AtStartup();
|
|
|
|
mWrForceAngleNoGPUProcess = StaticPrefs::
|
|
|
|
gfx_webrender_enabled_no_gpu_process_with_angle_win_AtStartup();
|
|
|
|
mWrDCompWinEnabled =
|
|
|
|
Preferences::GetBool("gfx.webrender.dcomp-win.enabled", false);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
mWrEnvForceEnabled = gfxPlatform::WebRenderEnvvarEnabled();
|
|
|
|
|
|
|
|
#ifdef XP_WIN
|
2020-10-22 22:53:23 +03:00
|
|
|
DeviceManagerDx::Get()->CheckHardwareStretchingSupport(mHwStretchingSupport);
|
2020-05-04 04:01:53 +03:00
|
|
|
mScaledResolution = HasScaledResolution();
|
|
|
|
mIsWin10OrLater = IsWin10OrLater();
|
2020-05-18 20:46:05 +03:00
|
|
|
mWrCompositorDCompRequired = true;
|
2020-05-04 04:01:53 +03:00
|
|
|
#else
|
2020-10-22 22:53:23 +03:00
|
|
|
++mHwStretchingSupport.mBoth;
|
2020-05-04 04:01:53 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef MOZ_WIDGET_GTK
|
|
|
|
mDisableHwCompositingNoWr = true;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef NIGHTLY_BUILD
|
|
|
|
mIsNightly = true;
|
2021-03-11 23:09:21 +03:00
|
|
|
#endif
|
|
|
|
#ifdef EARLY_BETA_OR_EARLIER
|
|
|
|
mIsEarlyBetaOrEarlier = true;
|
2020-05-04 04:01:53 +03:00
|
|
|
#endif
|
|
|
|
mSafeMode = gfxPlatform::InSafeMode();
|
|
|
|
|
2021-02-18 16:26:29 +03:00
|
|
|
mGfxInfo = components::GfxInfo::Service();
|
2020-05-04 04:01:53 +03:00
|
|
|
|
|
|
|
mFeatureWr = &gfxConfig::GetFeature(Feature::WEBRENDER);
|
|
|
|
mFeatureWrQualified = &gfxConfig::GetFeature(Feature::WEBRENDER_QUALIFIED);
|
|
|
|
mFeatureWrCompositor = &gfxConfig::GetFeature(Feature::WEBRENDER_COMPOSITOR);
|
|
|
|
mFeatureWrAngle = &gfxConfig::GetFeature(Feature::WEBRENDER_ANGLE);
|
|
|
|
mFeatureWrDComp = &gfxConfig::GetFeature(Feature::WEBRENDER_DCOMP_PRESENT);
|
|
|
|
mFeatureWrPartial = &gfxConfig::GetFeature(Feature::WEBRENDER_PARTIAL);
|
2021-04-12 18:14:12 +03:00
|
|
|
mFeatureWrShaderCache =
|
|
|
|
&gfxConfig::GetFeature(Feature::WEBRENDER_SHADER_CACHE);
|
2021-02-11 16:47:59 +03:00
|
|
|
mFeatureWrOptimizedShaders =
|
|
|
|
&gfxConfig::GetFeature(Feature::WEBRENDER_OPTIMIZED_SHADERS);
|
2020-11-11 02:36:43 +03:00
|
|
|
mFeatureWrSoftware = &gfxConfig::GetFeature(Feature::WEBRENDER_SOFTWARE);
|
2020-05-04 04:01:53 +03:00
|
|
|
|
|
|
|
mFeatureHwCompositing = &gfxConfig::GetFeature(Feature::HW_COMPOSITING);
|
|
|
|
#ifdef XP_WIN
|
|
|
|
mFeatureD3D11HwAngle = &gfxConfig::GetFeature(Feature::D3D11_HW_ANGLE);
|
2021-03-11 23:09:21 +03:00
|
|
|
mFeatureD3D11Compositing = &gfxConfig::GetFeature(Feature::D3D11_COMPOSITING);
|
2020-05-04 04:01:53 +03:00
|
|
|
#endif
|
|
|
|
mFeatureGPUProcess = &gfxConfig::GetFeature(Feature::GPU_PROCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
void gfxConfigManager::EmplaceUserPref(const char* aPrefName,
|
|
|
|
Maybe<bool>& aValue) {
|
|
|
|
if (Preferences::HasUserValue(aPrefName)) {
|
|
|
|
aValue.emplace(Preferences::GetBool(aPrefName, false));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void gfxConfigManager::ConfigureFromBlocklist(long aFeature,
|
|
|
|
FeatureState* aFeatureState) {
|
|
|
|
MOZ_ASSERT(aFeatureState);
|
|
|
|
|
|
|
|
nsCString blockId;
|
|
|
|
int32_t status;
|
|
|
|
if (!NS_SUCCEEDED(mGfxInfo->GetFeatureStatus(aFeature, blockId, &status))) {
|
|
|
|
aFeatureState->Disable(FeatureStatus::BlockedNoGfxInfo, "gfxInfo is broken",
|
|
|
|
"FEATURE_FAILURE_NO_GFX_INFO"_ns);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
|
2020-06-23 18:13:57 +03:00
|
|
|
aFeatureState->Disable(FeatureStatus::Blocklisted,
|
2020-06-23 18:23:11 +03:00
|
|
|
"Blocklisted by gfxInfo", blockId);
|
2020-05-04 04:01:53 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-13 08:40:10 +03:00
|
|
|
void gfxConfigManager::ConfigureWebRenderQualified() {
|
2020-05-04 04:01:53 +03:00
|
|
|
MOZ_ASSERT(mFeatureWrQualified);
|
|
|
|
MOZ_ASSERT(mFeatureWrCompositor);
|
|
|
|
|
|
|
|
mFeatureWrQualified->EnableByDefault();
|
|
|
|
|
|
|
|
nsCString failureId;
|
|
|
|
int32_t status;
|
|
|
|
if (NS_FAILED(mGfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBRENDER,
|
|
|
|
failureId, &status))) {
|
|
|
|
mFeatureWrQualified->Disable(FeatureStatus::BlockedNoGfxInfo,
|
|
|
|
"gfxInfo is broken",
|
|
|
|
"FEATURE_FAILURE_WR_NO_GFX_INFO"_ns);
|
2020-11-13 08:40:10 +03:00
|
|
|
return;
|
2020-05-04 04:01:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
case nsIGfxInfo::FEATURE_ALLOW_ALWAYS:
|
|
|
|
case nsIGfxInfo::FEATURE_ALLOW_QUALIFIED:
|
|
|
|
break;
|
|
|
|
case nsIGfxInfo::FEATURE_DENIED:
|
|
|
|
mFeatureWrQualified->Disable(FeatureStatus::Denied, "Not on allowlist",
|
|
|
|
failureId);
|
|
|
|
break;
|
|
|
|
default:
|
2020-06-23 18:13:57 +03:00
|
|
|
mFeatureWrQualified->Disable(FeatureStatus::Blocklisted,
|
2020-05-04 04:01:53 +03:00
|
|
|
"No qualified hardware", failureId);
|
|
|
|
break;
|
|
|
|
case nsIGfxInfo::FEATURE_STATUS_OK:
|
|
|
|
MOZ_ASSERT_UNREACHABLE("We should still be rolling out WebRender!");
|
|
|
|
mFeatureWrQualified->Disable(FeatureStatus::Blocked,
|
|
|
|
"Not controlled by rollout", failureId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void gfxConfigManager::ConfigureWebRender() {
|
|
|
|
MOZ_ASSERT(XRE_IsParentProcess());
|
|
|
|
MOZ_ASSERT(mFeatureWr);
|
|
|
|
MOZ_ASSERT(mFeatureWrQualified);
|
|
|
|
MOZ_ASSERT(mFeatureWrCompositor);
|
|
|
|
MOZ_ASSERT(mFeatureWrAngle);
|
|
|
|
MOZ_ASSERT(mFeatureWrDComp);
|
|
|
|
MOZ_ASSERT(mFeatureWrPartial);
|
2021-04-12 18:14:12 +03:00
|
|
|
MOZ_ASSERT(mFeatureWrShaderCache);
|
|
|
|
MOZ_ASSERT(mFeatureWrOptimizedShaders);
|
2020-11-11 02:36:43 +03:00
|
|
|
MOZ_ASSERT(mFeatureWrSoftware);
|
2020-05-04 04:01:53 +03:00
|
|
|
MOZ_ASSERT(mFeatureHwCompositing);
|
|
|
|
MOZ_ASSERT(mFeatureGPUProcess);
|
|
|
|
|
|
|
|
// Initialize WebRender native compositor usage
|
|
|
|
mFeatureWrCompositor->SetDefaultFromPref("gfx.webrender.compositor", true,
|
|
|
|
false, mWrCompositorEnabled);
|
|
|
|
|
|
|
|
if (mWrCompositorForceEnabled) {
|
|
|
|
mFeatureWrCompositor->UserForceEnable("Force enabled by pref");
|
|
|
|
}
|
|
|
|
|
|
|
|
ConfigureFromBlocklist(nsIGfxInfo::FEATURE_WEBRENDER_COMPOSITOR,
|
|
|
|
mFeatureWrCompositor);
|
|
|
|
|
|
|
|
// Disable native compositor when hardware stretching is not supported. It is
|
|
|
|
// for avoiding a problem like Bug 1618370.
|
|
|
|
// XXX Is there a better check for Bug 1618370?
|
2020-10-22 22:53:23 +03:00
|
|
|
if (!mHwStretchingSupport.IsFullySupported() && mScaledResolution) {
|
|
|
|
nsPrintfCString failureId(
|
|
|
|
"FEATURE_FAILURE_NO_HARDWARE_STRETCHING_B%uW%uF%uN%uE%u",
|
|
|
|
mHwStretchingSupport.mBoth, mHwStretchingSupport.mWindowOnly,
|
|
|
|
mHwStretchingSupport.mFullScreenOnly, mHwStretchingSupport.mNone,
|
|
|
|
mHwStretchingSupport.mError);
|
2020-05-04 04:01:53 +03:00
|
|
|
mFeatureWrCompositor->Disable(FeatureStatus::Unavailable,
|
2020-10-22 22:53:23 +03:00
|
|
|
"No hardware stretching support", failureId);
|
2020-05-04 04:01:53 +03:00
|
|
|
}
|
|
|
|
|
2021-08-12 19:21:05 +03:00
|
|
|
mFeatureWr->EnableByDefault();
|
2021-08-12 23:28:53 +03:00
|
|
|
mFeatureWrSoftware->EnableByDefault();
|
|
|
|
ConfigureWebRenderQualified();
|
2021-08-12 19:21:05 +03:00
|
|
|
|
2020-05-04 04:01:53 +03:00
|
|
|
// envvar works everywhere; note that we need this for testing in CI.
|
|
|
|
// Prior to bug 1523788, the `prefEnabled` check was only done on Nightly,
|
|
|
|
// so as to prevent random users from easily enabling WebRender on
|
|
|
|
// unqualified hardware in beta/release.
|
2021-01-14 22:59:10 +03:00
|
|
|
if (mWrSoftwareForceEnabled) {
|
|
|
|
MOZ_ASSERT(mFeatureWrSoftware->IsEnabled());
|
|
|
|
mFeatureWr->UserDisable("User force-enabled software WR",
|
|
|
|
"FEATURE_FAILURE_USER_FORCE_ENABLED_SW_WR"_ns);
|
|
|
|
} else if (mWrEnvForceEnabled) {
|
2020-10-01 17:22:33 +03:00
|
|
|
mFeatureWr->UserForceEnable("Force enabled by envvar");
|
2021-06-02 01:03:10 +03:00
|
|
|
} else if (mWrForceEnabled) {
|
|
|
|
mFeatureWr->UserForceEnable("Force enabled by pref");
|
2020-10-01 17:22:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!mFeatureWrQualified->IsEnabled()) {
|
2020-11-11 02:36:43 +03:00
|
|
|
// No qualified hardware. If we haven't allowed software fallback,
|
|
|
|
// then we need to disable WR.
|
2021-01-14 22:59:10 +03:00
|
|
|
mFeatureWr->Disable(FeatureStatus::Disabled, "Not qualified",
|
|
|
|
"FEATURE_FAILURE_NOT_QUALIFIED"_ns);
|
2020-05-04 04:01:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// HW_COMPOSITING being disabled implies interfacing with the GPU might break
|
2021-01-14 22:59:10 +03:00
|
|
|
if (!mFeatureHwCompositing->IsEnabled()) {
|
2020-05-04 04:01:53 +03:00
|
|
|
mFeatureWr->ForceDisable(FeatureStatus::UnavailableNoHwCompositing,
|
|
|
|
"Hardware compositing is disabled",
|
|
|
|
"FEATURE_FAILURE_WEBRENDER_NEED_HWCOMP"_ns);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mSafeMode) {
|
|
|
|
mFeatureWr->ForceDisable(FeatureStatus::UnavailableInSafeMode,
|
|
|
|
"Safe-mode is enabled",
|
|
|
|
"FEATURE_FAILURE_SAFE_MODE"_ns);
|
|
|
|
}
|
|
|
|
|
2020-10-01 17:22:33 +03:00
|
|
|
mFeatureWrAngle->EnableByDefault();
|
|
|
|
if (mFeatureD3D11HwAngle) {
|
|
|
|
if (mWrForceAngle) {
|
|
|
|
if (!mFeatureD3D11HwAngle->IsEnabled()) {
|
|
|
|
mFeatureWrAngle->ForceDisable(FeatureStatus::UnavailableNoAngle,
|
|
|
|
"ANGLE is disabled",
|
|
|
|
mFeatureD3D11HwAngle->GetFailureId());
|
|
|
|
} else if (!mFeatureGPUProcess->IsEnabled() &&
|
2020-11-17 22:34:22 +03:00
|
|
|
!mWrForceAngleNoGPUProcess) {
|
2020-10-01 17:22:33 +03:00
|
|
|
// WebRender with ANGLE relies on the GPU process when on Windows
|
|
|
|
mFeatureWrAngle->ForceDisable(
|
|
|
|
FeatureStatus::UnavailableNoGpuProcess, "GPU Process is disabled",
|
|
|
|
"FEATURE_FAILURE_GPU_PROCESS_DISABLED"_ns);
|
2021-01-14 22:59:10 +03:00
|
|
|
} else if (!mFeatureWr->IsEnabled() && !mFeatureWrSoftware->IsEnabled()) {
|
2020-10-01 17:22:33 +03:00
|
|
|
mFeatureWrAngle->ForceDisable(FeatureStatus::Unavailable,
|
|
|
|
"WebRender disabled",
|
|
|
|
"FEATURE_FAILURE_WR_DISABLED"_ns);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mFeatureWrAngle->Disable(FeatureStatus::Disabled, "ANGLE is not forced",
|
|
|
|
"FEATURE_FAILURE_ANGLE_NOT_FORCED"_ns);
|
2020-05-04 04:01:53 +03:00
|
|
|
}
|
2020-10-01 17:22:33 +03:00
|
|
|
} else {
|
|
|
|
mFeatureWrAngle->Disable(FeatureStatus::Unavailable, "OS not supported",
|
|
|
|
"FEATURE_FAILURE_OS_NOT_SUPPORTED"_ns);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mWrForceAngle && mFeatureWr->IsEnabled() &&
|
|
|
|
!mFeatureWrAngle->IsEnabled()) {
|
|
|
|
// Ensure we disable WebRender if ANGLE is unavailable and it is required.
|
|
|
|
mFeatureWr->ForceDisable(FeatureStatus::UnavailableNoAngle,
|
|
|
|
"ANGLE is disabled",
|
|
|
|
mFeatureWrAngle->GetFailureId());
|
2020-05-04 04:01:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!mFeatureWr->IsEnabled() && mDisableHwCompositingNoWr) {
|
|
|
|
if (mFeatureHwCompositing->IsEnabled()) {
|
|
|
|
// Hardware compositing should be disabled by default if we aren't using
|
|
|
|
// WebRender. We had to check if it is enabled at all, because it may
|
|
|
|
// already have been forced disabled (e.g. safe mode, headless). It may
|
|
|
|
// still be forced on by the user, and if so, this should have no effect.
|
|
|
|
mFeatureHwCompositing->Disable(FeatureStatus::Blocked,
|
2020-09-23 18:17:15 +03:00
|
|
|
"Acceleration blocked by platform", ""_ns);
|
2020-05-04 04:01:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!mFeatureHwCompositing->IsEnabled() &&
|
|
|
|
mFeatureGPUProcess->IsEnabled() && !mGPUProcessAllowSoftware) {
|
|
|
|
// We have neither WebRender nor OpenGL, we don't allow the GPU process
|
|
|
|
// for basic compositor, and it wasn't disabled already.
|
|
|
|
mFeatureGPUProcess->Disable(FeatureStatus::Unavailable,
|
|
|
|
"Hardware compositing is unavailable.",
|
2020-09-23 18:17:15 +03:00
|
|
|
""_ns);
|
2020-05-04 04:01:53 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-28 18:48:29 +03:00
|
|
|
mFeatureWrDComp->EnableByDefault();
|
|
|
|
if (!mWrDCompWinEnabled) {
|
|
|
|
mFeatureWrDComp->UserDisable("User disabled via pref",
|
|
|
|
"FEATURE_FAILURE_DCOMP_PREF_DISABLED"_ns);
|
|
|
|
}
|
2020-05-04 04:01:53 +03:00
|
|
|
|
2020-09-28 18:48:29 +03:00
|
|
|
if (!mIsWin10OrLater) {
|
2020-05-04 04:01:53 +03:00
|
|
|
// XXX relax win version to windows 8.
|
2020-09-28 18:48:29 +03:00
|
|
|
mFeatureWrDComp->Disable(FeatureStatus::Unavailable,
|
|
|
|
"Requires Windows 10 or later",
|
|
|
|
"FEATURE_FAILURE_DCOMP_NOT_WIN10"_ns);
|
2020-05-04 04:01:53 +03:00
|
|
|
}
|
|
|
|
|
2021-04-14 03:00:15 +03:00
|
|
|
if (!mIsNightly) {
|
|
|
|
// Disable DirectComposition for NVIDIA users with high/mixed refresh rate
|
|
|
|
// monitors due to rendering artifacts.
|
|
|
|
nsAutoString adapterVendorID;
|
|
|
|
mGfxInfo->GetAdapterVendorID(adapterVendorID);
|
|
|
|
if (adapterVendorID == u"0x10de") {
|
|
|
|
bool mixed = false;
|
|
|
|
int32_t maxRefreshRate = mGfxInfo->GetMaxRefreshRate(&mixed);
|
|
|
|
if (maxRefreshRate > 60 && mixed) {
|
|
|
|
mFeatureWrDComp->Disable(FeatureStatus::Blocked,
|
|
|
|
"Monitor refresh rate too high/mixed",
|
|
|
|
"NVIDIA_REFRESH_RATE_MIXED"_ns);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-28 18:48:29 +03:00
|
|
|
mFeatureWrDComp->MaybeSetFailed(
|
|
|
|
mFeatureWr->IsEnabled(), FeatureStatus::Unavailable, "Requires WebRender",
|
|
|
|
"FEATURE_FAILURE_DCOMP_NOT_WR"_ns);
|
|
|
|
mFeatureWrDComp->MaybeSetFailed(mFeatureWrAngle->IsEnabled(),
|
|
|
|
FeatureStatus::Unavailable, "Requires ANGLE",
|
|
|
|
"FEATURE_FAILURE_DCOMP_NOT_ANGLE"_ns);
|
|
|
|
|
2020-05-18 20:46:05 +03:00
|
|
|
if (!mFeatureWrDComp->IsEnabled() && mWrCompositorDCompRequired) {
|
2020-09-24 17:14:44 +03:00
|
|
|
mFeatureWrCompositor->ForceDisable(FeatureStatus::Unavailable,
|
|
|
|
"No DirectComposition usage",
|
|
|
|
mFeatureWrDComp->GetFailureId());
|
2020-05-04 04:01:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize WebRender partial present config.
|
|
|
|
// Partial present is used only when WebRender compositor is not used.
|
2022-01-21 19:24:06 +03:00
|
|
|
mFeatureWrPartial->SetDefault(mWrPartialPresent, FeatureStatus::Disabled,
|
|
|
|
"User disabled via pref");
|
|
|
|
if (mWrForcePartialPresent) {
|
|
|
|
mFeatureWrPartial->UserForceEnable("Force enabled by pref");
|
2020-05-04 04:01:53 +03:00
|
|
|
}
|
2021-02-11 16:47:59 +03:00
|
|
|
|
2022-01-21 19:24:06 +03:00
|
|
|
ConfigureFromBlocklist(nsIGfxInfo::FEATURE_WEBRENDER_PARTIAL_PRESENT,
|
|
|
|
mFeatureWrPartial);
|
|
|
|
|
2021-04-12 18:14:12 +03:00
|
|
|
mFeatureWrShaderCache->SetDefaultFromPref(
|
|
|
|
StaticPrefs::GetPrefName_gfx_webrender_program_binary_disk(), true,
|
|
|
|
StaticPrefs::GetPrefDefault_gfx_webrender_program_binary_disk(),
|
|
|
|
mWrShaderCache);
|
|
|
|
ConfigureFromBlocklist(nsIGfxInfo::FEATURE_WEBRENDER_SHADER_CACHE,
|
|
|
|
mFeatureWrShaderCache);
|
|
|
|
if (!mFeatureWr->IsEnabled()) {
|
|
|
|
mFeatureWrShaderCache->ForceDisable(FeatureStatus::Unavailable,
|
|
|
|
"WebRender disabled",
|
|
|
|
"FEATURE_FAILURE_WR_DISABLED"_ns);
|
|
|
|
}
|
|
|
|
|
2021-02-11 16:47:59 +03:00
|
|
|
mFeatureWrOptimizedShaders->EnableByDefault();
|
|
|
|
if (!mWrOptimizedShaders) {
|
|
|
|
mFeatureWrOptimizedShaders->UserDisable("User disabled via pref",
|
|
|
|
"FEATURE_FAILURE_PREF_DISABLED"_ns);
|
|
|
|
}
|
|
|
|
ConfigureFromBlocklist(nsIGfxInfo::FEATURE_WEBRENDER_OPTIMIZED_SHADERS,
|
|
|
|
mFeatureWrOptimizedShaders);
|
|
|
|
if (!mFeatureWr->IsEnabled()) {
|
|
|
|
mFeatureWrOptimizedShaders->ForceDisable(FeatureStatus::Unavailable,
|
|
|
|
"WebRender disabled",
|
|
|
|
"FEATURE_FAILURE_WR_DISABLED"_ns);
|
|
|
|
}
|
2020-05-04 04:01:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|