Bug 1418980: Add full blocklisting support for GPU_PROCESS and DX_INTEROP2. r?dvander draft
authorMilan Sreckovic <milan@mozilla.com>
Tue, 21 Nov 2017 13:13:10 -0500
changeset 701449 d1de006226ee892ec626fdc361a6377dd1d5d9fe
parent 696426 b0ded9bbd517b1cef61beef4245323d1441fedc3
child 741163 93f29ca4316fb190e42dc913cb98f9cf70d7532d
push id90160
push userbmo:milan@mozilla.com
push dateTue, 21 Nov 2017 18:13:36 +0000
reviewersdvander
bugs1418980
milestone58.0a1
Bug 1418980: Add full blocklisting support for GPU_PROCESS and DX_INTEROP2. r?dvander MozReview-Commit-ID: 4gKi54Is8KO
gfx/thebes/gfxWindowsPlatform.cpp
widget/GfxInfoBase.cpp
widget/nsIGfxInfo.idl
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -1567,16 +1567,23 @@ bool
 gfxWindowsPlatform::InitGPUProcessSupport()
 {
   FeatureState& gpuProc = gfxConfig::GetFeature(Feature::GPU_PROCESS);
 
   if (!gpuProc.IsEnabled()) {
     return false;
   }
 
+  nsCString message;
+  nsCString failureId;
+  if (!gfxPlatform::IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_GPU_PROCESS, &message, failureId)) {
+    gpuProc.Disable(FeatureStatus::Blacklisted, message.get(), failureId);
+    return false;
+  }
+
   if (!gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) {
     // Don't use the GPU process if not using D3D11, unless software
     // compositor is allowed
     if (gfxPrefs::GPUProcessAllowSoftware()) {
       return gpuProc.IsEnabled();
     }
     gpuProc.Disable(
       FeatureStatus::Unavailable,
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -162,30 +162,35 @@ GetPrefNameForFeature(int32_t aFeature)
       name = BLACKLIST_PREF_BRANCH "webrtc.hw.acceleration.encode";
       break;
     case nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_DECODE:
       name = BLACKLIST_PREF_BRANCH "webrtc.hw.acceleration.decode";
       break;
     case nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION:
       name = BLACKLIST_PREF_BRANCH "canvas2d.acceleration";
       break;
+    case nsIGfxInfo::FEATURE_DX_INTEROP2:
+      name = BLACKLIST_PREF_BRANCH "dx.interop2";
+      break;
+    case nsIGfxInfo::FEATURE_GPU_PROCESS:
+      name = BLACKLIST_PREF_BRANCH "gpu.process";
+      break;
     case nsIGfxInfo::FEATURE_WEBGL2:
       name = BLACKLIST_PREF_BRANCH "webgl2";
       break;
     case nsIGfxInfo::FEATURE_ADVANCED_LAYERS:
       name = BLACKLIST_PREF_BRANCH "layers.advanced";
       break;
     case nsIGfxInfo::FEATURE_D3D11_KEYED_MUTEX:
       name = BLACKLIST_PREF_BRANCH "d3d11.keyed.mutex";
       break;
     case nsIGfxInfo::FEATURE_VP8_HW_DECODE:
     case nsIGfxInfo::FEATURE_VP9_HW_DECODE:
-    case nsIGfxInfo::FEATURE_DX_INTEROP2:
-    case nsIGfxInfo::FEATURE_GPU_PROCESS:
-      // We don't provide prefs for these features.
+      // We don't provide prefs for these features as these are
+      // not handling downloadable blocklist.
       break;
     default:
       MOZ_ASSERT_UNREACHABLE("Unexpected nsIGfxInfo feature?!");
       break;
   }
 
   return name;
 }
