Title: [118454] trunk/Source
Revision
118454
Author
[email protected]
Date
2012-05-24 18:01:49 -0700 (Thu, 24 May 2012)

Log Message

[chromium] Add a setForceRenderSurface to WebLayer for test/bench purpose
https://bugs.webkit.org/show_bug.cgi?id=87436

Reviewed by James Robinson.

Source/Platform:

* chromium/public/WebLayer.h:
(WebLayer):

Source/WebCore:

Tested by CCLayerTreeHostCommonTest.verifyForceRenderSurface

* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::LayerChromium):
(WebCore::LayerChromium::setForceRenderSurface):
(WebCore):
(WebCore::LayerChromium::pushPropertiesTo):
* platform/graphics/chromium/LayerChromium.h:
(WebCore::LayerChromium::forceRenderSurface):
(LayerChromium):
* platform/graphics/chromium/cc/CCLayerImpl.cpp:
(WebCore::CCLayerImpl::CCLayerImpl):
* platform/graphics/chromium/cc/CCLayerImpl.h:
(WebCore::CCLayerImpl::forceRenderSurface):
(WebCore::CCLayerImpl::setForceRenderSurface):
(CCLayerImpl):
* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::subtreeShouldRenderToSeparateSurface):

Source/WebKit/chromium:

* src/WebLayer.cpp:
(WebKit::WebLayer::setForceRenderSurface):
(WebKit):
(WebKit::WebLayer::forceRenderSurface):
* tests/CCLayerTreeHostCommonTest.cpp:
(WebKitTests::TEST):
(WebKitTests):
* tests/LayerChromiumTest.cpp:

Modified Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (118453 => 118454)


--- trunk/Source/Platform/ChangeLog	2012-05-25 00:56:01 UTC (rev 118453)
+++ trunk/Source/Platform/ChangeLog	2012-05-25 01:01:49 UTC (rev 118454)
@@ -1,3 +1,13 @@
+2012-05-24  Antoine Labour  <[email protected]>
+
+        [chromium] Add a setForceRenderSurface to WebLayer for test/bench purpose
+        https://bugs.webkit.org/show_bug.cgi?id=87436
+
+        Reviewed by James Robinson.
+
+        * chromium/public/WebLayer.h:
+        (WebLayer):
+
 2012-05-24  Mark Pilgrim  <[email protected]>
 
         [Chromium] Move queryLocalizedString to Platform.h

Modified: trunk/Source/Platform/chromium/public/WebLayer.h (118453 => 118454)


--- trunk/Source/Platform/chromium/public/WebLayer.h	2012-05-25 00:56:01 UTC (rev 118453)
+++ trunk/Source/Platform/chromium/public/WebLayer.h	2012-05-25 01:01:49 UTC (rev 118454)
@@ -124,6 +124,10 @@
     WEBKIT_EXPORT void setDebugBorderColor(const WebColor&);
     WEBKIT_EXPORT void setDebugBorderWidth(float);
 
+    // Forces this layer to use a render surface. There is no benefit in doing
+    // so, but this is to facilitate benchmarks and tests.
+    WEBKIT_EXPORT void setForceRenderSurface(bool);
+
     template<typename T> T to()
     {
         T res;

Modified: trunk/Source/WebCore/ChangeLog (118453 => 118454)


--- trunk/Source/WebCore/ChangeLog	2012-05-25 00:56:01 UTC (rev 118453)
+++ trunk/Source/WebCore/ChangeLog	2012-05-25 01:01:49 UTC (rev 118454)
@@ -1,3 +1,29 @@
+2012-05-24  Antoine Labour  <[email protected]>
+
+        [chromium] Add a setForceRenderSurface to WebLayer for test/bench purpose
+        https://bugs.webkit.org/show_bug.cgi?id=87436
+
+        Reviewed by James Robinson.
+
+        Tested by CCLayerTreeHostCommonTest.verifyForceRenderSurface
+
+        * platform/graphics/chromium/LayerChromium.cpp:
+        (WebCore::LayerChromium::LayerChromium):
+        (WebCore::LayerChromium::setForceRenderSurface):
+        (WebCore):
+        (WebCore::LayerChromium::pushPropertiesTo):
+        * platform/graphics/chromium/LayerChromium.h:
+        (WebCore::LayerChromium::forceRenderSurface):
+        (LayerChromium):
+        * platform/graphics/chromium/cc/CCLayerImpl.cpp:
+        (WebCore::CCLayerImpl::CCLayerImpl):
+        * platform/graphics/chromium/cc/CCLayerImpl.h:
+        (WebCore::CCLayerImpl::forceRenderSurface):
+        (WebCore::CCLayerImpl::setForceRenderSurface):
+        (CCLayerImpl):
+        * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
+        (WebCore::subtreeShouldRenderToSeparateSurface):
+
 2012-05-24  Ken Buchanan  <[email protected]>
 
         Layout root not getting cleared for anonymous renderers geting destroyed

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp (118453 => 118454)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp	2012-05-25 00:56:01 UTC (rev 118453)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp	2012-05-25 01:01:49 UTC (rev 118454)
@@ -80,6 +80,7 @@
     , m_preserves3D(false)
     , m_alwaysReserveTextures(false)
     , m_drawCheckerboardForMissingTiles(false)
+    , m_forceRenderSurface(false)
     , m_replicaLayer(0)
     , m_drawOpacity(0)
     , m_drawOpacityIsAnimating(false)
@@ -426,6 +427,14 @@
     setNeedsCommit();
 }
 
