[chromium] Push culled tiles that are prepainted
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Mar 2012 03:10:45 +0000 (03:10 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Mar 2012 03:10:45 +0000 (03:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=81552

Patch by Dana Jansens <danakj@chromium.org> on 2012-03-19
Reviewed by Adrienne Walker.

Source/WebCore:

If a tile was culled during paint, but then prepainted in the following
idle paint pass, it was still marked as culled (and thus dirty) and not
pushed to the impl side.

Renames tile->m_updateCulled to tile->m_updated. This value is true if
the tile is updated any time during a commit, and remains false if it
is culled every time the layer is painted.

Unit test: TiledLayerChromiumTest.pushIdlePaintedOccludedTiles

* platform/graphics/chromium/TiledLayerChromium.cpp:
(WebCore::UpdatableTile::isDirtyForCurrentFrame):
(UpdatableTile):
(WebCore::UpdatableTile::UpdatableTile):
(WebCore::TiledLayerChromium::updateCompositorResources):
(WebCore::TiledLayerChromium::prepareToUpdateTiles):
(WebCore::TiledLayerChromium::resetUpdateState):

Source/WebKit/chromium:

* tests/TiledLayerChromiumTest.cpp:
(WTF::TEST):
(WTF):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111335 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp

index 2fcb5c57de4a3d7dde187cd585fcb7dac1ef4f05..dd2a49178163fdf53498ffebc9738b7a92aba7b9 100644 (file)
@@ -1,3 +1,28 @@
+2012-03-19  Dana Jansens  <danakj@chromium.org>
+
+        [chromium] Push culled tiles that are prepainted
+        https://bugs.webkit.org/show_bug.cgi?id=81552
+
+        Reviewed by Adrienne Walker.
+
+        If a tile was culled during paint, but then prepainted in the following
+        idle paint pass, it was still marked as culled (and thus dirty) and not
+        pushed to the impl side.
+
+        Renames tile->m_updateCulled to tile->m_updated. This value is true if
+        the tile is updated any time during a commit, and remains false if it
+        is culled every time the layer is painted.
+
+        Unit test: TiledLayerChromiumTest.pushIdlePaintedOccludedTiles
+
+        * platform/graphics/chromium/TiledLayerChromium.cpp:
+        (WebCore::UpdatableTile::isDirtyForCurrentFrame):
+        (UpdatableTile):
+        (WebCore::UpdatableTile::UpdatableTile):
+        (WebCore::TiledLayerChromium::updateCompositorResources):
+        (WebCore::TiledLayerChromium::prepareToUpdateTiles):
+        (WebCore::TiledLayerChromium::resetUpdateState):
+
 2012-03-19  Anders Carlsson  <andersca@apple.com>
 
         Fix Snow Leopard build.
 2012-03-19  Anders Carlsson  <andersca@apple.com>
 
         Fix Snow Leopard build.
index 715b8bd342c53f7bc25ec0877edb12df3d00ef53..08944d15080f01995d13e47c0960268678d104ae 100644 (file)
@@ -72,16 +72,16 @@ public:
     }
     // Returns whether the layer was dirty and not updated in the current frame. For tiles that were not culled, the
     // updateRect holds the area of the tile that was updated. Otherwise, the area that would have been updated.
     }
     // Returns whether the layer was dirty and not updated in the current frame. For tiles that were not culled, the
     // updateRect holds the area of the tile that was updated. Otherwise, the area that would have been updated.
-    bool isDirtyForCurrentFrame() { return !m_dirtyRect.isEmpty() && (m_updateRect.isEmpty() || m_updateCulled); }
+    bool isDirtyForCurrentFrame() { return !m_dirtyRect.isEmpty() && (m_updateRect.isEmpty() || !m_updated); }
 
     IntRect m_dirtyRect;
     IntRect m_updateRect;
     bool m_partialUpdate;
 
     IntRect m_dirtyRect;
     IntRect m_updateRect;
     bool m_partialUpdate;
-    bool m_updateCulled;
+    bool m_updated;
 private:
     explicit UpdatableTile(PassOwnPtr<LayerTextureUpdater::Texture> texture)
         : m_partialUpdate(false)
 private:
     explicit UpdatableTile(PassOwnPtr<LayerTextureUpdater::Texture> texture)
         : m_partialUpdate(false)
-        , m_updateCulled(false)
+        , m_updated(false)
         , m_texture(texture)
     {
     }
         , m_texture(texture)
     {
     }
