Title: [113615] trunk/Source/WebKit2
Revision
113615
Author
[email protected]
Date
2012-04-09 13:57:11 -0700 (Mon, 09 Apr 2012)

Log Message

[Qt][WK2] Don't synchronize WebGraphicsLayers to the UI process if the actual layer information wasn't changed
https://bugs.webkit.org/show_bug.cgi?id=82522

Reviewed by Kenneth Rohde Christiansen.

Currently we set the m_modified flags for all of the descendants of a layer
that has changed its geometry. This causes unnecessary layer sync messages.
Instead, we only sync when the actual layer has changed, and add a flag
called m_shouldUpdateVisibleRect that applies to descendants of a layer
that has a modified geometry.

* Shared/WebLayerTreeInfo.h:
* WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
(WebCore::WebGraphicsLayer::didChangeChildren):
(WebCore):
(WebCore::WebGraphicsLayer::setShouldUpdateVisibleRect):
(WebCore::WebGraphicsLayer::didChangeGeometry):
(WebCore::WebGraphicsLayer::WebGraphicsLayer):
(WebCore::WebGraphicsLayer::setPosition):
(WebCore::WebGraphicsLayer::setAnchorPoint):
(WebCore::WebGraphicsLayer::setSize):
(WebCore::WebGraphicsLayer::setTransform):
(WebCore::WebGraphicsLayer::setChildrenTransform):
(WebCore::WebGraphicsLayer::setPreserves3D):
(WebCore::WebGraphicsLayer::setContentsToImage):
(WebCore::WebGraphicsLayer::setNeedsDisplayInRect):
(WebCore::WebGraphicsLayer::syncImageBackingStore):
(WebCore::WebGraphicsLayer::syncCompositingStateForThisLayerOnly):
(WebCore::WebGraphicsLayer::tiledBackingStorePaintBegin):
(WebCore::WebGraphicsLayer::setRootLayer):
(WebCore::WebGraphicsLayer::setVisibleContentRectTrajectoryVector):
(WebCore::WebGraphicsLayer::setContentsScale):
(WebCore::WebGraphicsLayer::effectiveContentsScale):
(WebCore::WebGraphicsLayer::adjustContentsScale):
* WebProcess/WebCoreSupport/WebGraphicsLayer.h:
(WebGraphicsLayer):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (113614 => 113615)


--- trunk/Source/WebKit2/ChangeLog	2012-04-09 20:50:24 UTC (rev 113614)
+++ trunk/Source/WebKit2/ChangeLog	2012-04-09 20:57:11 UTC (rev 113615)
@@ -1,5 +1,44 @@
 2012-04-09  No'am Rosenthal  <[email protected]>
 
+        [Qt][WK2] Don't synchronize WebGraphicsLayers to the UI process if the actual layer information wasn't changed
+        https://bugs.webkit.org/show_bug.cgi?id=82522
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Currently we set the m_modified flags for all of the descendants of a layer
+        that has changed its geometry. This causes unnecessary layer sync messages.
+        Instead, we only sync when the actual layer has changed, and add a flag
+        called m_shouldUpdateVisibleRect that applies to descendants of a layer
+        that has a modified geometry.
+
+        * Shared/WebLayerTreeInfo.h:
+        * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+        (WebCore::WebGraphicsLayer::didChangeChildren):
+        (WebCore):
+        (WebCore::WebGraphicsLayer::setShouldUpdateVisibleRect):
+        (WebCore::WebGraphicsLayer::didChangeGeometry):
+        (WebCore::WebGraphicsLayer::WebGraphicsLayer):
+        (WebCore::WebGraphicsLayer::setPosition):
+        (WebCore::WebGraphicsLayer::setAnchorPoint):
+        (WebCore::WebGraphicsLayer::setSize):
+        (WebCore::WebGraphicsLayer::setTransform):
+        (WebCore::WebGraphicsLayer::setChildrenTransform):
+        (WebCore::WebGraphicsLayer::setPreserves3D):
+        (WebCore::WebGraphicsLayer::setContentsToImage):
+        (WebCore::WebGraphicsLayer::setNeedsDisplayInRect):
+        (WebCore::WebGraphicsLayer::syncImageBackingStore):
+        (WebCore::WebGraphicsLayer::syncCompositingStateForThisLayerOnly):
+        (WebCore::WebGraphicsLayer::tiledBackingStorePaintBegin):
+        (WebCore::WebGraphicsLayer::setRootLayer):
+        (WebCore::WebGraphicsLayer::setVisibleContentRectTrajectoryVector):
+        (WebCore::WebGraphicsLayer::setContentsScale):
+        (WebCore::WebGraphicsLayer::effectiveContentsScale):
+        (WebCore::WebGraphicsLayer::adjustContentsScale):
+        * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
+        (WebGraphicsLayer):
+
+2012-04-09  No'am Rosenthal  <[email protected]>
+
         [Qt][WK2] Remove all USE(TILED_BACKING_STORE) defines from code that contains UI_SIDE_COMPOSITING
         https://bugs.webkit.org/show_bug.cgi?id=82533
 

