Title: [114203] trunk/Source
Revision
114203
Author
commit-qu...@webkit.org
Date
2012-04-13 23:02:08 -0700 (Fri, 13 Apr 2012)

Log Message

[Chromium] Avoid unnecessary full tile updates for checkerboard tiles.
https://bugs.webkit.org/show_bug.cgi?id=83804

Patch by David Reveman <reve...@chromium.org> on 2012-04-13
Reviewed by James Robinson.

Source/WebCore:

Cleanup code that determines if we need to use a buffered update and
avoid buffering of tiles that are not in use by the impl thread.

Tests: CCLayerTreeHostTestAtomicCommitWithPartialUpdate.runMultiThread
       TiledLayerChromiumTest.partialUpdates

* platform/graphics/chromium/TiledLayerChromium.cpp:
(UpdatableTile):
(WebCore::UpdatableTile::UpdatableTile):
(WebCore::TiledLayerChromium::pushPropertiesTo):
(WebCore::TiledLayerChromium::tileOnlyNeedsPartialUpdate):
(WebCore::TiledLayerChromium::tileNeedsBufferedUpdate):
(WebCore::TiledLayerChromium::updateTiles):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::bufferedUpdates):
(WebCore):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(CCLayerTreeHost):

Source/WebKit/chromium:

* tests/CCLayerTreeHostTest.cpp:
(WTF::setLayerPropertiesForTesting):
(WTF):
(WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::beginTest):
(WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::commitCompleteOnCCThread):
(WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::drawLayersOnCCThread):
(WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::layout):
(WTF::setTestLayerPropertiesForTesting):
(WTF::CCLayerTreeHostTestLayerOcclusion::beginTest):
(WTF::CCLayerTreeHostTestLayerOcclusionWithFilters::beginTest):
(WTF::CCLayerTreeHostTestManySurfaces::beginTest):
* tests/TiledLayerChromiumTest.cpp:
(WTF::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (114202 => 114203)


--- trunk/Source/WebCore/ChangeLog	2012-04-14 03:32:40 UTC (rev 114202)
+++ trunk/Source/WebCore/ChangeLog	2012-04-14 06:02:08 UTC (rev 114203)
@@ -1,3 +1,29 @@
+2012-04-13  David Reveman  <reve...@chromium.org>
+
+        [Chromium] Avoid unnecessary full tile updates for checkerboard tiles.
+        https://bugs.webkit.org/show_bug.cgi?id=83804
+
+        Reviewed by James Robinson.
+
+        Cleanup code that determines if we need to use a buffered update and
+        avoid buffering of tiles that are not in use by the impl thread.
+
+        Tests: CCLayerTreeHostTestAtomicCommitWithPartialUpdate.runMultiThread
+               TiledLayerChromiumTest.partialUpdates
+
+        * platform/graphics/chromium/TiledLayerChromium.cpp:
+        (UpdatableTile):
+        (WebCore::UpdatableTile::UpdatableTile):
+        (WebCore::TiledLayerChromium::pushPropertiesTo):
+        (WebCore::TiledLayerChromium::tileOnlyNeedsPartialUpdate):
+        (WebCore::TiledLayerChromium::tileNeedsBufferedUpdate):
+        (WebCore::TiledLayerChromium::updateTiles):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+        (WebCore::CCLayerTreeHost::bufferedUpdates):
+        (WebCore):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+        (CCLayerTreeHost):
+
 2012-04-13  Dana Jansens  <dan...@chromium.org>
 
         [chromium] Cleanup texture memory eviction when LayerTreeHost becomes invisible

Modified: trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp (114202 => 114203)


--- trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp	2012-04-14 03:32:40 UTC (rev 114202)
+++ trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp	2012-04-14 06:02:08 UTC (rev 114203)
@@ -78,10 +78,12 @@
     IntRect updateRect;
     bool partialUpdate;
     bool updated;
+    bool isInUseOnImpl;
 private:
     explicit UpdatableTile(PassOwnPtr<LayerTextureUpdater::Texture> texture)
         : partialUpdate(false)
         , updated(false)
+        , isInUseOnImpl(false)
         , m_texture(texture)
     {
     }
@@ -209,6 +211,7 @@
         int i = iter->first.first;
         int j = iter->first.second;
         UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get());
+        tile->isInUseOnImpl = false;
         if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat)) {
             invalidTiles.append(tile);
             continue;
@@ -217,6 +220,7 @@
             continue;
 
         tiledLayer->pushTileProperties(i, j, tile->managedTexture()->textureId(), tile->opaqueRect());
+        tile->isInUseOnImpl = true;
     }
     for (Vector<UpdatableTile*>::const_iterator iter = invalidTiles.begin(); iter != invalidTiles.end(); ++iter)
         m_tiler->takeTile((*iter)->i(), (*iter)->j());
