Bug 1535745 - Eliminate gfx.webrender.program-binary. r=sotaro
authorBobby Holley <bobbyholley@gmail.com>
Sat, 16 Mar 2019 00:31:38 +0000
changeset 465084 a7db995954dbb787224aa8d19a709310a8998223
parent 465083 4753b348fce8eb228389cc97994af1c5293e8a74
child 465085 4eabf4f36fef9bdf38efe2d5a301173c6e804c55
push id35732
push useropoprus@mozilla.com
push dateWed, 20 Mar 2019 10:52:37 +0000
treeherdermozilla-central@708979f9c3f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1535745
milestone68.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 1535745 - Eliminate gfx.webrender.program-binary. r=sotaro Differential Revision: https://phabricator.services.mozilla.com/D23731
gfx/config/gfxVars.h
gfx/thebes/gfxPlatform.cpp
gfx/webrender_bindings/RenderThread.cpp
gfx/webrender_bindings/RenderThread.h
gfx/webrender_bindings/WebRenderAPI.cpp
modules/libpref/init/all.js
--- a/gfx/config/gfxVars.h
+++ b/gfx/config/gfxVars.h
@@ -37,17 +37,16 @@ class gfxVarReceiver;
   _(DXInterop2Blocked, bool, false)                                \
   _(DXNV12Blocked, bool, false)                                    \
   _(DXP010Blocked, bool, false)                                    \
   _(DXP016Blocked, bool, false)                                    \
   _(UseWebRender, bool, false)                                     \
   _(UseWebRenderANGLE, bool, false)                                \
   _(UseWebRenderDCompWin, bool, false)                             \
   _(UseWebRenderDCompWinTripleBuffering, bool, false)              \
-  _(UseWebRenderProgramBinary, bool, false)                        \
   _(UseWebRenderProgramBinaryDisk, bool, false)                    \
   _(WebRenderDebugFlags, int32_t, 0)                               \
   _(ScreenDepth, int32_t, 0)                                       \
   _(GREDirectory, nsString, nsString())                            \
   _(ProfDirectory, nsString, nsString())                           \
   _(UseOMTP, bool, false)                                          \
   _(AllowD3D11KeyedMutex, bool, false)                             \
   _(SystemTextQuality, int32_t, 5 /* CLEARTYPE_QUALITY */)
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2739,23 +2739,19 @@ void gfxPlatform::InitWebRenderConfig() 
           FeatureStatus::Unavailable, "ANGLE is disabled",
           NS_LITERAL_CSTRING("FEATURE_FAILURE_ANGLE_DISABLED"));
     } else {
       gfxVars::SetUseWebRenderANGLE(gfxConfig::IsEnabled(Feature::WEBRENDER));
     }
   }
 #endif
 
