haikuwebkit/LayoutTests/compositing/layer-creation/compositing-policy-expected...

29 lines
712 B
Plaintext
Raw Permalink Normal View History

Be more conservative with compositing layer creation when memory is low https://bugs.webkit.org/show_bug.cgi?id=187866 rdar://problem/42366345 Reviewed by Zalan Bujtas. Source/WebCore: When process physical footprint is above a fraction of the jetsam limit, be more conservative in making compositing layers. We avoid compositing for these situations: 1. Layers with 3D transforms which are affine (like translateZ(0)). 2. Layers with will-change 3. Layers for canvases (other than WebGL/WebGPU) We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS, falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%. Compositing chooses to be more conservative in either "conservative" or "strict" memory modes. Plumb through a "compositingPolicyOverride" both so that on-device testing isn't flakily falling into a different mode, and so that we can impose the conservative mode for testing. Test: compositing/layer-creation/compositing-policy.html * page/Page.h: (WebCore::Page::compositingPolicyOverride const): (WebCore::Page::setCompositingPolicyOverride): * platform/graphics/transforms/Matrix3DTransformOperation.cpp: (WebCore::Matrix3DTransformOperation::isRepresentableIn2D const): * platform/graphics/transforms/Matrix3DTransformOperation.h: * platform/graphics/transforms/PerspectiveTransformOperation.h: * platform/graphics/transforms/RotateTransformOperation.h: * platform/graphics/transforms/ScaleTransformOperation.h: * platform/graphics/transforms/TransformOperation.h: (WebCore::TransformOperation::isRepresentableIn2D const): * platform/graphics/transforms/TransformOperations.h: (WebCore::TransformOperations::has3DOperation const): (WebCore::TransformOperations::isRepresentableIn2D const): * platform/graphics/transforms/TranslateTransformOperation.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGeometry): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags): (WebCore::RenderLayerCompositor::updateCompositingPolicy): (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::requiresCompositingForTransform const): (WebCore::RenderLayerCompositor::requiresCompositingForVideo const): (WebCore::RenderLayerCompositor::requiresCompositingForCanvas const): (WebCore::RenderLayerCompositor::requiresCompositingForPlugin const): (WebCore::RenderLayerCompositor::requiresCompositingForWillChange const): (WebCore::RenderLayerCompositor::needsFixedRootBackgroundLayer const): (WebCore::operator<<): * rendering/RenderLayerCompositor.h: * testing/Internals.cpp: (WebCore::Internals::setCompositingPolicyOverride): (WebCore::Internals::compositingPolicyOverride const): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: When process physical footprint is above a fraction of the jetsam limit, be more conservative in making compositing layers. We avoid compositing for these situations: 1. Layers with 3D transforms which are affine (like translateZ(0)). 2. Layers with will-change 3. Layers for canvases (other than WebGL/WebGPU) We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS, falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%. Compositing chooses to be more conservative in either "conservative" or "strict" memory modes. Plumb through a "compositingPolicyOverride" both so that on-device testing isn't flakily falling into a different mode, and so that we can impose the conservative mode for testing. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageSetCompositingPolicyOverride): * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: Source/WTF: When process physical footprint is above a fraction of the jetsam limit, be more conservative in making compositing layers. We avoid compositing for these situations: 1. Layers with 3D transforms which are affine (like translateZ(0)). 2. Layers with will-change 3. Layers for canvases (other than WebGL/WebGPU) We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS, falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%. Compositing chooses to be more conservative in either "conservative" or "strict" memory modes. Plumb through a "compositingPolicyOverride" both so that on-device testing isn't flakily falling into a different mode, and so that we can impose the conservative mode for testing. * wtf/MemoryPressureHandler.cpp: (WTF::thresholdForPolicy): (WTF::MemoryPressureHandler::currentMemoryUsagePolicy): * wtf/MemoryPressureHandler.h: Tools: When process physical footprint is above a fraction of the jetsam limit, be more conservative in making compositing layers. We avoid compositing for these situations: 1. Layers with 3D transforms which are affine (like translateZ(0)). 2. Layers with will-change 3. Layers for canvases (other than WebGL/WebGPU) We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS, falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%. Compositing chooses to be more conservative in either "conservative" or "strict" memory modes. Plumb through a "compositingPolicyOverride" both so that on-device testing isn't flakily falling into a different mode, and so that we can impose the conservative mode for testing. * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: (WTR::InjectedBundlePage::prepare): LayoutTests: * compositing/layer-creation/compositing-policy-expected.txt: Added. * compositing/layer-creation/compositing-policy.html: Added. Canonical link: https://commits.webkit.org/203249@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234330 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-27 22:20:26 +00:00
transform: translate3d(10px, 1px, 1px)
Has backing under low memory.
transform: translateZ(0)
translateZ(0): No backing under low memory.
transform: translate3d(10px, 1px, 0)
No backing under low memory.
will-change: transform
No backing under low memory.
(GraphicsLayer
(anchor 0.00 0.00)
(bounds 800.00 1018.00)
(children 1
(GraphicsLayer
(bounds 800.00 1018.00)
(contentsOpaque 1)
(children 1
(GraphicsLayer
(position 18.00 10.00)
(bounds 308.00 108.00)
(contentsOpaque 1)
(drawsContent 1)
(transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [10.00 1.00 1.00 1.00])
)
)
)
)
)