@@ -320,12 +324,6 @@
 // Returns true if tile is dirty and only part of it needs to be updated.
 bool TiledLayerChromium::tileOnlyNeedsPartialUpdate(UpdatableTile* tile)
 {
-    if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat))
-        return false;
-
-    if (!tile->isDirty())
-        return false;
-
     return !tile->dirtyRect.contains(m_tiler->tileRect(tile));
 }
 
@@ -333,16 +331,15 @@
 // we don't modify textures currently used for drawing by the impl thread.
 bool TiledLayerChromium::tileNeedsBufferedUpdate(UpdatableTile* tile)
 {
-    // No impl thread?.
-    if (!CCProxy::hasImplThread())
-        return false;
-
     if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat))
         return false;
 
     if (!tile->isDirty())
         return false;
 
+    if (!tile->isInUseOnImpl)
+        return false;
+
     return true;
 }
 
@@ -380,14 +377,16 @@
             // any single time through the function.
             tile->updated = true;
 
-            // FIXME: Decide if partial update should be allowed based on cost
-            // of update. https://bugs.webkit.org/show_bug.cgi?id=77376
-            if (tileOnlyNeedsPartialUpdate(tile) && layerTreeHost() && layerTreeHost()->requestPartialTextureUpdate())
-                tile->partialUpdate = true;
-            else if (tileNeedsBufferedUpdate(tile) && layerTreeHost()) {
-                layerTreeHost()->deleteTextureAfterCommit(tile->managedTexture()->steal());
-                // Sets the dirty rect to a full-sized tile with border texels.
-                tile->dirtyRect = m_tiler->tileRect(tile);
+            if (layerTreeHost() && layerTreeHost()->bufferedUpdates() && tileNeedsBufferedUpdate(tile)) {
+                // FIXME: Decide if partial update should be allowed based on cost
+                // of update. https://bugs.webkit.org/show_bug.cgi?id=77376
+                if (tileOnlyNeedsPartialUpdate(tile) && layerTreeHost()->requestPartialTextureUpdate())
+                    tile->partialUpdate = true;
+                else {
+                    layerTreeHost()->deleteTextureAfterCommit(tile->managedTexture()->steal());
+                    // Sets the dirty rect to a full-sized tile with border texels.
+                    tile->dirtyRect = m_tiler->tileRect(tile);
+                }
             }
 
             if (!tile->managedTexture()->reserve(m_tiler->tileSize(), m_textureFormat)) {

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (114202 => 114203)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-04-14 03:32:40 UTC (rev 114202)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-04-14 06:02:08 UTC (rev 114203)
@@ -605,6 +605,11 @@
     }
 }
 
+bool CCLayerTreeHost::bufferedUpdates()
+{
+    return m_settings.maxPartialTextureUpdates != numeric_limits<size_t>::max();
+}
+
 bool CCLayerTreeHost::requestPartialTextureUpdate()
 {
     if (m_partialTextureUpdateRequests >= m_settings.maxPartialTextureUpdates)

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (114202 => 114203)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2012-04-14 03:32:40 UTC (rev 114202)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2012-04-14 06:02:08 UTC (rev 114203)
@@ -216,6 +216,7 @@
     void startRateLimiter(GraphicsContext3D*);
     void stopRateLimiter(GraphicsContext3D*);
 
+    bool bufferedUpdates();
     bool requestPartialTextureUpdate();
     void deleteTextureAfterCommit(PassOwnPtr<ManagedTexture>);
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (114202 => 114203)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-04-14 03:32:40 UTC (rev 114202)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-04-14 06:02:08 UTC (rev 114203)
@@ -1,3 +1,24 @@
+2012-04-13  David Reveman  <reve...@chromium.org>
+
+        [Chromium] Avoid unnecessary full tile updates for checkerboard tiles.
+        https://bugs.webkit.org/show_bug.cgi?id=83804
+
+        Reviewed by James Robinson.
+
+        * tests/CCLayerTreeHostTest.cpp:
+        (WTF::setLayerPropertiesForTesting):
+        (WTF):
+        (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::beginTest):
+        (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::commitCompleteOnCCThread):
+        (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::drawLayersOnCCThread):
+        (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::layout):
+        (WTF::setTestLayerPropertiesForTesting):
+        (WTF::CCLayerTreeHostTestLayerOcclusion::beginTest):
+        (WTF::CCLayerTreeHostTestLayerOcclusionWithFilters::beginTest):
+        (WTF::CCLayerTreeHostTestManySurfaces::beginTest):
+        * tests/TiledLayerChromiumTest.cpp:
+        (WTF::TEST):
+
 2012-04-13  Nico Weber  <tha...@chromium.org>
 
         [chromium] There is no Color(float, float, float) constructor, fix an attempt to call it.

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (114202 => 114203)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-04-14 03:32:40 UTC (rev 114202)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-04-14 06:02:08 UTC (rev 114203)
@@ -1642,6 +1642,18 @@
     runTest(true);
 }
 