Modified: trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h (113614 => 113615)


--- trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h	2012-04-09 20:50:24 UTC (rev 113614)
+++ trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h	2012-04-09 20:57:11 UTC (rev 113615)
@@ -106,7 +106,6 @@
             bool backfaceVisible : 1;
             bool masksToBounds : 1;
             bool preserves3D : 1;
-            bool contentNeedsDisplay : 1;
             bool isRootLayer: 1;
         };
         unsigned int flags;

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp (113614 => 113615)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp	2012-04-09 20:50:24 UTC (rev 113614)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp	2012-04-09 20:57:11 UTC (rev 113615)
@@ -68,23 +68,31 @@
         client()->notifySyncRequired(this);
 }
 
-void WebGraphicsLayer::notifyChangeRecursively()
+void WebGraphicsLayer::setShouldUpdateVisibleRect()
 {
-    notifyChange();
+    if (!transform().isAffine())
+        return;
+
+    m_shouldUpdateVisibleRect = true;
     for (size_t i = 0; i < children().size(); ++i)
-        toWebGraphicsLayer(children()[i])->notifyChangeRecursively();
+        toWebGraphicsLayer(children()[i])->setShouldUpdateVisibleRect();
     if (replicaLayer())
-        toWebGraphicsLayer(replicaLayer())->notifyChange();
+        toWebGraphicsLayer(replicaLayer())->setShouldUpdateVisibleRect();
 }
 
+void WebGraphicsLayer::didChangeGeometry()
+{
+    notifyChange();
+    setShouldUpdateVisibleRect();
+}
+
 WebGraphicsLayer::WebGraphicsLayer(GraphicsLayerClient* client)
     : GraphicsLayer(client)
     , m_maskTarget(0)
-    , m_needsDisplay(false)
     , m_modified(true)
-    , m_contentNeedsDisplay(false)
     , m_hasPendingAnimations(false)
     , m_inUpdateMode(false)
+    , m_shouldUpdateVisibleRect(true)
     , m_webGraphicsLayerClient(0)
     , m_contentsScale(1.f)
 {
@@ -182,7 +190,7 @@
         return;
 
     GraphicsLayer::setPosition(p);
-    notifyChangeRecursively();
+    didChangeGeometry();
 }
 
 void WebGraphicsLayer::setAnchorPoint(const FloatPoint3D& p)
@@ -191,7 +199,7 @@
         return;
 
     GraphicsLayer::setAnchorPoint(p);
-    notifyChangeRecursively();
+    didChangeGeometry();
 }
 
 void WebGraphicsLayer::setSize(const FloatSize& size)
@@ -203,7 +211,7 @@
     setNeedsDisplay();
     if (maskLayer())
         maskLayer()->setSize(size);
-    notifyChangeRecursively();
+    didChangeGeometry();
 }
 
 void WebGraphicsLayer::setTransform(const TransformationMatrix& t)
@@ -212,7 +220,7 @@
         return;
 
     GraphicsLayer::setTransform(t);
-    notifyChangeRecursively();
+    didChangeGeometry();
 }
 
 void WebGraphicsLayer::setChildrenTransform(const TransformationMatrix& t)
@@ -221,7 +229,7 @@
         return;
 
     GraphicsLayer::setChildrenTransform(t);
-    notifyChangeRecursively();
+    didChangeGeometry();
 }
 
 void WebGraphicsLayer::setPreserves3D(bool b)
@@ -230,7 +238,7 @@
         return;
 
     GraphicsLayer::setPreserves3D(b);
-    notifyChangeRecursively();
+    didChangeGeometry();
 }
 
 void WebGraphicsLayer::setMasksToBounds(bool b)
@@ -238,7 +246,7 @@
     if (masksToBounds() == b)
         return;
     GraphicsLayer::setMasksToBounds(b);
-    notifyChangeRecursively();
+    didChangeGeometry();
 }
 
 void WebGraphicsLayer::setDrawsContent(bool b)
@@ -309,7 +317,7 @@
         m_transformAnimations.add(keyframesName);
 
     m_hasPendingAnimations = true;
-    notifyChangeRecursively();
+    didChangeGeometry();
 
     return true;
 }
@@ -431,40 +439,43 @@
     return static_cast<WebGraphicsLayer*>(layer);
 }
 
