Commit 547daa15 authored by Andrew Osmond's avatar Andrew Osmond
Browse files

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

Differential Revision: https://phabricator.services.mozilla.com/D75450
parent aff13942
......@@ -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;
......
......@@ -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;
}
NS_IMETHOD_(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());
}
......@@ -88,6 +88,7 @@ class GfxInfoBase : public nsIGfxInfo,
virtual nsresult Init();
NS_IMETHOD_(void) GetData() override;
NS_IMETHOD_(int32_t) GetMaxRefreshRate() override { return -1; }
static void AddCollector(GfxInfoCollectorBase* collector);
static void RemoveCollector(GfxInfoCollectorBase* collector);
......
......@@ -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();
......
......@@ -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
......
......@@ -55,6 +55,7 @@ class GfxInfo : public GfxInfoBase {
using GfxInfoBase::GetFeatureSuggestedDriverVersion;
nsresult Init() override;
NS_IMETHOD_(int32_t) GetMaxRefreshRate() override;
uint32_t OperatingSystemVersion() override { return mWindowsVersion; }
uint32_t OperatingSystemBuild() override { return mWindowsBuildNumber; }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment