Changeset 251837 in webkit


Ignore:
Timestamp:
Oct 31, 2019 2:31:14 AM (4 years ago)
Author:
magomez@igalia.com
Message:

[CoordGraphics] Avoid painting backing stores for zero-opacity layers
https://bugs.webkit.org/show_bug.cgi?id=184143

Reviewed by Žan Doberšek.

Source/WebCore:

Skip generating backing stores for layers that have zero opacity and do
not animate the opacity value. In the current CoordinatedGraphics system
this can end up saving loads of memory on Web content that deploys a
large number of such elements.

Based on a previous patch from Žan Doberšek.

  • platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:

(WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore const):

Source/WebKit:

Do not check whether a backingStore is required by a layer inside CoordinatedGraphicsScene. This
decision is made by the appropriate CoordinatedGraphicsLayer and propagated to the scene by
sending a valid or null Nicosia::BackingStore instance through the state.

  • Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:

(WebKit::updateBackingStore):
(WebKit::layerShouldHaveBackingStore): Deleted.

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r251836 r251837  
     12019-10-31  Miguel Gomez  <magomez@igalia.com>
     2
     3        [CoordGraphics] Avoid painting backing stores for zero-opacity layers
     4        https://bugs.webkit.org/show_bug.cgi?id=184143
     5
     6        Reviewed by Žan Doberšek.
     7
     8        Skip generating backing stores for layers that have zero opacity and do
     9        not animate the opacity value. In the current CoordinatedGraphics system
     10        this can end up saving loads of memory on Web content that deploys a
     11        large number of such elements.
     12
     13        Based on a previous patch from Žan Doberšek.
     14
     15        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
     16        (WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore const):
     17
    1182019-10-29  Carlos Garcia Campos  <cgarcia@igalia.com>
    219
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp

    r250554 r251837  
    12401240bool CoordinatedGraphicsLayer::shouldHaveBackingStore() const
    12411241{
    1242     return drawsContent() && contentsAreVisible() && !m_size.isEmpty();
     1242    return drawsContent() && contentsAreVisible() && !m_size.isEmpty()
     1243        && (!!opacity() || m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity));
    12431244}
    12441245
  • trunk/Source/WebKit/ChangeLog

    r251834 r251837  
     12019-10-31  Miguel Gomez  <magomez@igalia.com>
     2
     3        [CoordGraphics] Avoid painting backing stores for zero-opacity layers
     4        https://bugs.webkit.org/show_bug.cgi?id=184143
     5
     6        Reviewed by Žan Doberšek.
     7
     8        Do not check whether a backingStore is required by a layer inside CoordinatedGraphicsScene. This
     9        decision is made by the appropriate CoordinatedGraphicsLayer and propagated to the scene by
     10        sending a valid or null Nicosia::BackingStore instance through the state.
     11
     12        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
     13        (WebKit::updateBackingStore):
     14        (WebKit::layerShouldHaveBackingStore): Deleted.
     15
    1162019-10-30  Peng Liu  <peng.liu6@apple.com>
    217
  • trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp

    r250418 r251837  
    4141using namespace WebCore;
    4242
    43 static bool layerShouldHaveBackingStore(TextureMapperLayer* layer)
    44 {
    45     return layer->drawsContent() && layer->contentsAreVisible() && !layer->size().isEmpty();
    46 }
    47 
    4843CoordinatedGraphicsScene::CoordinatedGraphicsScene(CoordinatedGraphicsSceneClient* client)
    4944    : m_client(client)
     
    136131    const Nicosia::BackingStoreTextureMapperImpl::TileUpdate& update)
    137132{
    138     if (!layerShouldHaveBackingStore(&layer)) {
    139         layer.setBackingStore(nullptr);
    140         compositionState.backingStore = nullptr;
    141         return;
    142     }
    143 
    144133    if (!compositionState.backingStore)
    145134        compositionState.backingStore = CoordinatedBackingStore::create();
Note: See TracChangeset for help on using the changeset viewer.