Bug 1191040 - Ensure that we only compute the tile size once. r=BenWa
☠☠ backed out by e102197e3034 ☠ ☠
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 07 Aug 2015 15:37:56 -0400
changeset 288528 4e63305fe592b0131892eb432cc7332e850ca752
parent 288527 d5ce8d41ffbfa30f3c030577915406187b80235d
child 288529 c599591ec73d2a51a0c9068b11a8dbdc5f795f2b
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBenWa
bugs1191040
milestone42.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 1191040 - Ensure that we only compute the tile size once. r=BenWa
gfx/layers/ipc/CompositorParent.cpp
gfx/tests/gtest/TestTiledLayerBuffer.cpp
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -677,18 +677,16 @@ CompositorParent::CompositorParent(nsIWi
 
   if (UseVsyncComposition()) {
     gfxDebugOnce() << "Enabling vsync compositor";
     mCompositorScheduler = new CompositorVsyncScheduler(this, aWidget);
   } else {
     mCompositorScheduler = new CompositorSoftwareTimerScheduler(this);
   }
 
-  gfxPlatform::GetPlatform()->ComputeTileSize();
-
   LayerScope::SetPixelScale(mWidget->GetDefaultScale().scale);
 }
 
 bool
 CompositorParent::IsInCompositorThread()
 {
   return CompositorThread() && CompositorThread()->thread_id() == PlatformThread::CurrentId();
 }
@@ -1730,17 +1728,16 @@ class CrossProcessCompositorParent final
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(CrossProcessCompositorParent)
 public:
   explicit CrossProcessCompositorParent(Transport* aTransport)
     : mTransport(aTransport)
     , mCompositorThreadHolder(sCompositorThreadHolder)
     , mNotifyAfterRemotePaint(false)
   {
     MOZ_ASSERT(NS_IsMainThread());
-    gfxPlatform::GetPlatform()->ComputeTileSize();
   }
 
   // IToplevelProtocol::CloneToplevel()
   virtual IToplevelProtocol*
   CloneToplevel(const InfallibleTArray<mozilla::ipc::ProtocolFdMapping>& aFds,
                 base::ProcessHandle aPeerProcess,
                 mozilla::ipc::ProtocolCloneContext* aCtx) override;
 
--- a/gfx/tests/gtest/TestTiledLayerBuffer.cpp
+++ b/gfx/tests/gtest/TestTiledLayerBuffer.cpp
@@ -6,18 +6,16 @@
 #include "TiledLayerBuffer.h"
 
 #include "gtest/gtest.h"
 
 namespace mozilla {
 namespace layers {
 
 TEST(TiledLayerBuffer, TileStart) {
-  gfxPlatform::GetPlatform()->ComputeTileSize();
-
   ASSERT_EQ(RoundDownToTileEdge(10, 256), 0);
   ASSERT_EQ(RoundDownToTileEdge(-10, 256), -256);
 }
 
 TEST(TiledLayerBuffer, TilesPlacement) {
   for (int firstY = -10; firstY < 10; ++firstY) {
     for (int firstX = -10; firstX < 10; ++firstX) {
       for (int height = 1; height < 10; ++height) {
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -499,16 +499,18 @@ gfxPlatform::Init()
 
 #ifdef MOZ_GL_DEBUG
     GLContext::StaticInit();
 #endif
 
     InitLayersAccelerationPrefs();
     InitLayersIPC();
 
+    gPlatform->ComputeTileSize();
+
     nsresult rv;
 
     bool usePlatformFontList = true;
 #if defined(MOZ_WIDGET_GTK)
     usePlatformFontList = gfxPlatformGtk::UseFcFontList();
 #elif defined(MOZ_WIDGET_QT)
     usePlatformFontList = false;
 #endif
@@ -997,17 +999,17 @@ gfxPlatform::SetTileSize(int aWidth, int
 }
 
 void
 gfxPlatform::ComputeTileSize()
 {
   // The tile size should be picked in the parent processes
   // and sent to the child processes over IPDL GetTileSize.
   if (!XRE_IsParentProcess()) {
-    NS_RUNTIMEABORT("wrong process.");
+    return;
   }
 
   int32_t w = gfxPrefs::LayersTileWidth();
   int32_t h = gfxPrefs::LayersTileHeight();
 
   // TODO We may want to take the screen size into consideration here.
   if (gfxPrefs::LayersTilesAdjust()) {
 #ifdef MOZ_WIDGET_GONK
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -302,22 +302,16 @@ public:
      */
     virtual nsresult GetFontList(nsIAtom *aLangGroup,
                                  const nsACString& aGenericFamily,
                                  nsTArray<nsString>& aListOfFonts);
 
     int GetTileWidth();
     int GetTileHeight();
     void SetTileSize(int aWidth, int aHeight);
-    /**
-     * Calling this function will compute and set the ideal tile size for the
-     * platform. This should only be called in the parent process; child processes
-     * should be updated via SetTileSize to match the value computed in the parent.
-     */
-    void ComputeTileSize();
 
     /**
      * Rebuilds the any cached system font lists
      */
     virtual nsresult UpdateFontList();
 
     /**
      * Create the platform font-list object (gfxPlatformFontList concrete subclass).
@@ -755,16 +749,23 @@ private:
     static void CreateCMSOutputProfile();
 
     static void GetCMSOutputProfileData(void *&mem, size_t &size);
 
     friend void RecordingPrefChanged(const char *aPrefName, void *aClosure);
 
     virtual void GetPlatformCMSOutputProfile(void *&mem, size_t &size);
 
+    /**
+     * Calling this function will compute and set the ideal tile size for the
+     * platform. This will only have an effect in the parent process; child processes
+     * should be updated via SetTileSize to match the value computed in the parent.
+     */
+    void ComputeTileSize();
+
     nsRefPtr<gfxASurface> mScreenReferenceSurface;
     nsTArray<uint32_t> mCJKPrefLangs;
     nsCOMPtr<nsIObserver> mSRGBOverrideObserver;
     nsCOMPtr<nsIObserver> mFontPrefsObserver;
     nsCOMPtr<nsIObserver> mMemoryPressureObserver;
 
     // The preferred draw target backend to use for canvas
     mozilla::gfx::BackendType mPreferredCanvasBackend;