Bug 1283594 - CANVAS_WEBGL_ACCL_FAILURE_ID reports success as empty string. r=jrmuizel
MozReview-Commit-ID: B8rzSG5wk83
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -149,19 +149,22 @@ IsAccelAngleSupported(const nsCOMPtr<nsI
nsACString* const out_failureId)
{
int32_t angleSupport;
nsCString failureId;
gfxUtils::ThreadSafeGetFeatureStatus(gfxInfo,
nsIGfxInfo::FEATURE_WEBGL_ANGLE,
failureId,
&angleSupport);
- Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
- failureId);
- if (failureId.IsEmpty()) {
+ if (failureId.IsEmpty() && angleSupport != nsIGfxInfo::FEATURE_STATUS_OK) {
+ // This shouldn't happen, if we see this it's because we've missed
+ // some failure paths
+ failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_ACCL_ANGLE_NOT_OK");
+ }
+ if (out_failureId->IsEmpty()) {
*out_failureId = failureId;
}
return (angleSupport == nsIGfxInfo::FEATURE_STATUS_OK);
}
static EGLDisplay
GetAndInitDisplay(GLLibraryEGL& egl, void* displayType)
{
@@ -253,16 +256,20 @@ GetAndInitDisplayForAccelANGLE(GLLibrary
if (d3d11ANGLE.IsEnabled()) {
ret = GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE);
}
if (!ret) {
ret = GetAndInitDisplay(egl, EGL_DEFAULT_DISPLAY);
}
+ if (!ret) {
+ *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_ACCL_ANGLE_NO_DISP");
+ }
+
return ret;
}
bool
GLLibraryEGL::ReadbackEGLImage(EGLImage image, gfx::DataSourceSurface* out_surface)
{
StaticMutexAutoUnlock lock(sMutex);
if (!mReadbackGL) {
@@ -453,31 +460,49 @@ GLLibraryEGL::EnsureInitialized(bool for
// Check the ANGLE support the system has
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
mIsANGLE = IsExtensionSupported(ANGLE_platform_angle);
EGLDisplay chosenDisplay = nullptr;
if (IsExtensionSupported(ANGLE_platform_angle_d3d)) {
- bool accelAngleSupport = IsAccelAngleSupported(gfxInfo, out_failureId);
+ nsCString accelAngleFailureId;
+ bool accelAngleSupport = IsAccelAngleSupported(gfxInfo, &accelAngleFailureId);
bool shouldTryAccel = forceAccel || accelAngleSupport;
bool shouldTryWARP = !forceAccel; // Only if ANGLE not supported or fails
// If WARP preferred, will override ANGLE support
if (gfxPrefs::WebGLANGLEForceWARP()) {
shouldTryWARP = true;
shouldTryAccel = false;
+ if (accelAngleFailureId.IsEmpty()) {
+ accelAngleFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_FORCE_WARP");
+ }
}
// Hardware accelerated ANGLE path (supported or force accel)
if (shouldTryAccel) {
chosenDisplay = GetAndInitDisplayForAccelANGLE(*this, out_failureId);
}
+ // Report the acceleration status to telemetry
+ if (!chosenDisplay) {
+ if (accelAngleFailureId.IsEmpty()) {
+ Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
+ NS_LITERAL_CSTRING("FEATURE_FAILURE_ACCL_ANGLE_UNKNOWN"));
+ } else {
+ Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
+ accelAngleFailureId);
+ }
+ } else {
+ Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
+ NS_LITERAL_CSTRING("SUCCESS"));
+ }
+
// Fallback to a WARP display if ANGLE fails, or if WARP is forced
if (!chosenDisplay && shouldTryWARP) {
chosenDisplay = GetAndInitWARPDisplay(*this, EGL_DEFAULT_DISPLAY);
if (!chosenDisplay) {
if (out_failureId->IsEmpty()) {
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WARP_FALLBACK");
}
NS_ERROR("Fallback WARP context failed to initialize.");