Bug 1221073 - Increase max tile size to 1024 again. r=mstange
authorJamie Nicol <jnicol@mozilla.com>
Tue, 08 Dec 2015 21:42:43 +0000
changeset 310107 9d2001daa6a23f4a5086947886e724101c7e7270
parent 310073 dc33b155d02cd68099ce9e168bbf5c39bad62c48
child 310108 984b095feb49706098b6a9d84e6e57bbb34df4ee
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1221073
milestone45.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 1221073 - Increase max tile size to 1024 again. r=mstange Make the heuristic for the tile size aim for > 2 and <= 4 tiles per screen width, but no larger than 1024. This increases the tile size back up to 1024 on retina macbooks.
gfx/thebes/gfxPlatform.cpp
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -115,16 +115,17 @@ class mozilla::gl::SkiaGLGlue : public G
 };
 #endif
 
 #include "mozilla/Preferences.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Mutex.h"
 
+#include "nsAlgorithm.h"
 #include "nsIGfxInfo.h"
 #include "nsIXULRuntime.h"
 #include "VsyncSource.h"
 #include "SoftwareVsyncSource.h"
 #include "nscore.h" // for NS_FREE_PERMANENT_DATA
 #include "mozilla/dom/ContentChild.h"
 
 namespace mozilla {
@@ -1062,21 +1063,20 @@ gfxPlatform::ComputeTileSize()
   }
 
   int32_t w = gfxPrefs::LayersTileWidth();
   int32_t h = gfxPrefs::LayersTileHeight();
 
   if (gfxPrefs::LayersTilesAdjust()) {
     gfx::IntSize screenSize = GetScreenSize();
     if (screenSize.width > 0) {
-      // For the time being tiles larger than 512 probably do not make much
-      // sense. This is due to e.g. increased rasterisation time outweighing
-      // the decreased composition time, or large increases in memory usage
-      // for screens slightly wider than a higher power of two.
-      w = h = screenSize.width >= 512 ? 512 : 256;
+      // Choose a size so that there are between 2 and 4 tiles per screen width.
+      // FIXME: we should probably make sure this is within the max texture size,
+      // but I think everything should at least support 1024
+      w = h = clamped(NextPowerOfTwo(screenSize.width) / 4, 256, 1024);
     }
 
 #ifdef MOZ_WIDGET_GONK
     android::sp<android::GraphicBuffer> alloc =
           new android::GraphicBuffer(w, h, android::PIXEL_FORMAT_RGBA_8888,
                                      android::GraphicBuffer::USAGE_SW_READ_OFTEN |
                                      android::GraphicBuffer::USAGE_SW_WRITE_OFTEN |
                                      android::GraphicBuffer::USAGE_HW_TEXTURE);