+static void setLayerPropertiesForTesting(LayerChromium* layer, LayerChromium* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque)
+{
+    layer->removeAllChildren();
+    if (parent)
+        parent->addChild(layer);
+    layer->setTransform(transform);
+    layer->setAnchorPoint(anchor);
+    layer->setPosition(position);
+    layer->setBounds(bounds);
+    layer->setOpaque(opaque);
+}
+
 class CCLayerTreeHostTestAtomicCommitWithPartialUpdate : public CCLayerTreeHostTest {
 public:
     CCLayerTreeHostTestAtomicCommitWithPartialUpdate()
@@ -1656,11 +1668,12 @@
     virtual void beginTest()
     {
         m_layerTreeHost->setRootLayer(m_parent);
-        m_layerTreeHost->setViewportSize(IntSize(10, 10));
-        m_parent->addChild(m_child);
-        m_child->setOpacity(0.5);
-        m_child->setBounds(IntSize(20, 20));
+        m_layerTreeHost->setViewportSize(IntSize(10, 20));
 
+        TransformationMatrix identityMatrix;
+        setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 20), true);
+        setLayerPropertiesForTesting(m_child.get(), m_parent.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 10), IntSize(10, 10), false);
+
         postSetNeedsCommitToMainThread();
         postSetNeedsRedrawToMainThread();
     }
@@ -1703,15 +1716,31 @@
             EXPECT_EQ(3, context->numTextures());
             // Number of textures used for commit should still be two.
             EXPECT_EQ(2, context->numUsedTextures());
-            // First texture should not have been used.
+            // First texture should have been used.
             EXPECT_TRUE(context->usedTexture(context->texture(0)));
-            // Second texture should have been used.
+            // Second texture should not have been used.
             EXPECT_FALSE(context->usedTexture(context->texture(1)));
-            // New textures should have been used.
+            // Third texture should have been used.
             EXPECT_TRUE(context->usedTexture(context->texture(2)));
 
             context->resetUsedTextures();
             break;
+        case 3:
+            // Number of textures should be two.
+            EXPECT_EQ(2, context->numTextures());
+            // No textures should be used for commit.
+            EXPECT_EQ(0, context->numUsedTextures());
+
+            context->resetUsedTextures();
+            break;
+        case 4:
+            // Number of textures should be two.
+            EXPECT_EQ(2, context->numTextures());
+            // Number of textures used for commit should be one.
+            EXPECT_EQ(1, context->numUsedTextures());
+
+            context->resetUsedTextures();
+            break;
         default:
             ASSERT_NOT_REACHED();
             break;
@@ -1722,10 +1751,14 @@
     {
         CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()));
 
-        // Number of textures used for drawing should always be two.
-        EXPECT_EQ(2, context->numUsedTextures());
+        // Number of textures used for drawing should two except for frame 4
+        // where the viewport only contains one layer.
+        if (impl->frameNumber() == 4)
+            EXPECT_EQ(1, context->numUsedTextures());
+        else
+            EXPECT_EQ(2, context->numUsedTextures());
 
