Title: [111253] trunk/Source
Revision
111253
Author
[email protected]
Date
2012-03-19 14:37:00 -0700 (Mon, 19 Mar 2012)

Log Message

[chromium] Invalidate/update evicted tiles during commit
https://bugs.webkit.org/show_bug.cgi?id=81529

Patch by Dana Jansens <[email protected]> on 2012-03-19
Reviewed by Adrienne Walker.

Source/WebCore:

A previous change caused a regression where evicted (invalid) tiles
were no longer marked as dirty and updated. The regress was caused
in https://bugs.webkit.org/show_bug.cgi?id=81175 and is fixed here.

Unit test: TiledLayerChromiumTest.pushDeletedTiles

* platform/graphics/chromium/TiledLayerChromium.cpp:
(WebCore::UpdatableTile::copyAndClearDirty):
(WebCore::TiledLayerChromium::prepareToUpdateTiles):

Source/WebKit/chromium:

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111252 => 111253)


--- trunk/Source/WebCore/ChangeLog	2012-03-19 21:36:23 UTC (rev 111252)
+++ trunk/Source/WebCore/ChangeLog	2012-03-19 21:37:00 UTC (rev 111253)
@@ -1,3 +1,20 @@
+2012-03-19  Dana Jansens  <[email protected]>
+
+        [chromium] Invalidate/update evicted tiles during commit
+        https://bugs.webkit.org/show_bug.cgi?id=81529
+
+        Reviewed by Adrienne Walker.
+
+        A previous change caused a regression where evicted (invalid) tiles
+        were no longer marked as dirty and updated. The regress was caused
+        in https://bugs.webkit.org/show_bug.cgi?id=81175 and is fixed here.
+
+        Unit test: TiledLayerChromiumTest.pushDeletedTiles
+
+        * platform/graphics/chromium/TiledLayerChromium.cpp:
+        (WebCore::UpdatableTile::copyAndClearDirty):
+        (WebCore::TiledLayerChromium::prepareToUpdateTiles):
+
 2012-03-19  Adam Barth  <[email protected]>
 
         Remove PLATFORM(TORCHMOBILE) ifdef from MainResourceLoader.cpp

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


--- trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp	2012-03-19 21:36:23 UTC (rev 111252)
+++ trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp	2012-03-19 21:37:00 UTC (rev 111253)
@@ -63,6 +63,11 @@
     ManagedTexture* managedTexture() { return m_texture->texture(); }
 
     bool isDirty() const { return !m_dirtyRect.isEmpty(); }
+    void copyAndClearDirty()
+    {
+        m_updateRect = m_dirtyRect;
+        m_dirtyRect = IntRect();
+    }
     // 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); }
@@ -414,8 +419,10 @@
             if (!tile)
                 tile = createTile(i, j);
 
-            // Save the dirty rect since WebKit can change the tile's dirty rect during painting.
-            tile->m_updateRect = tile->m_dirtyRect;
+            if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat)) {
+                // Sets the dirty rect to a full-sized tile with border texels.
+                tile->m_dirtyRect = m_tiler->tileRect(tile);
+            }
 
             // When not idle painting, if the visible region of the tile is occluded, don't reserve a texture or update the tile.
             // If any part of the tile is visible, then we need to update it so the tile is pushed to the impl thread.
@@ -423,6 +430,8 @@
                 IntRect visibleTileRect = intersection(m_tiler->tileBounds(i, j), visibleLayerRect());
                 if (occlusion->occluded(this, visibleTileRect)) {
                     tile->m_updateCulled = true;
+                    // Save the area we culled for recording metrics.
+                    tile->m_updateRect = tile->m_dirtyRect;
                     continue;
                 }
             }
@@ -431,10 +440,8 @@
             // of update. https://bugs.webkit.org/show_bug.cgi?id=77376
             if (tileOnlyNeedsPartialUpdate(tile) && layerTreeHost() && layerTreeHost()->requestPartialTextureUpdate())
                 tile->m_partialUpdate = true;
-            else if (tileNeedsBufferedUpdate(tile) && layerTreeHost())
+            else if (tileNeedsBufferedUpdate(tile) && layerTreeHost()) {
                 layerTreeHost()->deleteTextureAfterCommit(tile->managedTexture()->steal());
-
-            if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat)) {
                 // Sets the dirty rect to a full-sized tile with border texels.
                 tile->m_dirtyRect = m_tiler->tileRect(tile);
             }
@@ -454,8 +461,7 @@
             }
 
             dirtyLayerRect.unite(tile->m_dirtyRect);
-            // Clear the dirty rect.
-            tile->m_dirtyRect = IntRect();
+            tile->copyAndClearDirty();
         }
     }
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (111252 => 111253)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-19 21:36:23 UTC (rev 111252)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-19 21:37:00 UTC (rev 111253)
@@ -1,3 +1,14 @@
+2012-03-19  Dana Jansens  <[email protected]>
+
+        [chromium] Invalidate/update evicted tiles during commit
+        https://bugs.webkit.org/show_bug.cgi?id=81529
+
+        Reviewed by Adrienne Walker.
+
+        * tests/TiledLayerChromiumTest.cpp:
+        (WTF::TEST):
+        (WTF):
+
 2012-03-19  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r111207.

Modified: trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp (111252 => 111253)


--- trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp	2012-03-19 21:36:23 UTC (rev 111252)
+++ trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp	2012-03-19 21:37:00 UTC (rev 111253)
@@ -335,6 +335,48 @@
     EXPECT_TRUE(layerImpl->hasTileAt(0, 1));
 }
 
+TEST(TiledLayerChromiumTest, pushDeletedTiles)
+{
+    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)));
+
+    FakeTextureAllocator textureAllocator;
+    CCTextureUpdater updater(&textureAllocator);
+
+    // The tile size is 100x100, so this invalidates and then paints two tiles.
+    layer->setBounds(IntSize(100, 200));
+    layer->invalidateRect(IntRect(0, 0, 100, 200));
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
+    layer->updateCompositorResources(0, updater);
+    layer->pushPropertiesTo(layerImpl.get());
+
+    // We should have both tiles on the impl side.
+    EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
+    EXPECT_TRUE(layerImpl->hasTileAt(0, 1));
+
+    textureManager->evictAndDeleteAllTextures(&textureAllocator);
+    textureManager->setMaxMemoryLimitBytes(4*1024*1024);
+    textureManager->setPreferredMemoryLimitBytes(4*1024*1024);
+
+    // This should drop the tiles on the impl thread.
+    layer->pushPropertiesTo(layerImpl.get());
+
+    // We should now have no textures on the impl thread.
+    EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
+    EXPECT_FALSE(layerImpl->hasTileAt(0, 1));
+
+    // This should recreate and update the deleted textures.
+    layer->prepareToUpdate(IntRect(0, 0, 100, 100), 0);
+    layer->updateCompositorResources(0, updater);
+    layer->pushPropertiesTo(layerImpl.get());
+
+    // We should only have the first tile since the other tile was invalidated but not painted.
+    EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
+    EXPECT_FALSE(layerImpl->hasTileAt(0, 1));
+}
+
 TEST(TiledLayerChromiumTest, pushIdlePaintTiles)
 {
     OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to