Bug 1477036. Expose wrQualified in telemetry. r=kats

This adds a WEBRENDER_QUALIFIED feature that's set whenever the webrender could
be used on a machine regardless of whether it's actually being used.

MozReview-Commit-ID: Eke6PMKQOnx

--HG--
extra : rebase_source : 977d371c12c9e8ab3273d6e65655e0378c22c226
This commit is contained in:
Jeff Muizelaar 2018-07-19 14:05:29 -04:00
parent 4f9417ef01
commit c4b5567231
3 changed files with 32 additions and 12 deletions

View File

@ -25,6 +25,7 @@ namespace gfx {
_(DIRECT_DRAW, Feature, "DirectDraw") \
_(GPU_PROCESS, Feature, "GPU Process") \
_(WEBRENDER, Feature, "WebRender") \
_(WEBRENDER_QUALIFIED, Feature, "WebRender qualified") \
_(OMTP, Feature, "Off Main Thread Painting") \
_(ADVANCED_LAYERS, Feature, "Advanced Layers") \
/* Add new entries above this comment */

View File

@ -2563,6 +2563,28 @@ gfxPlatform::InitWebRenderConfig()
return;
}
FeatureState& featureWebRenderQualified = gfxConfig::GetFeature(Feature::WEBRENDER_QUALIFIED);
featureWebRenderQualified.EnableByDefault();
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
nsCString failureId;
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBRENDER,
failureId, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
featureWebRenderQualified.Disable(FeatureStatus::Blocked,
"No qualified hardware",
failureId);
} else if (HasBattery()) {
featureWebRenderQualified.Disable(FeatureStatus::Blocked,
"Has battery",
NS_LITERAL_CSTRING("FEATURE_FAILURE_WR_HAS_BATTERY"));
}
} else {
featureWebRenderQualified.Disable(FeatureStatus::Blocked,
"gfxInfo is broken",
NS_LITERAL_CSTRING("FEATURE_FAILURE_WR_NO_GFX_INFO"));
}
FeatureState& featureWebRender = gfxConfig::GetFeature(Feature::WEBRENDER);
featureWebRender.DisableByDefault(
@ -2584,18 +2606,12 @@ gfxPlatform::InitWebRenderConfig()
// gfx.webrender.all.qualified works on all channels
} else if (gfxPrefs::WebRenderAllQualified()) {
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
nsCString discardFailureId;
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBRENDER,
discardFailureId, &status))) {
if (status == nsIGfxInfo::FEATURE_STATUS_OK && !HasBattery()) {
featureWebRender.UserEnable("Qualified enabled by pref ");
} else {
featureWebRender.ForceDisable(FeatureStatus::Blocked,
"Qualified enable blocked",
discardFailureId);
}
if (featureWebRenderQualified.IsEnabled()) {
featureWebRender.UserEnable("Qualified enabled by pref ");
} else {
featureWebRender.ForceDisable(FeatureStatus::Blocked,
"Qualified enable blocked",
failureId);
}
}

View File

@ -1401,6 +1401,9 @@ GfxInfoBase::DescribeFeatures(JSContext* aCx, JS::Handle<JSObject*> aObj)
gfx::FeatureStatus gpuProcess = gfxConfig::GetValue(Feature::GPU_PROCESS);
InitFeatureObject(aCx, aObj, "gpuProcess", gpuProcess, &obj);
gfx::FeatureStatus wrQualified = gfxConfig::GetValue(Feature::WEBRENDER_QUALIFIED);
InitFeatureObject(aCx, aObj, "wrQualified", wrQualified, &obj);
// Only include AL if the platform attempted to use it.
gfx::FeatureStatus advancedLayers = gfxConfig::GetValue(Feature::ADVANCED_LAYERS);
if (advancedLayers != FeatureStatus::Unused) {