+void LayerChromium::setForceRenderSurface(bool force)
+{
+    if (m_forceRenderSurface == force)
+        return;
+    m_forceRenderSurface = force;
+    setNeedsCommit();
+}
+
 void LayerChromium::setDoubleSided(bool doubleSided)
 {
     if (m_doubleSided == doubleSided)
@@ -473,6 +482,7 @@
     layer->setDebugName(m_debugName.isolatedCopy()); // We have to use isolatedCopy() here to safely pass ownership to another thread.
     layer->setDoubleSided(m_doubleSided);
     layer->setDrawCheckerboardForMissingTiles(m_drawCheckerboardForMissingTiles);
+    layer->setForceRenderSurface(m_forceRenderSurface);
     layer->setDrawsContent(drawsContent());
     layer->setFilters(filters());
     layer->setBackgroundFilters(backgroundFilters());

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h (118453 => 118454)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h	2012-05-25 00:56:01 UTC (rev 118453)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h	2012-05-25 01:01:49 UTC (rev 118454)
@@ -152,6 +152,9 @@
     void setDrawCheckerboardForMissingTiles(bool);
     bool drawCheckerboardForMissingTiles() const { return m_drawCheckerboardForMissingTiles; }
 
+    bool forceRenderSurface() const { return m_forceRenderSurface; }
+    void setForceRenderSurface(bool);
+
     IntSize scrollDelta() const { return IntSize(); }
 
     float pageScaleDelta() const { return 1; }
@@ -329,6 +332,7 @@
     bool m_preserves3D;
     bool m_alwaysReserveTextures;
     bool m_drawCheckerboardForMissingTiles;
+    bool m_forceRenderSurface;
 
     TransformationMatrix m_transform;
     TransformationMatrix m_sublayerTransform;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp (118453 => 118454)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp	2012-05-25 00:56:01 UTC (rev 118453)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp	2012-05-25 01:01:49 UTC (rev 118454)
@@ -60,6 +60,7 @@
     , m_usesLayerClipping(false)
     , m_isNonCompositedContent(false)
     , m_drawsContent(false)
+    , m_forceRenderSurface(false)
     , m_pageScaleDelta(1)
     , m_targetRenderSurface(0)
     , m_drawDepth(0)

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h (118453 => 118454)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h	2012-05-25 00:56:01 UTC (rev 118453)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h	2012-05-25 01:01:49 UTC (rev 118454)
@@ -94,6 +94,9 @@
     void setDrawsContent(bool);
     bool drawsContent() const { return m_drawsContent; }
 
+    bool forceRenderSurface() const { return m_forceRenderSurface; }
+    void setForceRenderSurface(bool force) { m_forceRenderSurface = force; }
+
     // Returns true if any of the layer's descendants has content to draw.
     bool descendantDrawsContent();
 
@@ -307,6 +310,7 @@
     bool m_isNonCompositedContent;
 
     bool m_drawsContent;
+    bool m_forceRenderSurface;
 
     FloatSize m_scrollDelta;
     IntSize m_sentScrollDelta;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp (118453 => 118454)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp	2012-05-25 00:56:01 UTC (rev 118453)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp	2012-05-25 01:01:49 UTC (rev 118454)
@@ -242,6 +242,10 @@
     // A layer and its descendants should render onto a new RenderSurface if any of these rules hold:
     //
 
+    // If we force it.
+    if (layer->forceRenderSurface())
+        return true;
+
     // If the layer uses a mask.
     if (layer->maskLayer())
         return true;

Modified: trunk/Source/WebKit/chromium/ChangeLog (118453 => 118454)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-05-25 00:56:01 UTC (rev 118453)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-05-25 01:01:49 UTC (rev 118454)
@@ -1,3 +1,19 @@
+2012-05-24  Antoine Labour  <[email protected]>
+
+        [chromium] Add a setForceRenderSurface to WebLayer for test/bench purpose
+        https://bugs.webkit.org/show_bug.cgi?id=87436
+
+        Reviewed by James Robinson.
+
+        * src/WebLayer.cpp:
+        (WebKit::WebLayer::setForceRenderSurface):
+        (WebKit):
+        (WebKit::WebLayer::forceRenderSurface):
+        * tests/CCLayerTreeHostCommonTest.cpp:
+        (WebKitTests::TEST):
+        (WebKitTests):
+        * tests/LayerChromiumTest.cpp:
+
 2012-05-24  Adam Barth  <[email protected]>
 
         Fix the chromium-android build.

Modified: trunk/Source/WebKit/chromium/src/WebLayer.cpp (118453 => 118454)


--- trunk/Source/WebKit/chromium/src/WebLayer.cpp	2012-05-25 00:56:01 UTC (rev 118453)
+++ trunk/Source/WebKit/chromium/src/WebLayer.cpp	2012-05-25 01:01:49 UTC (rev 118454)
@@ -294,6 +294,11 @@
     m_private->setDebugBorderWidth(width);
 }
 