@@ -352,22 +357,28 @@ BlacklistFeatureToGfxFeature(const nsASt
   else if (aFeature.EqualsLiteral("WEBRTC_HW_ACCELERATION_ENCODE"))
     return nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_ENCODE;
   else if (aFeature.EqualsLiteral("WEBRTC_HW_ACCELERATION_DECODE"))
     return nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_DECODE;
   else if (aFeature.EqualsLiteral("WEBRTC_HW_ACCELERATION"))
     return nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION;
   else if (aFeature.EqualsLiteral("CANVAS2D_ACCELERATION"))
       return nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION;
+  else if (aFeature.EqualsLiteral("DX_INTEROP2"))
+    return nsIGfxInfo::FEATURE_DX_INTEROP2;
+  else if (aFeature.EqualsLiteral("GPU_PROCESS"))
+    return nsIGfxInfo::FEATURE_GPU_PROCESS;
   else if (aFeature.EqualsLiteral("WEBGL2"))
     return nsIGfxInfo::FEATURE_WEBGL2;
   else if (aFeature.EqualsLiteral("ADVANCED_LAYERS"))
     return nsIGfxInfo::FEATURE_ADVANCED_LAYERS;
   else if (aFeature.EqualsLiteral("D3D11_KEYED_MUTEX"))
     return nsIGfxInfo::FEATURE_D3D11_KEYED_MUTEX;
+  // We do not support FEATURE_VP8_HW_DECODE and FEATURE_VP9_HW_DECODE
+  // in downloadable blocklist.
 
   // If we don't recognize the feature, it may be new, and something
   // this version doesn't understand.  So, nothing to do.  This is
   // different from feature not being specified at all, in which case
   // this method should not get called and we should continue with the
   // "all features" blocklisting.
   return -1;
 }
@@ -987,16 +998,20 @@ GfxInfoBase::EvaluateDownloadedBlacklist
     nsIGfxInfo::FEATURE_WEBGL_OPENGL,
     nsIGfxInfo::FEATURE_WEBGL_ANGLE,
     nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_ENCODE,
     nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_DECODE,
     nsIGfxInfo::FEATURE_WEBGL_MSAA,
     nsIGfxInfo::FEATURE_STAGEFRIGHT,
     nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION,
     nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION,
+    nsIGfxInfo::FEATURE_VP8_HW_DECODE,
+    nsIGfxInfo::FEATURE_VP9_HW_DECODE,
+    nsIGfxInfo::FEATURE_DX_INTEROP2,
+    nsIGfxInfo::FEATURE_GPU_PROCESS,
     nsIGfxInfo::FEATURE_WEBGL2,
     nsIGfxInfo::FEATURE_ADVANCED_LAYERS,
     nsIGfxInfo::FEATURE_D3D11_KEYED_MUTEX,
     0
   };
 
   // For every feature we know about, we evaluate whether this blacklist has a
   // non-STATUS_OK status. If it does, we set the pref we evaluate in
--- a/widget/nsIGfxInfo.idl
+++ b/widget/nsIGfxInfo.idl
@@ -111,23 +111,23 @@ interface nsIGfxInfo : nsISupports
   /* Whether Direct3D 11 is supported for ANGLE, starting in 38. */
   const long FEATURE_DIRECT3D_11_ANGLE = 13;
   /* Whether Webrtc Hardware acceleration is supported, starting in 42. */
   const long FEATURE_WEBRTC_HW_ACCELERATION_ENCODE = 14;
   /* Whether Webrtc Hardware acceleration is supported, starting in 42. */
   const long FEATURE_WEBRTC_HW_ACCELERATION_DECODE = 15;
   /* Whether Canvas acceleration is supported, starting in 45 */
   const long FEATURE_CANVAS2D_ACCELERATION = 16;
-  /* Whether hardware VP8 decoding is supported, starting in 48. */
+  /* Whether hardware VP8 decoding is supported, starting in 48; not for downloadable blocking. */
   const long FEATURE_VP8_HW_DECODE = 17;
-  /* Whether hardware VP9 decoding is supported, starting in 48. */
+  /* Whether hardware VP9 decoding is supported, starting in 48; not for downloadable blocking. */
   const long FEATURE_VP9_HW_DECODE = 18;
-  /* Whether NV_dx_interop2 is supported, starting in 50. */
+  /* Whether NV_dx_interop2 is supported, starting in 50; downloadable blocking in 58. */
   const long FEATURE_DX_INTEROP2 = 19;
-  /* Whether the GPU process is supported, starting in 52. */
+  /* Whether the GPU process is supported, starting in 52; downloadable blocking in 58. */
   const long FEATURE_GPU_PROCESS = 20;
   /* Whether the WebGL2 is supported, starting in 54 */
   const long FEATURE_WEBGL2 = 21;
   /* Whether Advanced Layers is supported, starting in 56 */
   const long FEATURE_ADVANCED_LAYERS = 22;
   /* Whether D3D11 keyed mutex is supported, starting in 56 */
   const long FEATURE_D3D11_KEYED_MUTEX = 23;
   /* the maximum feature value. */