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
--- a/gfx/config/gfxFeature.h
+++ b/gfx/config/gfxFeature.h
@@ -20,16 +20,17 @@ namespace gfx {
_(HW_COMPOSITING, Feature, "Compositing") \
_(D3D11_COMPOSITING, Feature, "Direct3D11 Compositing") \
_(OPENGL_COMPOSITING, Feature, "OpenGL Compositing") \
_(DIRECT2D, Feature, "Direct2D") \
_(D3D11_HW_ANGLE, Feature, "Direct3D11 hardware ANGLE") \
_(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 */
enum class Feature : uint32_t {
#define MAKE_ENUM(name, type, desc) name,
GFX_FEATURE_MAP(MAKE_ENUM)
#undef MAKE_ENUM
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2578,16 +2578,38 @@ gfxPlatform::InitWebRenderConfig()
// later in this function. For other processes we still want to report
// the state of the feature for crash reports.
if (gfxVars::UseWebRender()) {
reporter.SetSuccessful();
}
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(
FeatureStatus::OptIn,
"WebRender is an opt-in feature",
NS_LITERAL_CSTRING("FEATURE_FAILURE_DEFAULT_OFF"));
// envvar works everywhere; we need this for testing in CI. Sadly this allows
@@ -2599,28 +2621,22 @@ gfxPlatform::InitWebRenderConfig()
// gfx.webrender.enabled and gfx.webrender.all only work on nightly
#ifdef NIGHTLY_BUILD
} else if (prefEnabled) {
featureWebRender.UserEnable("Force enabled by pref");
#endif
// 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);
}
}
// If the user set the pref to force-disable, let's do that. This will
// override all the other enabling prefs (gfx.webrender.enabled,
// gfx.webrender.all, and gfx.webrender.all.qualified).
if (gfxPrefs::WebRenderForceDisabled()) {
featureWebRender.UserDisable(
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -1396,16 +1396,19 @@ GfxInfoBase::BuildFeatureStateLog(JSCont
void
GfxInfoBase::DescribeFeatures(JSContext* aCx, JS::Handle<JSObject*> aObj)
{
JS::Rooted<JSObject*> obj(aCx);
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) {
InitFeatureObject(aCx, aObj, "advancedLayers", advancedLayers, &obj);
if (gfxConfig::UseFallback(Fallback::NO_CONSTANT_BUFFER_OFFSETTING)) {
JS::Rooted<JS::Value> trueVal(aCx, JS::BooleanValue(true));
JS_SetProperty(aCx, obj, "noConstantBufferOffsetting", trueVal);