Bug 1180326 - Part 5: Support HWC with tiling when we only have 1 tile. r=jrmuizel
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 29 Jul 2015 12:02:50 -0400
changeset 286899 0f0c427490dacbf7c06253aca563087b7874422a
parent 286898 9bd5b37c01684687e820921c7bb15a0ec5d56404
child 286900 69871c00379ba9a262f3a8cc2072da4a0892b2ee
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 5: Support HWC with tiling when we only have 1 tile. r=jrmuizel
gfx/layers/composite/TiledContentHost.h
--- a/gfx/layers/composite/TiledContentHost.h
+++ b/gfx/layers/composite/TiledContentHost.h
@@ -184,16 +184,32 @@ public:
   explicit TiledContentHost(const TextureInfo& aTextureInfo);
 
 protected:
   ~TiledContentHost();
 
 public:
   virtual LayerRenderState GetRenderState() override
   {
+    // If we have exactly one high precision tile, then we can support hwc.
+    if (mTiledBuffer.GetTileCount() == 1 &&
+        mLowPrecisionTiledBuffer.GetTileCount() == 0) {
+      TextureHost* host = mTiledBuffer.GetTile(0).mTextureHost;
+      if (host) {
+        MOZ_ASSERT(!mTiledBuffer.GetTile(0).mTextureHostOnWhite, "Component alpha not supported!");
+        LayerRenderState state = host->GetRenderState();
+
+        // Offset by the distance between the start of the valid (visible) region and the top-left
+        // of the tile.
+        gfx::IntPoint offset = mTiledBuffer.GetTileOffset(mTiledBuffer.GetPlacement().TilePosition(0));
+
+        state.SetOffset(offset - GetValidRegion().GetBounds().TopLeft());
+        return host->GetRenderState();
+      }
+    }
     return LayerRenderState();
   }
 
 
   virtual bool UpdateThebes(const ThebesBufferData& aData,
                             const nsIntRegion& aUpdated,
                             const nsIntRegion& aOldValidRegionBack,
                             nsIntRegion* aUpdatedRegionBack) override