Bug 1638011 - Block WebRender in release for high refresh rate monitors. r=jrmuizel

Differential Revision: https://phabricator.services.mozilla.com/D75450
This commit is contained in:
Andrew Osmond 2020-05-15 01:35:00 +00:00
parent 1c6be41aa9
commit d6ab670bf8
6 changed files with 58 additions and 0 deletions

View File

@ -176,6 +176,13 @@ bool gfxConfigManager::ConfigureWebRenderQualified() {
NS_LITERAL_CSTRING("INTEL_BATTERY_REQUIRES_DCOMP"));
}
}
int32_t maxRefreshRate = mGfxInfo->GetMaxRefreshRate();
if (maxRefreshRate >= 60) {
mFeatureWrQualified->Disable(FeatureStatus::Blocked,
"Monitor refresh rate too high",
NS_LITERAL_CSTRING("REFRESH_RATE_TOO_HIGH"));
}
}
return guarded;

View File

@ -21,6 +21,7 @@ class MockGfxInfo final : public nsIGfxInfo {
int32_t mStatusWr;
int32_t mStatusWrCompositor;
int32_t mMaxRefreshRate;
Maybe<bool> mHasBattery;
const char* mVendorId;
@ -28,6 +29,7 @@ class MockGfxInfo final : public nsIGfxInfo {
MockGfxInfo()
: mStatusWr(nsIGfxInfo::FEATURE_ALLOW_ALWAYS),
mStatusWrCompositor(nsIGfxInfo::FEATURE_STATUS_OK),
mMaxRefreshRate(-1),
mHasBattery(Some(false)),
mVendorId("0x10de") {}
@ -62,6 +64,8 @@ class MockGfxInfo final : public nsIGfxInfo {
return NS_OK;
}
int32_t GetMaxRefreshRate() override { return mMaxRefreshRate; }
// The following methods we don't need for testing gfxConfigManager.
NS_IMETHOD GetFeatureSuggestedDriverVersion(int32_t aFeature,
nsAString& _retval) override {
@ -622,3 +626,35 @@ TEST_F(GfxConfigManager, WebRenderIntelBatteryNoHwStretchingNotNightly) {
EXPECT_TRUE(mFeatures.mGPUProcess.IsEnabled());
EXPECT_TRUE(mFeatures.mD3D11HwAngle.IsEnabled());
}
TEST_F(GfxConfigManager, WebRenderHighRefreshRateNightly) {
mIsNightly = true;
mMockGfxInfo->mMaxRefreshRate = 120;
ConfigureWebRender();
EXPECT_TRUE(mFeatures.mWrQualified.IsEnabled());
EXPECT_TRUE(mFeatures.mWr.IsEnabled());
EXPECT_TRUE(mFeatures.mWrCompositor.IsEnabled());
EXPECT_TRUE(mFeatures.mWrAngle.IsEnabled());
EXPECT_TRUE(mFeatures.mWrDComp.IsEnabled());
EXPECT_TRUE(mFeatures.mWrPartial.IsEnabled());
EXPECT_TRUE(mFeatures.mHwCompositing.IsEnabled());
EXPECT_TRUE(mFeatures.mGPUProcess.IsEnabled());
EXPECT_TRUE(mFeatures.mD3D11HwAngle.IsEnabled());
}
TEST_F(GfxConfigManager, WebRenderHighRefreshRateNotNightly) {
mIsNightly = false;
mMockGfxInfo->mMaxRefreshRate = 120;
ConfigureWebRender();
EXPECT_FALSE(mFeatures.mWrQualified.IsEnabled());
EXPECT_FALSE(mFeatures.mWr.IsEnabled());
EXPECT_FALSE(mFeatures.mWrCompositor.IsEnabled());
EXPECT_FALSE(mFeatures.mWrAngle.IsEnabled());
EXPECT_FALSE(mFeatures.mWrDComp.IsEnabled());
EXPECT_FALSE(mFeatures.mWrPartial.IsEnabled());
EXPECT_TRUE(mFeatures.mHwCompositing.IsEnabled());
EXPECT_TRUE(mFeatures.mGPUProcess.IsEnabled());
EXPECT_TRUE(mFeatures.mD3D11HwAngle.IsEnabled());
}

View File

@ -88,6 +88,7 @@ class GfxInfoBase : public nsIGfxInfo,
virtual nsresult Init();
NS_IMETHOD_(void) GetData() override;
int32_t GetMaxRefreshRate() override { return -1; }
static void AddCollector(GfxInfoCollectorBase* collector);
static void RemoveCollector(GfxInfoCollectorBase* collector);

View File

@ -204,6 +204,11 @@ interface nsIGfxInfo : nsISupports
// only useful on X11
[noscript, notxpcom] void GetData();
/**
* Maximum refresh rate among detected monitors. -1 if unknown.
*/
[noscript, notxpcom] long GetMaxRefreshRate();
[implicit_jscontext]
jsval getInfo();

View File

@ -78,6 +78,14 @@ GfxInfo::GetHasBattery(bool* aHasBattery) {
return NS_OK;
}
int32_t GfxInfo::GetMaxRefreshRate() {
int32_t refreshRate = -1;
for (auto displayInfo : mDisplayInfo) {
refreshRate = std::max(refreshRate, int32_t(displayInfo.mRefreshRate));
}
return refreshRate;
}
#define PIXEL_STRUCT_RGB 1
#define PIXEL_STRUCT_BGR 2

View File

@ -55,6 +55,7 @@ class GfxInfo : public GfxInfoBase {
using GfxInfoBase::GetFeatureSuggestedDriverVersion;
nsresult Init() override;
int32_t GetMaxRefreshRate() override;
uint32_t OperatingSystemVersion() override { return mWindowsVersion; }
uint32_t OperatingSystemBuild() override { return mWindowsBuildNumber; }