-        if (impl->frameNumber() < 3) {
+        if (impl->frameNumber() < 5) {
             context->resetUsedTextures();
             postSetNeedsAnimateAndCommitToMainThread();
             postSetNeedsRedrawToMainThread();
@@ -1746,6 +1779,13 @@
             m_parent->setNeedsDisplayRect(FloatRect(0, 0, 5, 5));
             m_child->setNeedsDisplayRect(FloatRect(0, 0, 5, 5));
             break;
+        case 3:
+            m_child->setNeedsDisplay();
+            m_layerTreeHost->setViewportSize(IntSize(10, 10));
+            break;
+        case 4:
+            m_layerTreeHost->setViewportSize(IntSize(10, 20));
+            break;
         default:
             ASSERT_NOT_REACHED();
             break;
@@ -1796,16 +1836,9 @@
     Region m_occludedScreenSpace;
 };
 
-static void setLayerPropertiesForTesting(TestLayerChromium* layer, LayerChromium* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque)
+static void setTestLayerPropertiesForTesting(TestLayerChromium* layer, LayerChromium* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque)
 {
-    layer->removeAllChildren();
-    if (parent)
-        parent->addChild(layer);
-    layer->setTransform(transform);
-    layer->setAnchorPoint(anchor);
-    layer->setPosition(position);
-    layer->setBounds(bounds);
-    layer->setOpaque(opaque);
+    setLayerPropertiesForTesting(layer, parent, transform, anchor, position, bounds, opaque);
     layer->clearOccludedScreenSpace();
 }
 
@@ -1833,9 +1866,9 @@
         // positioned on the screen.
 
         // The child layer is rotated and the grandChild is opaque, but clipped to the child and rootLayer
-        setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
-        setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false);
-        setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+        setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false);
+        setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
 
         m_layerTreeHost->setRootLayer(rootLayer);
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
@@ -1868,10 +1901,10 @@
         EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
 
         // Add a second child to the root layer and the regions should merge
-        setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
-        setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(70, 20), IntSize(500, 500), true);
-        setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
-        setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+        setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(70, 20), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
 
         m_layerTreeHost->setRootLayer(rootLayer);
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
@@ -1888,10 +1921,10 @@
         EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size());
 
         // Move the second child to be sure.
-        setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
-        setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
-        setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
-        setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+        setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
 
         m_layerTreeHost->setRootLayer(rootLayer);
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
@@ -1952,10 +1985,10 @@
         EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
 
         // If the child layer has a non-opaque drawOpacity, then it shouldn't contribute to occlusion on stuff below it
-        setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
-        setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
-        setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
-        setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+        setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
 
         child->setMaskLayer(0);
         child->setOpacity(0.5);
@@ -1975,10 +2008,10 @@
         EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
 
         // If the child layer with non-opaque drawOpacity is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer
-        setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
-        setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
-        setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
-        setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+        setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
 
         child->setMaskLayer(0);
         child->setOpacity(0.5);
@@ -2033,10 +2066,10 @@
 
         // If the child layer has a filter that changes alpha values, and is below child2, then child2 should contribute to occlusion on everything,
         // and child shouldn't contribute to the rootLayer
-        setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
-        setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
-        setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
-        setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+        setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
 
         {
             FilterOperations filters;
@@ -2061,10 +2094,10 @@
 
         // If the child layer has a filter that moves pixels/changes alpha, and is below child2, then child should not inherit occlusion from outside its subtree,
         // and should not contribute to the rootLayer
-        setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
-        setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
-        setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
-        setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+        setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+        setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
 
         {
             FilterOperations filters;
@@ -2118,10 +2151,10 @@
         for (int i = 0; i < numSurfaces; ++i) {
             layers.append(TestLayerChromium::create());
             if (!i) {
-                setLayerPropertiesForTesting(layers.last().get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+                setTestLayerPropertiesForTesting(layers.last().get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
                 layers.last()->createRenderSurface();
             } else {
-                setLayerPropertiesForTesting(layers.last().get(), layers[layers.size()-2].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(1, 1), IntSize(100-i, 100-i), true);
+                setTestLayerPropertiesForTesting(layers.last().get(), layers[layers.size()-2].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(1, 1), IntSize(100-i, 100-i), true);
                 layers.last()->setMasksToBounds(true);
                 layers.last()->setReplicaLayer(replica.get()); // Make it have a RenderSurface
             }
@@ -2129,7 +2162,7 @@
 
         for (int i = 1; i < numSurfaces; ++i) {
             children.append(TestLayerChromium::create());
-            setLayerPropertiesForTesting(children.last().get(), layers[i].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
+            setTestLayerPropertiesForTesting(children.last().get(), layers[i].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
         }
 
         m_layerTreeHost->setRootLayer(layers[0].get());

Modified: trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp (114202 => 114203)


--- trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp	2012-04-14 03:32:40 UTC (rev 114202)
+++ trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp	2012-04-14 06:02:08 UTC (rev 114203)
@@ -895,42 +895,84 @@
 
     // Full update of all 6 tiles.
     ccLayerTreeHost->updateLayers(updater);
-    updater.update(0, &allocator, &copier, 4);
-    EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount());
-    EXPECT_TRUE(updater.hasMoreUpdates());
-    layer->fakeLayerTextureUpdater()->clearUpdateCount();
-    updater.update(0, &allocator, &copier, 4);
-    EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount());
-    EXPECT_FALSE(updater.hasMoreUpdates());
-    layer->fakeLayerTextureUpdater()->clearUpdateCount();
+    {
+        DebugScopedSetImplThread implThread;
+        OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+        updater.update(0, &allocator, &copier, 4);
+        EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount());
+        EXPECT_TRUE(updater.hasMoreUpdates());
+        layer->fakeLayerTextureUpdater()->clearUpdateCount();
+        updater.update(0, &allocator, &copier, 4);
+        EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount());
+        EXPECT_FALSE(updater.hasMoreUpdates());
+        layer->fakeLayerTextureUpdater()->clearUpdateCount();
+        layer->pushPropertiesTo(layerImpl.get());
+    }
     ccLayerTreeHost->commitComplete();
 
     // Full update of 3 tiles and partial update of 3 tiles.
     layer->invalidateRect(IntRect(0, 0, 300, 150));
     ccLayerTreeHost->updateLayers(updater);
-    updater.update(0, &allocator, &copier, 4);
-    EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount());
-    EXPECT_TRUE(updater.hasMoreUpdates());
-    layer->fakeLayerTextureUpdater()->clearUpdateCount();
-    updater.update(0, &allocator, &copier, 4);
-    EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount());
-    EXPECT_FALSE(updater.hasMoreUpdates());
-    layer->fakeLayerTextureUpdater()->clearUpdateCount();
+    {
+        DebugScopedSetImplThread implThread;
+        OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+        updater.update(0, &allocator, &copier, 4);
+        EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount());
+        EXPECT_TRUE(updater.hasMoreUpdates());
+        layer->fakeLayerTextureUpdater()->clearUpdateCount();
+        updater.update(0, &allocator, &copier, 4);
+        EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount());
+        EXPECT_FALSE(updater.hasMoreUpdates());
+        layer->fakeLayerTextureUpdater()->clearUpdateCount();
+        layer->pushPropertiesTo(layerImpl.get());
+    }
     ccLayerTreeHost->commitComplete();
 
     // Partial update of 6 tiles.
     layer->invalidateRect(IntRect(50, 50, 200, 100));
