Bug 1273252 - WARP counts as a performance-caveat. - r=jrmuizel
authorJeff Gilbert <jgilbert@mozilla.com>
Wed, 25 May 2016 13:18:00 -0700
changeset 338033 69aaee1090d832a21fcd322f1a1be0e95b99bfbf
parent 338032 bd4592d84a9ed24a80a3df7707d3c07284765f2d
child 338034 b3b9c70d53be4fbfb38f59cd0619984a3cc6d91c
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1273252
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1273252 - WARP counts as a performance-caveat. - r=jrmuizel
dom/canvas/WebGLContext.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -892,21 +892,21 @@ WebGLContext::SetDimensions(int32_t sign
     if (disabled) {
         Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_FAILURE_ID,
                               NS_LITERAL_CSTRING("FEATURE_FAILURE_WEBGL_DISABLED"));
         const nsLiteralCString text("WebGL is currently disabled.");
         ThrowEvent_WebGLContextCreationError(text);
         return NS_ERROR_FAILURE;
     }
 
-    bool failIfPerfCaveat = mOptions.failIfMajorPerformanceCaveat;
-    if (gfxPrefs::WebGLDisableFailIfMajorPerformanceCaveat())
-        failIfPerfCaveat = false;
+    if (gfxPrefs::WebGLDisableFailIfMajorPerformanceCaveat()) {
+        mOptions.failIfMajorPerformanceCaveat = false;
+    }
 
-    if (failIfPerfCaveat) {
+    if (mOptions.failIfMajorPerformanceCaveat) {
         nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
         if (!HasAcceleratedLayers(gfxInfo)) {
             Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_FAILURE_ID,
                                   NS_LITERAL_CSTRING("FEATURE_FAILURE_WEBGL_PERF_CAVEAT"));
             const nsLiteralCString text("failIfMajorPerformanceCaveat: Compositor is not"
                                         " hardware-accelerated.");
             ThrowEvent_WebGLContextCreationError(text);
             return NS_ERROR_FAILURE;
@@ -923,18 +923,26 @@ WebGLContext::SetDimensions(int32_t sign
     if (!CreateAndInitGL(forceEnabled, &failReason, &failureId)) {
         Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_FAILURE_ID, failureId);
         const nsPrintfCString text("WebGL creation failed: %s",
                                    failReason.BeginReading());
         ThrowEvent_WebGLContextCreationError(text);
         return NS_ERROR_FAILURE;
     }
     MOZ_ASSERT(gl);
+    MOZ_ASSERT_IF(mOptions.alpha, gl->Caps().alpha);
 
-    MOZ_ASSERT_IF(mOptions.alpha, gl->Caps().alpha);
+    if (mOptions.failIfMajorPerformanceCaveat) {
+        if (gl->IsWARP()) {
+            const nsLiteralCString text("failIfMajorPerformanceCaveat: Driver is not"
+                                        " hardware-accelerated.");
+            ThrowEvent_WebGLContextCreationError(text);
+            return NS_ERROR_FAILURE;
+        }
+    }
 
     if (!ResizeBackbuffer(width, height)) {
         Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_FAILURE_ID,
                               NS_LITERAL_CSTRING("FEATURE_FAILURE_WEBGL_RESIZE"));
         const nsLiteralCString text("Initializing WebGL backbuffer failed.");
         ThrowEvent_WebGLContextCreationError(text);
         return NS_ERROR_FAILURE;
     }