Changeset 112332 in webkit


Ignore:
Timestamp:
Mar 27, 2012 4:49:04 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[chromium] Unknown transforms should be treated as non-axis aligned on main thread
https://bugs.webkit.org/show_bug.cgi?id=82370

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

Source/WebCore:

On main thread, animating transforms have "unknown" values as they are changing
out of sync on the impl thread. So treat them as non-axis-aligned since they
may be, when deciding to create a render surface.

In addition, since surfaces are cheap on main thread, create one for all layers
with animating transforms and a drawing descendant, as this allows paint culling
within the layer's subtree (the animated transform won't affect drawTransforms
inside the subtree).

Also renamed the layerIsInAnimatingSubtreeFor* to animatingTransformTo*.
The old name made me pause and think what it meant and I'm the one who
created it. Hopefully this is more clear.

Unit test: CCLayerTreeHostCommonTest.verifyAnimationsForRenderSurfaceHierarchy

  • platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:

(WebCore::transformToParentIsKnown):
(WebCore):
(WebCore::subtreeShouldRenderToSeparateSurface):
(WebCore::calculateDrawTransformsAndVisibilityInternal):

Source/WebKit/chromium:

  • tests/CCLayerTreeHostCommonTest.cpp:

(WebKitTests::TEST):

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r112329 r112332  
     12012-03-27  Dana Jansens  <danakj@chromium.org>
     2
     3        [chromium] Unknown transforms should be treated as non-axis aligned on main thread
     4        https://bugs.webkit.org/show_bug.cgi?id=82370
     5
     6        Reviewed by Adrienne Walker.
     7
     8        On main thread, animating transforms have "unknown" values as they are changing
     9        out of sync on the impl thread. So treat them as non-axis-aligned since they
     10        may be, when deciding to create a render surface.
     11
     12        In addition, since surfaces are cheap on main thread, create one for all layers
     13        with animating transforms and a drawing descendant, as this allows paint culling
     14        within the layer's subtree (the animated transform won't affect drawTransforms
     15        inside the subtree).
     16
     17        Also renamed the layerIsInAnimatingSubtreeFor* to animatingTransformTo*.
     18        The old name made me pause and think what it meant and I'm the one who
     19        created it. Hopefully this is more clear.
     20
     21        Unit test: CCLayerTreeHostCommonTest.verifyAnimationsForRenderSurfaceHierarchy
     22
     23        * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
     24        (WebCore::transformToParentIsKnown):
     25        (WebCore):
     26        (WebCore::subtreeShouldRenderToSeparateSurface):
     27        (WebCore::calculateDrawTransformsAndVisibilityInternal):
     28
    1292012-03-27  Dirk Pranke  <dpranke@chromium.org>
    230
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp

    r111499 r112332  
    140140}
    141141
     142static inline bool transformToParentIsKnown(CCLayerImpl*)
     143{
     144    return true;
     145}
     146
     147static inline bool transformToParentIsKnown(LayerChromium* layer)
     148{
     149    return !layer->transformIsAnimating();
     150}
     151
    142152template<typename LayerType>
    143153static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlignedWithRespectToParent)
     
    170180    // treated as a 3D object by its parent (i.e. parent does preserve-3d).
    171181    if (layer->parent() && layer->parent()->preserves3D() && !layer->preserves3D() && descendantDrawsContent)
     182        return true;
     183
     184    // On the main thread side, animating transforms are unknown, and may cause a RenderSurface on the impl side.
     185    // Since they are cheap, we create a rendersurface for all animating transforms to cover these cases, and so
     186    // that we can consider descendants as not animating relative to their target to aid culling.
     187    if (!transformToParentIsKnown(layer) && descendantDrawsContent)
    172188        return true;
    173189
     
    316332    combinedTransform = combinedTransform.multiply(layerLocalTransform);
    317333
    318     bool layerIsInAnimatingSubtreeForSurface = layer->transformIsAnimating();
    319     bool layerIsInAnimatingSubtreeForScreen = layer->transformIsAnimating();
     334    bool animatingTransformToTarget = layer->transformIsAnimating();
     335    bool animatingTransformToScreen = animatingTransformToTarget;
    320336    if (layer->parent()) {
    321         layerIsInAnimatingSubtreeForSurface |= layer->parent()->drawTransformIsAnimating();
    322         layerIsInAnimatingSubtreeForScreen |= layer->parent()->screenSpaceTransformIsAnimating();
     337        animatingTransformToTarget |= layer->parent()->drawTransformIsAnimating();
     338        animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAnimating();
    323339    }
    324340
     
    357373        renderSurface->setOriginTransform(surfaceOriginTransform);
    358374
    359         renderSurface->setTargetSurfaceTransformsAreAnimating(layerIsInAnimatingSubtreeForSurface);
    360         renderSurface->setScreenSpaceTransformsAreAnimating(layerIsInAnimatingSubtreeForScreen);
    361         layerIsInAnimatingSubtreeForSurface = false;
    362         layer->setDrawTransformIsAnimating(layerIsInAnimatingSubtreeForSurface);
    363         layer->setScreenSpaceTransformIsAnimating(layerIsInAnimatingSubtreeForScreen);
     375        renderSurface->setTargetSurfaceTransformsAreAnimating(animatingTransformToTarget);
     376        renderSurface->setScreenSpaceTransformsAreAnimating(animatingTransformToScreen);
     377        animatingTransformToTarget = false;
     378        layer->setDrawTransformIsAnimating(animatingTransformToTarget);
     379        layer->setScreenSpaceTransformIsAnimating(animatingTransformToScreen);
    364380
    365381        // Update the aggregate hierarchy matrix to include the transform of the newly created RenderSurface.
     
    388404    } else {
    389405        layer->setDrawTransform(combinedTransform);
    390         layer->setDrawTransformIsAnimating(layerIsInAnimatingSubtreeForSurface);
    391         layer->setScreenSpaceTransformIsAnimating(layerIsInAnimatingSubtreeForScreen);
     406        layer->setDrawTransformIsAnimating(animatingTransformToTarget);
     407        layer->setScreenSpaceTransformIsAnimating(animatingTransformToScreen);
    392408        transformedLayerRect = enclosingIntRect(layer->drawTransform().mapRect(layerRect));
    393409
  • trunk/Source/WebKit/chromium/ChangeLog

    r112327 r112332  
     12012-03-27  Dana Jansens  <danakj@chromium.org>
     2
     3        [chromium] Unknown transforms should be treated as non-axis aligned on main thread
     4        https://bugs.webkit.org/show_bug.cgi?id=82370
     5
     6        Reviewed by Adrienne Walker.
     7
     8        * tests/CCLayerTreeHostCommonTest.cpp:
     9        (WebKitTests::TEST):
     10
    1112012-03-27  Dana Jansens  <danakj@chromium.org>
    212
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp

    r112317 r112332  
    677677    // In combination with descendantDrawsContent, opacity != 1 forces the layer to have a new renderSurface.
    678678    addOpacityTransitionToController(*renderSurface1->layerAnimationController(), 10, 1, 0, false);
    679     addOpacityTransitionToController(*renderSurface2->layerAnimationController(), 10, 1, 0, false);
    680 
    681     // Also put an animation on a layer without descendants.
     679
     680    // Also put an animated opacity on a layer without descendants.
    682681    addOpacityTransitionToController(*grandChildOfRoot->layerAnimationController(), 10, 1, 0, false);
    683682
     
    687686    sublayerTransform.scale3d(10.0, 1.0, 1.0);
    688687
    689     // Put transform animations on child, renderSurface2, grandChildOfRoot, and grandChildOfRS2
    690     addAnimatedTransformToController(*childOfRoot->layerAnimationController(), 10, 30, 0);
     688    // In combination with descendantDrawsContent, an animated transform forces the layer to have a new renderSurface.
     689    addAnimatedTransformToController(*renderSurface2->layerAnimationController(), 10, 30, 0);
     690
     691    // Also put transform animations on grandChildOfRoot, and grandChildOfRS2
    691692    addAnimatedTransformToController(*grandChildOfRoot->layerAnimationController(), 10, 30, 0);
    692     addAnimatedTransformToController(*renderSurface2->layerAnimationController(), 10, 30, 0);
    693693    addAnimatedTransformToController(*grandChildOfRS2->layerAnimationController(), 10, 30, 0);
    694694
     
    743743    EXPECT_FALSE(grandChildOfRS1->drawOpacityIsAnimating());
    744744    EXPECT_FALSE(renderSurface2->drawOpacityIsAnimating());
    745     EXPECT_TRUE(renderSurface2->renderSurface()->drawOpacityIsAnimating());
     745    EXPECT_FALSE(renderSurface2->renderSurface()->drawOpacityIsAnimating());
    746746    EXPECT_FALSE(childOfRS2->drawOpacityIsAnimating());
    747747    EXPECT_FALSE(grandChildOfRS2->drawOpacityIsAnimating());
     
    750750    //
    751751    EXPECT_FALSE(parent->drawTransformIsAnimating());
    752     EXPECT_TRUE(childOfRoot->drawTransformIsAnimating());
     752    EXPECT_FALSE(childOfRoot->drawTransformIsAnimating());
    753753    EXPECT_TRUE(grandChildOfRoot->drawTransformIsAnimating());
    754754    EXPECT_FALSE(renderSurface1->drawTransformIsAnimating());
     
    764764    //
    765765    EXPECT_FALSE(parent->screenSpaceTransformIsAnimating());
    766     EXPECT_TRUE(childOfRoot->screenSpaceTransformIsAnimating());
     766    EXPECT_FALSE(childOfRoot->screenSpaceTransformIsAnimating());
    767767    EXPECT_TRUE(grandChildOfRoot->screenSpaceTransformIsAnimating());
    768768    EXPECT_FALSE(renderSurface1->screenSpaceTransformIsAnimating());
Note: See TracChangeset for help on using the changeset viewer.