-    ccLayerTreeHost->updateLayers(updater);
-    updater.update(0, &allocator, &copier, 4);
-    EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount());
-    EXPECT_TRUE(updater.hasMoreUpdates());
-    layer->fakeLayerTextureUpdater()->clearUpdateCount();
-    updater.update(0, &allocator, &copier, 4);
-    EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount());
-    EXPECT_FALSE(updater.hasMoreUpdates());
-    layer->fakeLayerTextureUpdater()->clearUpdateCount();
+    {
+        DebugScopedSetImplThread implThread;
+        OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+        ccLayerTreeHost->updateLayers(updater);
+        updater.update(0, &allocator, &copier, 4);
+        EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount());
+        EXPECT_TRUE(updater.hasMoreUpdates());
+        layer->fakeLayerTextureUpdater()->clearUpdateCount();
+        updater.update(0, &allocator, &copier, 4);
+        EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount());
+        EXPECT_FALSE(updater.hasMoreUpdates());
+        layer->fakeLayerTextureUpdater()->clearUpdateCount();
+        layer->pushPropertiesTo(layerImpl.get());
+    }
     ccLayerTreeHost->commitComplete();
 
+    // Checkerboard all tiles.
+    layer->invalidateRect(IntRect(0, 0, 300, 200));
+    {
+        DebugScopedSetImplThread implThread;
+        OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+        layer->pushPropertiesTo(layerImpl.get());
+    }
+    ccLayerTreeHost->commitComplete();
+
+    // Partail update of 6 checkerboard tiles.
+    layer->invalidateRect(IntRect(50, 50, 200, 100));
+    {
+        DebugScopedSetImplThread implThread;
+        OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+        ccLayerTreeHost->updateLayers(updater);
+        updater.update(0, &allocator, &copier, 4);
+        EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount());
+        EXPECT_TRUE(updater.hasMoreUpdates());
+        layer->fakeLayerTextureUpdater()->clearUpdateCount();
+        updater.update(0, &allocator, &copier, 4);
+        EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount());
+        EXPECT_FALSE(updater.hasMoreUpdates());
+        layer->fakeLayerTextureUpdater()->clearUpdateCount();
+        layer->pushPropertiesTo(layerImpl.get());
+    }
+    ccLayerTreeHost->commitComplete();
+
     ccLayerTreeHost->setRootLayer(0);
     ccLayerTreeHost.clear();
     WebKit::WebCompositor::shutdown();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to