Bug 1441308 - Add pref to disable texture cache clear r=bholley
authorDoug Thayer <dothayer@mozilla.com>
Thu, 10 Jan 2019 16:59:47 +0000
changeset 453278 afb8c84c9677
parent 453277 da3629e101b9
child 453294 9fa45d065808
push id75793
push userdothayer@mozilla.com
push dateThu, 10 Jan 2019 17:05:09 +0000
treeherderautoland@afb8c84c9677 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1441308
milestone66.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 1441308 - Add pref to disable texture cache clear r=bholley To facilitate testing of document splitting before it is preffed on, I'm adding a pref to disable clearing the texture cache, since this will currently crash the browser with doc splitting on. Depends on D13840 Differential Revision: https://phabricator.services.mozilla.com/D13841
gfx/thebes/gfxPlatform.cpp
gfx/wr/webrender/src/texture_cache.rs
gfx/wr/webrender_api/src/api.rs
modules/libpref/init/all.js
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -574,16 +574,17 @@ void WebRenderDebugPrefChangeCallback(co
   GFX_WEBRENDER_DEBUG(".compact-profiler", 1 << 7)
   GFX_WEBRENDER_DEBUG(".echo-driver-messages", 1 << 8)
   GFX_WEBRENDER_DEBUG(".new-frame-indicator", 1 << 9)
   GFX_WEBRENDER_DEBUG(".new-scene-indicator", 1 << 10)
   GFX_WEBRENDER_DEBUG(".show-overdraw", 1 << 11)
   GFX_WEBRENDER_DEBUG(".gpu-cache", 1 << 12)
   GFX_WEBRENDER_DEBUG(".slow-frame-indicator", 1 << 13)
   GFX_WEBRENDER_DEBUG(".texture-cache.clear-evicted", 1 << 14)
+  GFX_WEBRENDER_DEBUG(".texture-cache.disable-shrink", 1 << 16)
 #undef GFX_WEBRENDER_DEBUG
 
   gfx::gfxVars::SetWebRenderDebugFlags(flags);
 }
 
 #if defined(USE_SKIA)
 static uint32_t GetSkiaGlyphCacheSize() {
   // Only increase font cache size on non-android to save memory.
--- a/gfx/wr/webrender/src/texture_cache.rs
+++ b/gfx/wr/webrender/src/texture_cache.rs
@@ -550,16 +550,23 @@ impl TextureCache {
 
     pub fn set_debug_flags(&mut self, flags: DebugFlags) {
         self.debug_flags = flags;
     }
 
     /// Clear all standalone textures in the cache.
     pub fn clear_standalone(&mut self) {
         debug_assert!(!self.now.is_valid());
+        // This pref just helps us avoid crashes when we begin using multiple documents.
+        // What we need to do for clear to work correctly with multiple documents is
+        // to ensure that we generate frames for all documents whenever we do this.
+        if self.debug_flags.contains(DebugFlags::TEXTURE_CACHE_DBG_DISABLE_SHRINK) {
+            return;
+        }
+
         let mut per_doc_data = mem::replace(&mut self.per_doc_data, FastHashMap::default());
         for (&_, doc_data) in per_doc_data.iter_mut() {
             let standalone_entry_handles = mem::replace(
                 &mut doc_data.handles.standalone,
                 Vec::new(),
             );
 
             for handle in standalone_entry_handles {
@@ -568,16 +575,23 @@ impl TextureCache {
                 self.free(entry);
             }
         }
         self.per_doc_data = per_doc_data;
     }
 
     /// Clear all shared textures in the cache.
     pub fn clear_shared(&mut self) {
+        // This pref just helps us avoid crashes when we begin using multiple documents.
+        // What we need to do for clear to work correctly with multiple documents is
+        // to ensure that we generate frames for all documents whenever we do this.
+        if self.debug_flags.contains(DebugFlags::TEXTURE_CACHE_DBG_DISABLE_SHRINK) {
+            return;
+        }
+
         self.unset_doc_data();
         let mut per_doc_data = mem::replace(&mut self.per_doc_data, FastHashMap::default());
         for (&_, doc_data) in per_doc_data.iter_mut() {
             let shared_entry_handles = mem::replace(
                 &mut doc_data.handles.shared,
                 Vec::new(),
             );
 
--- a/gfx/wr/webrender_api/src/api.rs
+++ b/gfx/wr/webrender_api/src/api.rs
@@ -985,16 +985,17 @@ bitflags! {
         /// Show an overlay displaying overdraw amount.
         const SHOW_OVERDRAW         = 1 << 11;
         /// Display the contents of GPU cache.
         const GPU_CACHE_DBG         = 1 << 12;
         const SLOW_FRAME_INDICATOR  = 1 << 13;
         const TEXTURE_CACHE_DBG_CLEAR_EVICTED = 1 << 14;
         /// Show picture caching debug overlay
         const PICTURE_CACHING_DBG   = 1 << 15;
+        const TEXTURE_CACHE_DBG_DISABLE_SHRINK = 1 << 16;
     }
 }
 
 pub struct RenderApi {
     api_sender: MsgSender<ApiMsg>,
     payload_sender: PayloadSender,
     namespace_id: IdNamespace,
     next_id: Cell<ResourceId>,
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -936,16 +936,17 @@ pref("gfx.compositor.glcontext.opaque", 
 pref("gfx.webrender.highlight-painted-layers", false);
 pref("gfx.webrender.blob-images", true);
 pref("gfx.webrender.blob.invalidation", true);
 pref("gfx.webrender.blob.paint-flashing", false);
 
 // WebRender debugging utilities.
 pref("gfx.webrender.debug.texture-cache", false);
 pref("gfx.webrender.debug.texture-cache.clear-evicted", true);
+pref("gfx.webrender.debug.texture-cache.disable-shrink", false);
 pref("gfx.webrender.debug.render-targets", false);
 pref("gfx.webrender.debug.gpu-cache", false);
 pref("gfx.webrender.debug.alpha-primitives", false);
 pref("gfx.webrender.debug.profiler", false);
 pref("gfx.webrender.debug.gpu-time-queries", false);
 pref("gfx.webrender.debug.gpu-sample-queries", false);
 pref("gfx.webrender.debug.disable-batching", false);
 pref("gfx.webrender.debug.epochs", false);