Bug 1180326 - Part 2: Add support for variable tile sizes. r=jrmuizel
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 29 Jul 2015 12:01:21 -0400
changeset 286896 e1bfa923a761d62b92657ccbbfbc5774fac4b7f3
parent 286895 24d32648073cc05efbfa67421aa035dc5b041ff4
child 286897 6b9ace2a57ab841885530d884cb27d8b333ddffe
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)
reviewersjrmuizel
bugs1180326
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 1180326 - Part 2: Add support for variable tile sizes. r=jrmuizel
gfx/layers/TiledLayerBuffer.h
gfx/layers/client/TiledContentClient.cpp
gfx/layers/composite/TiledContentHost.cpp
gfx/layers/ipc/LayersMessages.ipdlh
--- a/gfx/layers/TiledLayerBuffer.h
+++ b/gfx/layers/TiledLayerBuffer.h
@@ -145,17 +145,17 @@ public:
                 gfxPlatform::GetPlatform()->GetTileHeight())
   {}
 
   ~TiledLayerBuffer() {}
 
   gfx::IntPoint GetTileOffset(TileIntPoint aPosition) const {
     gfx::IntSize scaledTileSize = GetScaledTileSize();
     return gfx::IntPoint(aPosition.x * scaledTileSize.width,
-                         aPosition.y * scaledTileSize.height);
+                         aPosition.y * scaledTileSize.height) + mTileOrigin;
   }
 
   const TilesPlacement& GetPlacement() const { return mTiles; }
 
   const gfx::IntSize& GetTileSize() const { return mTileSize; }
 
   gfx::IntSize GetScaledTileSize() const { return RoundedToInt(gfx::Size(mTileSize) / mResolution); }
 
@@ -189,16 +189,17 @@ protected:
    * Only the region intersecting with mValidRegion should be read from a tile,
    * another other region is assumed to be uninitialized. The contents of the
    * tiles is scaled by mResolution.
    */
   nsTArray<Tile>  mRetainedTiles;
   TilesPlacement  mTiles;
   float           mResolution;
   gfx::IntSize    mTileSize;
+  gfx::IntPoint   mTileOrigin;
 };
 
 template<typename Derived, typename Tile> void
 TiledLayerBuffer<Derived, Tile>::Dump(std::stringstream& aStream,
                                       const char* aPrefix,
                                       bool aDumpHtml)
 {
   for (size_t i = 0; i < mRetainedTiles.Length(); ++i) {
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -863,16 +863,17 @@ ClientMultiTiledLayerBuffer::GetSurfaceD
       tileDesc = tile.GetTileDescriptor();
     }
     tiles.AppendElement(tileDesc);
     // Reset the update rect
     tile.mUpdateRect = IntRect();
   }
   return SurfaceDescriptorTiles(mValidRegion,
                                 tiles,
+                                mTileOrigin, mTileSize,
                                 mTiles.mFirst.x, mTiles.mFirst.y,
                                 mTiles.mSize.width, mTiles.mSize.height,
                                 mResolution, mFrameResolution.xScale,
                                 mFrameResolution.yScale);
 }
 
 void
 ClientMultiTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion,
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -237,17 +237,18 @@ protected:
   size_t mFirstPossibility;
 };
 
 bool
 TiledLayerBufferComposite::UseTiles(const SurfaceDescriptorTiles& aTiles,
                                     Compositor* aCompositor,
                                     ISurfaceAllocator* aAllocator)
 {
-  if (mResolution != aTiles.resolution()) {
+  if (mResolution != aTiles.resolution() ||
+      aTiles.tileSize() != mTileSize) {
     Clear();
   }
   MOZ_ASSERT(aAllocator);
   MOZ_ASSERT(aCompositor);
   if (!aAllocator || !aCompositor) {
     return false;
   }
 
@@ -347,16 +348,18 @@ TiledLayerBufferComposite::UseTiles(cons
     if (tile.mTextureHost->HasInternalBuffer()) {
       // Now that we did the texture upload (in UseTileTexture), we can release
       // the lock.
       tile.ReadUnlock();
     }
   }
 
   mTiles = newTiles;
+  mTileSize = aTiles.tileSize();
+  mTileOrigin = aTiles.tileOrigin();
   mValidRegion = aTiles.validRegion();
   mResolution = aTiles.resolution();
   mFrameResolution = CSSToParentLayerScale2D(aTiles.frameXResolution(),
                                              aTiles.frameYResolution());
 
   return true;
 }
 
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -328,16 +328,18 @@ struct PlaceholderTileDescriptor {
 union TileDescriptor {
   TexturedTileDescriptor;
   PlaceholderTileDescriptor;
 };
 
 struct SurfaceDescriptorTiles {
   nsIntRegion validRegion;
   TileDescriptor[] tiles;
+  IntPoint    tileOrigin;
+  IntSize     tileSize;
   int         firstTileX;
   int         firstTileY;
   int         retainedWidth;
   int         retainedHeight;
   float       resolution;
   float       frameXResolution;
   float       frameYResolution;
 };