Bug 1438551 - Add a pref for enabling tiles when we are using skia with parallel painting. r?nical draft
authorRyan Hunt <rhunt@eqrion.net>
Tue, 10 Apr 2018 11:29:14 -0500
changeset 781718 ac150fad072c10bc832b84dfb5ebb9b91f515170
parent 781717 588d6d81a8cda8b0cf8a3a64b0b8bbccad7eeb5b
child 781719 f45a716061c5e10750e52417e63522a12cc42242
push id106388
push userbmo:rhunt@eqrion.net
push dateFri, 13 Apr 2018 14:19:25 +0000
reviewersnical
bugs1438551
milestone61.0a1
Bug 1438551 - Add a pref for enabling tiles when we are using skia with parallel painting. r?nical MozReview-Commit-ID: JVIFr2wUWHD
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
gfx/thebes/gfxPrefs.h
modules/libpref/init/all.js
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2724,17 +2724,24 @@ gfxPlatform::UsesOffMainThreadCompositin
   }
 
   return result;
 }
 
 bool
 gfxPlatform::UsesTiling() const
 {
-  return gfxPrefs::LayersTilesEnabled();
+  bool isSkiaPOMTP = XRE_IsContentProcess() &&
+      GetDefaultContentBackend() == BackendType::SKIA &&
+      gfxVars::UseOMTP() &&
+      (gfxPrefs::LayersOMTPPaintWorkers() == -1 ||
+      gfxPrefs::LayersOMTPPaintWorkers() > 1);
+
+  return gfxPrefs::LayersTilesEnabled() ||
+    (gfxPrefs::LayersTilesEnabledIfSkiaPOMTP() && isSkiaPOMTP);
 }
 
 /***
  * The preference "layout.frame_rate" has 3 meanings depending on the value:
  *
  * -1 = Auto (default), use hardware vsync or software vsync @ 60 hz if hw vsync fails.
  *  0 = ASAP mode - used during talos testing.
  *  X = Software vsync at a rate of X times per second.
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -293,17 +293,17 @@ public:
 
     virtual void GetAzureBackendInfo(mozilla::widget::InfoObject &aObj);
     void GetApzSupportInfo(mozilla::widget::InfoObject& aObj);
     void GetTilesSupportInfo(mozilla::widget::InfoObject& aObj);
 
     // Get the default content backend that will be used with the default
     // compositor. If the compositor is known when calling this function,
     // GetContentBackendFor() should be called instead.
-    mozilla::gfx::BackendType GetDefaultContentBackend() {
+    mozilla::gfx::BackendType GetDefaultContentBackend() const {
       return mContentBackend;
     }
 
     /// Return the software backend to use by default.
     mozilla::gfx::BackendType GetSoftwareBackend() {
         return mSoftwareBackend;
     }
 
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -583,16 +583,17 @@ private:
 #endif
 
   // 0 is "no change" for contrast, positive values increase it, negative values
   // decrease it until we hit mid gray at -1 contrast, after that it gets weird.
   DECL_GFX_PREF(Live, "layers.effect.contrast",                LayersEffectContrast, float, 0.0f);
   DECL_GFX_PREF(Live, "layers.effect.grayscale",               LayersEffectGrayscale, bool, false);
   DECL_GFX_PREF(Live, "layers.effect.invert",                  LayersEffectInvert, bool, false);
   DECL_GFX_PREF(Once, "layers.enable-tiles",                   LayersTilesEnabled, bool, false);
+  DECL_GFX_PREF(Once, "layers.enable-tiles-if-skia-pomtp",     LayersTilesEnabledIfSkiaPOMTP, bool, false);
   DECL_GFX_PREF(Live, "layers.flash-borders",                  FlashLayerBorders, bool, false);
   DECL_GFX_PREF(Once, "layers.force-shmem-tiles",              ForceShmemTiles, bool, false);
   DECL_GFX_PREF(Once, "layers.gpu-process.allow-software",     GPUProcessAllowSoftware, bool, false);
   DECL_GFX_PREF(Once, "layers.gpu-process.enabled",            GPUProcessEnabled, bool, false);
   DECL_GFX_PREF(Once, "layers.gpu-process.force-enabled",      GPUProcessForceEnabled, bool, false);
   DECL_GFX_PREF(Once, "layers.gpu-process.ipc_reply_timeout_ms", GPUProcessIPCReplyTimeoutMs, int32_t, 10000);
   DECL_GFX_PREF(Live, "layers.gpu-process.max_restarts",       GPUProcessMaxRestarts, int32_t, 1);
   // Note: This pref will only be used if it is less than layers.gpu-process.max_restarts.
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5835,16 +5835,17 @@ pref("layers.omtp.enabled", true);
 #else
 pref("layers.omtp.enabled", false);
 #endif
 #if defined(XP_MACOSX)
 pref("layers.omtp.paint-workers", -1);
 #else
 pref("layers.omtp.paint-workers", 1);
 #endif
+pref("layers.enable-tiles-if-skia-pomtp", false);
 pref("layers.omtp.release-capture-on-main-thread", false);
 pref("layers.omtp.dump-capture", false);
 
 // Limits the depth of recursive conversion of data when opening
 // a content to view.  This is mostly intended to prevent infinite
 // loops with faulty converters involved.
 pref("general.document_open_conversion_depth_limit", 20);