-  if (Preferences::GetBool("gfx.webrender.program-binary", false)) {
-    gfxVars::SetUseWebRenderProgramBinary(
+  if (Preferences::GetBool("gfx.webrender.program-binary-disk", false)) {
+    gfxVars::SetUseWebRenderProgramBinaryDisk(
         gfxConfig::IsEnabled(Feature::WEBRENDER));
-    if (Preferences::GetBool("gfx.webrender.program-binary-disk", false)) {
-      gfxVars::SetUseWebRenderProgramBinaryDisk(
-          gfxConfig::IsEnabled(Feature::WEBRENDER));
-    }
   }
 
 #ifdef MOZ_WIDGET_ANDROID
   if (jni::IsFennec()) {
     featureWebRender.ForceDisable(
         FeatureStatus::Unavailable,
         "WebRender not ready for use on non-e10s Android",
         NS_LITERAL_CSTRING("FEATURE_FAILURE_ANDROID"));
--- a/gfx/webrender_bindings/RenderThread.cpp
+++ b/gfx/webrender_bindings/RenderThread.cpp
@@ -642,18 +642,18 @@ RenderTextureHost* RenderThread::GetRend
   return it->second;
 }
 
 void RenderThread::InitDeviceTask() {
   MOZ_ASSERT(IsInRenderThread());
   MOZ_ASSERT(!mSharedGL);
 
   mSharedGL = CreateGLContext();
-  if (XRE_IsGPUProcess() && gfx::gfxVars::UseWebRenderProgramBinary()) {
-    ProgramCache();
+  if (gfx::gfxVars::UseWebRenderProgramBinaryDisk()) {
+    mProgramCache = MakeUnique<WebRenderProgramCache>(ThreadPool().Raw());
   }
   // Query the shared GL context to force the
   // lazy initialization to happen now.
   SharedGL();
 }
 
 void RenderThread::HandleDeviceReset(const char* aWhere, bool aNotify) {
   MOZ_ASSERT(IsInRenderThread());
@@ -696,25 +696,16 @@ void RenderThread::SimulateDeviceReset()
   } else {
     // When this function is called GPUProcessManager::SimulateDeviceReset()
     // already triggers destroying all CompositorSessions before re-creating
     // them.
     HandleDeviceReset("SimulateDeviceReset", /* aNotify */ false);
   }
 }
 
-WebRenderProgramCache* RenderThread::ProgramCache() {
-  MOZ_ASSERT(IsInRenderThread());
-
-  if (!mProgramCache) {
-    mProgramCache = MakeUnique<WebRenderProgramCache>(ThreadPool().Raw());
-  }
-  return mProgramCache.get();
-}
-
 gl::GLContext* RenderThread::SharedGL() {
   MOZ_ASSERT(IsInRenderThread());
   if (!mSharedGL) {
     mSharedGL = CreateGLContext();
     mShaders = nullptr;
   }
   if (mSharedGL && !mShaders) {
     mShaders = MakeUnique<WebRenderShaders>(mSharedGL, mProgramCache.get());
--- a/gfx/webrender_bindings/RenderThread.h
+++ b/gfx/webrender_bindings/RenderThread.h
@@ -213,21 +213,29 @@ class RenderThread final {
   /// Can be called from any thread.
   void FrameRenderingComplete(wr::WindowId aWindowId);
 
   void NotifySlowFrame(wr::WindowId aWindowId);
 
   /// Can be called from any thread.
   WebRenderThreadPool& ThreadPool() { return mThreadPool; }
 
+  /// Returns the cache used to serialize shader programs to disk, if enabled.
+  ///
   /// Can only be called from the render thread.
-  WebRenderProgramCache* ProgramCache();
+  WebRenderProgramCache* GetProgramCache() {
+    MOZ_ASSERT(IsInRenderThread());
+    return mProgramCache.get();
+  }
 
   /// Can only be called from the render thread.
-  WebRenderShaders* Shaders() { return mShaders.get(); }
+  WebRenderShaders* GetShaders() {
+    MOZ_ASSERT(IsInRenderThread());
+    return mShaders.get();
+  }
 
   /// Can only be called from the render thread.
   gl::GLContext* SharedGL();
 
   void ClearSharedGL();
 
   /// Can only be called from the render thread.
   void HandleDeviceReset(const char* aWhere, bool aNotify);
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -65,27 +65,28 @@ class NewRenderer : public RendererEvent
     }
 
     *mUseANGLE = compositor->UseANGLE();
     *mUseDComp = compositor->UseDComp();
     *mUseTripleBuffering = compositor->UseTripleBuffering();
 
     bool supportLowPriorityTransactions = true;  // TODO only for main windows.
     wr::Renderer* wrRenderer = nullptr;
-    if (!wr_window_new(
-            aWindowId, mSize.width, mSize.height,
-            supportLowPriorityTransactions, gfxPrefs::WebRenderPictureCaching(),
-            compositor->gl(),
-            aRenderThread.ProgramCache() ? aRenderThread.ProgramCache()->Raw()
-                                         : nullptr,
-            aRenderThread.Shaders() ? aRenderThread.Shaders()->RawShaders()
-                                    : nullptr,
-            aRenderThread.ThreadPool().Raw(), &WebRenderMallocSizeOf,
-            &WebRenderMallocEnclosingSizeOf, mDocHandle, &wrRenderer,
-            mMaxTextureSize)) {
+    if (!wr_window_new(aWindowId, mSize.width, mSize.height,
+                       supportLowPriorityTransactions,
+                       gfxPrefs::WebRenderPictureCaching(), compositor->gl(),
+                       aRenderThread.GetProgramCache()
+                           ? aRenderThread.GetProgramCache()->Raw()
+                           : nullptr,
+                       aRenderThread.GetShaders()
+                           ? aRenderThread.GetShaders()->RawShaders()
+                           : nullptr,
+                       aRenderThread.ThreadPool().Raw(), &WebRenderMallocSizeOf,
+                       &WebRenderMallocEnclosingSizeOf, mDocHandle, &wrRenderer,
+                       mMaxTextureSize)) {
       // wr_window_new puts a message into gfxCriticalNote if it returns false
       return;
     }
     MOZ_ASSERT(wrRenderer);
 
     RefPtr<RenderThread> thread = &aRenderThread;
     auto renderer =
         MakeUnique<RendererOGL>(std::move(thread), std::move(compositor),
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -933,17 +933,16 @@ pref("gfx.webrender.enabled", false);
 // on all channels because WR can be enabled on qualified hardware on all
 // channels.
 pref("gfx.webrender.force-disabled", false);
 
 #ifdef XP_WIN
 pref("gfx.webrender.force-angle", true);
 pref("gfx.webrender.dcomp-win.enabled", true);
 pref("gfx.webrender.dcomp-win-triple-buffering.enabled", true);
-pref("gfx.webrender.program-binary", true);
 pref("gfx.webrender.program-binary-disk", true);
 #endif
 
 #ifdef XP_MACOSX
 pref("gfx.compositor.glcontext.opaque", false);
 #endif
 
 pref("gfx.webrender.highlight-painted-layers", false);