Title: [109168] trunk/Source
Revision
109168
Author
[email protected]
Date
2012-02-28 16:27:41 -0800 (Tue, 28 Feb 2012)

Log Message

[chromium] Reset damage tracker on visibility change.
https://bugs.webkit.org/show_bug.cgi?id=79267

Patch by Jonathan Backer <[email protected]> on 2012-02-28
Reviewed by James Robinson.

Source/WebCore:

Unit tests: CCLayerTreeHostImplTest.cpp

* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::setVisible):

Source/WebKit/chromium:

* tests/CCLayerTreeHostImplTest.cpp:
(WebKit::PartialSwapTrackerContext::getString):
(WebKit):
(WebKit::TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109167 => 109168)


--- trunk/Source/WebCore/ChangeLog	2012-02-29 00:14:15 UTC (rev 109167)
+++ trunk/Source/WebCore/ChangeLog	2012-02-29 00:27:41 UTC (rev 109168)
@@ -1,3 +1,15 @@
+2012-02-28  Jonathan Backer  <[email protected]>
+
+        [chromium] Reset damage tracker on visibility change.
+        https://bugs.webkit.org/show_bug.cgi?id=79267
+
+        Reviewed by James Robinson.
+
+        Unit tests: CCLayerTreeHostImplTest.cpp
+
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::setVisible):
+
 2012-02-28  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r108834.

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (109167 => 109168)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2012-02-29 00:14:15 UTC (rev 109167)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2012-02-29 00:27:41 UTC (rev 109168)
@@ -285,9 +285,17 @@
 {
     if (!visible)
         releaseRenderSurfaceTextures();
+
+    // TODO: Replace setVisibilityCHROMIUM with an extension to explicitly manage front/backbuffers
+    // crbug.com/116049
     if (m_capabilities.usingSetVisibility) {
         Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(m_context->getExtensions());
         extensions3DChromium->setVisibilityCHROMIUM(visible);
+
+        // Reset the damage tracker because the front/back buffers may have been damaged by the GPU
+        // process on visibility change.
+        if (visible && m_capabilities.usingPartialSwap)
+            m_owner->setFullRootLayerDamage();
     }
 }
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (109167 => 109168)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-02-29 00:14:15 UTC (rev 109167)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-02-29 00:27:41 UTC (rev 109168)
@@ -1,3 +1,15 @@
+2012-02-28  Jonathan Backer  <[email protected]>
+
+        [chromium] Reset damage tracker on visibility change.
+        https://bugs.webkit.org/show_bug.cgi?id=79267
+
+        Reviewed by James Robinson.
+
+        * tests/CCLayerTreeHostImplTest.cpp:
+        (WebKit::PartialSwapTrackerContext::getString):
+        (WebKit):
+        (WebKit::TEST_F):
+
 2012-02-28  Tim Dresser  <[email protected]>
 
         Provide DefaultDeviceScaleFactor though WebSettings

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp (109167 => 109168)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp	2012-02-29 00:14:15 UTC (rev 109167)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp	2012-02-29 00:27:41 UTC (rev 109168)
@@ -745,7 +745,7 @@
     virtual WebString getString(WGC3Denum name)
     {
         if (name == GraphicsContext3D::EXTENSIONS)
-            return WebString("GL_CHROMIUM_post_sub_buffer");
+            return WebString("GL_CHROMIUM_post_sub_buffer GL_CHROMIUM_set_visibility");
 
         return WebString();
     }
@@ -822,4 +822,47 @@
     EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height());
 }
 
+// Make sure that we reset damage tracking on visibility change because the
+// state of the front buffer that we push to with PostSubBuffer is undefined.
+TEST_F(CCLayerTreeHostImplTest, visibilityChangeResetsDamage)
+{
+    PartialSwapTrackerContext* partialSwapTracker = new PartialSwapTrackerContext();
+    RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(partialSwapTracker), GraphicsContext3D::RenderDirectlyToHostWindow);
+
+    // This test creates its own CCLayerTreeHostImpl, so
+    // that we can force partial swap enabled.
+    CCSettings settings;
+    settings.partialSwapEnabled = true;
+    OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(settings, this);
+    layerTreeHostImpl->initializeLayerRenderer(context);
+    layerTreeHostImpl->setViewportSize(IntSize(500, 500));
+
+    CCLayerImpl* root = new FakeDrawableCCLayerImpl(1);
+    root->setAnchorPoint(FloatPoint(0, 0));
+    root->setBounds(IntSize(500, 500));
+    root->setDrawsContent(true);
+    layerTreeHostImpl->setRootLayer(adoptPtr(root));
+
+    // First frame: ignore.
+    layerTreeHostImpl->drawLayers();
+    layerTreeHostImpl->swapBuffers();
+ 
+    // Second frame: nothing has changed --- so we souldn't push anything with partial swap.
+    layerTreeHostImpl->drawLayers();
+    layerTreeHostImpl->swapBuffers();
+    EXPECT_TRUE(partialSwapTracker->partialSwapRect().isEmpty());
+
+    // Third frame: visibility change --- so we should push a full frame with partial swap.
+    layerTreeHostImpl->setVisible(false);
+    layerTreeHostImpl->setVisible(true);
+    layerTreeHostImpl->drawLayers();
+    layerTreeHostImpl->swapBuffers();
+    IntRect actualSwapRect = partialSwapTracker->partialSwapRect();
+    IntRect expectedSwapRect = IntRect(IntPoint::zero(), IntSize(500, 500));
+    EXPECT_EQ(expectedSwapRect.x(), actualSwapRect.x());
+    EXPECT_EQ(expectedSwapRect.y(), actualSwapRect.y());
+    EXPECT_EQ(expectedSwapRect.width(), actualSwapRect.width());
+    EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height());
+}
+
 } // namespace
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to