+void WebLayer::setForceRenderSurface(bool forceRenderSurface)
+{
+    m_private->setForceRenderSurface(forceRenderSurface);
+}
+
 WebLayer::WebLayer(const PassRefPtr<LayerChromium>& node)
     : m_private(node)
 {

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp (118453 => 118454)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp	2012-05-25 00:56:01 UTC (rev 118453)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp	2012-05-25 01:01:49 UTC (rev 118454)
@@ -581,6 +581,37 @@
     EXPECT_EQ(parent->drawableContentRect(), IntRect());
 }
 
+TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface)
+{
+    RefPtr<LayerChromium> parent = LayerChromium::create();
+    RefPtr<LayerChromium> renderSurface1 = LayerChromium::create();
+    RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent());
+    renderSurface1->setForceRenderSurface(true);
+
+    const TransformationMatrix identityMatrix;
+    setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
+    setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
+
+    parent->createRenderSurface();
+    parent->setClipRect(IntRect(0, 0, 10, 10));
+    parent->addChild(renderSurface1);
+    renderSurface1->addChild(child);
+
+    Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+    Vector<RefPtr<LayerChromium> > dummyLayerList;
+    int dummyMaxTextureSize = 512;
+    CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+
+    EXPECT_TRUE(renderSurface1->renderSurface());
+    EXPECT_EQ(renderSurfaceLayerList.size(), 1U);
+
+    renderSurfaceLayerList.clear();
+    renderSurface1->setForceRenderSurface(false);
+    CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+    EXPECT_FALSE(renderSurface1->renderSurface());
+    EXPECT_EQ(renderSurfaceLayerList.size(), 0U);
+}
+
 TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces)
 {
     // The entire subtree of layers that are outside the clipRect should be culled away,

Modified: trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp (118453 => 118454)


--- trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp	2012-05-25 00:56:01 UTC (rev 118453)
+++ trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp	2012-05-25 01:01:49 UTC (rev 118454)
@@ -522,6 +522,7 @@
     EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDoubleSided(false));
     EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDebugName("Test Layer"));
     EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDrawCheckerboardForMissingTiles(!testLayer->drawCheckerboardForMissingTiles()));
+    EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setForceRenderSurface(true));
 
     // The above tests should not have caused a change to the needsDisplay flag.
     EXPECT_FALSE(testLayer->needsDisplay());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to