+void WebGraphicsLayer::syncLayerParameters()
+ {
+    if (!m_modified)
+        return;
+
+    m_modified = false;
+    m_layerInfo.name = name();
+    m_layerInfo.anchorPoint = anchorPoint();
+    m_layerInfo.backfaceVisible = backfaceVisibility();
+    m_layerInfo.childrenTransform = childrenTransform();
+    m_layerInfo.contentsOpaque = contentsOpaque();
+    m_layerInfo.contentsRect = contentsRect();
+    m_layerInfo.drawsContent = drawsContent();
+    m_layerInfo.mask = toWebLayerID(maskLayer());
+    m_layerInfo.masksToBounds = masksToBounds();
+    m_layerInfo.opacity = opacity();
+    m_layerInfo.parent = toWebLayerID(parent());
+    m_layerInfo.pos = position();
+    m_layerInfo.preserves3D = preserves3D();
+    m_layerInfo.replica = toWebLayerID(replicaLayer());
+    m_layerInfo.size = size();
+    m_layerInfo.transform = transform();
+    m_layerInfo.children.clear();
+
+    for (size_t i = 0; i < children().size(); ++i)
+        m_layerInfo.children.append(toWebLayerID(children()[i]));
+
+    m_webGraphicsLayerClient->didSyncCompositingStateForLayer(m_layerInfo);
+}
 void WebGraphicsLayer::syncCompositingStateForThisLayerOnly()
 {
     // The remote image might have been released by purgeBackingStores.
     if (m_image && !m_layerInfo.imageBackingStoreID)
         m_layerInfo.imageBackingStoreID = m_webGraphicsLayerClient->adoptImageBackingStore(m_image.get());
 
-    if (m_modified) {
-        computeTransformedVisibleRect();
-
-        m_layerInfo.name = name();
-        m_layerInfo.anchorPoint = anchorPoint();
-        m_layerInfo.backfaceVisible = backfaceVisibility();
-        m_layerInfo.childrenTransform = childrenTransform();
-        m_layerInfo.contentsOpaque = contentsOpaque();
-        m_layerInfo.contentsRect = contentsRect();
-        m_layerInfo.drawsContent = drawsContent();
-        m_layerInfo.mask = toWebLayerID(maskLayer());
-        m_layerInfo.masksToBounds = masksToBounds();
-        m_layerInfo.opacity = opacity();
-        m_layerInfo.parent = toWebLayerID(parent());
-        m_layerInfo.pos = position();
-        m_layerInfo.preserves3D = preserves3D();
-        m_layerInfo.replica = toWebLayerID(replicaLayer());
-        m_layerInfo.size = size();
-        m_layerInfo.transform = transform();
-        m_contentNeedsDisplay = false;
-        m_layerInfo.children.clear();
-
-        for (size_t i = 0; i < children().size(); ++i)
-            m_layerInfo.children.append(toWebLayerID(children()[i]));
-
-        m_webGraphicsLayerClient->didSyncCompositingStateForLayer(m_layerInfo);
-    }
-
+    computeTransformedVisibleRect();
+    syncLayerParameters();
     updateContentBuffers();
 
     m_modified = false;
@@ -659,7 +670,9 @@
 
 void WebGraphicsLayer::computeTransformedVisibleRect()
 {
-    // FIXME: Consider transform animations in the visible rect calculation.
+    if (!m_shouldUpdateVisibleRect)
+        return;
+    m_shouldUpdateVisibleRect = false;
     m_layerTransform.setLocalTransform(transform());
     m_layerTransform.setPosition(position());
     m_layerTransform.setAnchorPoint(anchorPoint());

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h (113614 => 113615)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h	2012-04-09 20:50:24 UTC (rev 113614)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h	2012-04-09 20:57:11 UTC (rev 113615)
@@ -146,14 +146,13 @@
     GraphicsLayer* m_maskTarget;
     FloatRect m_needsDisplayRect;
     LayerTransform m_layerTransform;
-    bool m_needsDisplay : 1;
     bool m_modified : 1;
-    bool m_contentNeedsDisplay : 1;
     bool m_hasPendingAnimations : 1;
-    bool m_inUpdateMode : 2;
+    bool m_inUpdateMode : 1;
+    bool m_shouldUpdateVisibleRect: 1;
 
     void notifyChange();
-    void notifyChangeRecursively();
+    void didChangeGeometry();
     void createBackingStore();
     HashSet<String> m_transformAnimations;
 
@@ -161,6 +160,8 @@
     bool shouldUseTiledBackingStore();
     void adjustContentsScale();
     void computeTransformedVisibleRect();
+    void syncLayerParameters();
+    void setShouldUpdateVisibleRect();
     float effectiveContentsScale();
 
     WebKit::WebGraphicsLayerClient* m_webGraphicsLayerClient;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to