@@ -202,7 +202,7 @@ void TiledLayerChromium::updateCompositorResources(GraphicsContext3D*, CCTexture
             if (!tile)
                 CRASH();
 
             if (!tile)
                 CRASH();
 
-            if (tile->m_updateCulled)
+            if (!tile->m_updated)
                 continue;
 
             IntRect sourceRect = tile->m_updateRect;
                 continue;
 
             IntRect sourceRect = tile->m_updateRect;
@@ -431,13 +431,17 @@ void TiledLayerChromium::prepareToUpdateTiles(bool idle, int left, int top, int
             if (!idle && occlusion) {
                 IntRect visibleTileRect = intersection(m_tiler->tileBounds(i, j), visibleLayerRect());
                 if (occlusion->occluded(this, visibleTileRect)) {
             if (!idle && occlusion) {
                 IntRect visibleTileRect = intersection(m_tiler->tileBounds(i, j), visibleLayerRect());
                 if (occlusion->occluded(this, visibleTileRect)) {
-                    tile->m_updateCulled = true;
+                    ASSERT(!tile->m_updated);
                     // Save the area we culled for recording metrics.
                     tile->m_updateRect = tile->m_dirtyRect;
                     continue;
                 }
             }
 
                     // Save the area we culled for recording metrics.
                     tile->m_updateRect = tile->m_dirtyRect;
                     continue;
                 }
             }
 
+            // We come through this function multiple times during a commit, and m_updated should be true if the tile is not culled
+            // any single time through the function.
+            tile->m_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())
             // 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())
@@ -505,8 +509,9 @@ void TiledLayerChromium::prepareToUpdateTiles(bool idle, int left, int top, int
             // make sure that sourceRect doesn't extend outside of it.
             sourceRect.intersect(m_paintRect);
 
             // make sure that sourceRect doesn't extend outside of it.
             sourceRect.intersect(m_paintRect);
 
-            if (tile->m_updateCulled && occlusion) {
-                occlusion->overdrawMetrics().didCull(TransformationMatrix(), sourceRect, IntRect());
+            if (!tile->m_updated) {
+                if (occlusion)
+                    occlusion->overdrawMetrics().didCull(TransformationMatrix(), sourceRect, IntRect());
                 continue;
             }
 
                 continue;
             }
 
@@ -577,7 +582,7 @@ void TiledLayerChromium::resetUpdateState()
         UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get());
         tile->m_updateRect = IntRect();
         tile->m_partialUpdate = false;
         UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get());
         tile->m_updateRect = IntRect();
         tile->m_partialUpdate = false;
-        tile->m_updateCulled = false;
+        tile->m_updated = false;
     }
 }
 
     }
 }
 
index ebdb09e155fa9fad868ebf1d182662a956e0ad8e..c4b146d0162586786e92bebeac061a322cd6edcd 100644 (file)
@@ -1,3 +1,14 @@
+2012-03-19  Dana Jansens  <danakj@chromium.org>
+
+        [chromium] Push culled tiles that are prepainted
+        https://bugs.webkit.org/show_bug.cgi?id=81552
+
+        Reviewed by Adrienne Walker.
+
+        * tests/TiledLayerChromiumTest.cpp:
+        (WTF::TEST):
+        (WTF):
+
 2012-03-19  James Robinson  <jamesr@chromium.org>
 
         Unreviewed chromium compile fix - put all TRACE_*s in their own scope explicitly.
 2012-03-19  James Robinson  <jamesr@chromium.org>
 
         Unreviewed chromium compile fix - put all TRACE_*s in their own scope explicitly.
index 8363c31f2fef884cfdaa373aa88f0a1224546051..5368c29347fde3378afb575236f46ed120daeb1b 100644 (file)
@@ -434,6 +434,33 @@ TEST(TiledLayerChromiumTest, pushIdlePaintTiles)
     }
 }
 
     }
 }
 
+TEST(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles)
+{
+    OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
+    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+    DebugScopedSetImplThread implThread;
+    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+    TestCCOcclusionTracker occluded;
+
+    FakeTextureAllocator textureAllocator;
+    CCTextureUpdater updater(&textureAllocator);
+
+    // The tile size is 100x100, so this invalidates one occluded tile, culls it during paint, but prepaints it.
+    occluded.setOcclusion(IntRect(0, 0, 100, 100));
+
+    layer->setBounds(IntSize(100, 100));
+    layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
+    layer->setVisibleLayerRect(IntRect(0, 0, 100, 100));
+    layer->invalidateRect(IntRect(0, 0, 100, 100));
+    layer->prepareToUpdate(IntRect(0, 0, 100, 100), &occluded);
+    layer->prepareToUpdateIdle(IntRect(0, 0, 100, 100), &occluded);
+    layer->updateCompositorResources(0, updater);
+    layer->pushPropertiesTo(layerImpl.get());
+
+    // We should have the prepainted tile on the impl side.
+    EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
+}
+
 TEST(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint)
 {
     OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
 TEST(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint)
 {
     OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);