[webkit-changes] [WebKit/WebKit] bf6398: Add hysteresis to RenderLayerCompositor's composit...
Ryan Reno
noreply at github.com
Wed Aug 9 13:30:49 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: bf6398b824c5bc0f5a274231301914d5d8524c99
https://github.com/WebKit/WebKit/commit/bf6398b824c5bc0f5a274231301914d5d8524c99
Author: Ryan Reno <rreno at apple.com>
Date: 2023-08-09 (Wed, 09 Aug 2023)
Changed paths:
A LayoutTests/compositing/layer-creation/compositing-policy-hysteresis-expected.txt
A LayoutTests/compositing/layer-creation/compositing-policy-hysteresis.html
A LayoutTests/platform/mac/compositing/layer-creation/compositing-policy-hysteresis-expected.txt
M Source/WebCore/rendering/RenderLayerCompositor.cpp
M Source/WebCore/rendering/RenderLayerCompositor.h
Log Message:
-----------
Add hysteresis to RenderLayerCompositor's compositing policy.
https://bugs.webkit.org/show_bug.cgi?id=259865
rdar://113342477
Reviewed by Simon Fraser.
RenderLayerCompositor::updateCompositingPolicy will change compositing policy when memory
pressure status has changed (266497 at main). It is possible that we could bounce between
Conservative and Normal policies multiple times per second. Consider
this example:
1) We enter a memory warning and so move to Conservative, deallocating
layer backing memory.
2) This deallocation brings us just below the threshold for memory
warning.
3) We see this status change and return to Normal, creating new layers
and reallocating layer backing memory.
4) This reallocation brings us back into memory warning (goto 1).
To avoid this situation this patch adds a HysteresisActivity to the
RenderLayerCompositor. Whenever we change to Conservative compositing
mode we impulse the activity and will not change compositing policy
until after the activity has stopped. Currently that means we wait 2s
after switching to a Conservative policy before allowing ourselves to switch back
to a Normal policy. We don't block ourselves from switching from Normal
to Conservative though since that can cause us to respond to system
memory pressure too slowly.
* LayoutTests/compositing/layer-creation/compositing-policy-hysteresis-expected.txt: Added.
* LayoutTests/compositing/layer-creation/compositing-policy-hysteresis.html: Added.
* LayoutTests/platform/mac/compositing/layer-creation/compositing-policy-hysteresis-expected.txt: Added.
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::RenderLayerCompositor):
(WebCore::RenderLayerCompositor::updateCompositingPolicy):
(WebCore::RenderLayerCompositor::canUpdateCompositingPolicy const):
* Source/WebCore/rendering/RenderLayerCompositor.h:
Canonical link: https://commits.webkit.org/266738@main
More information about the webkit-changes
mailing list