Changeset 193382 in webkit


Ignore:
Timestamp:
Dec 3, 2015, 3:44:52 PM (9 years ago)
Author:
Simon Fraser
Message:

Have layer memory use consult the backing store format
https://bugs.webkit.org/show_bug.cgi?id=151827
rdar://problem/23746497

Reviewed by Dean Jackson.
Source/WebCore:

When computing the backing store memory size, take the pixel format into account,
rather than assuming 4 bytes per pixel.

  • platform/graphics/ca/GraphicsLayerCA.cpp:
  • platform/graphics/ca/PlatformCALayer.h:

Source/WebKit2:

When computing the backing store memory size, take the pixel format into account,
rather than assuming 4 bytes per pixel.

  • Shared/mac/RemoteLayerBackingStore.h:
  • Shared/mac/RemoteLayerBackingStore.mm:

(WebKit::RemoteLayerBackingStore::bytesPerPixel):

  • WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:

(WebKit::PlatformCALayerRemote::backingStoreBytesPerPixel):

  • WebProcess/WebPage/mac/PlatformCALayerRemote.h:
Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r193378 r193382  
     12015-12-03  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Have layer memory use consult the backing store format
     4        https://bugs.webkit.org/show_bug.cgi?id=151827
     5        rdar://problem/23746497
     6
     7        Reviewed by Dean Jackson.
     8       
     9        When computing the backing store memory size, take the pixel format into account,
     10        rather than assuming 4 bytes per pixel.
     11
     12        * platform/graphics/ca/GraphicsLayerCA.cpp:
     13        * platform/graphics/ca/PlatformCALayer.h:
     14
    1152015-12-03  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r192853 r193382  
    37763776        return 0;
    37773777
    3778     return 4.0 * size().width() * m_layer->contentsScale() * size().height() * m_layer->contentsScale();
     3778    return m_layer->backingStoreBytesPerPixel() * size().width() * m_layer->contentsScale() * size().height() * m_layer->contentsScale();
    37793779}
    37803780
  • trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h

    r191243 r193382  
    231231
    232232    static void flipContext(CGContextRef, CGFloat height);
     233   
     234    virtual unsigned backingStoreBytesPerPixel() const { return 4; }
    233235
    234236#if PLATFORM(WIN)
  • trunk/Source/WebKit2/ChangeLog

    r193381 r193382  
     12015-12-03  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Have layer memory use consult the backing store format
     4        https://bugs.webkit.org/show_bug.cgi?id=151827
     5        rdar://problem/23746497
     6
     7        Reviewed by Dean Jackson.
     8
     9        When computing the backing store memory size, take the pixel format into account,
     10        rather than assuming 4 bytes per pixel.
     11
     12        * Shared/mac/RemoteLayerBackingStore.h:
     13        * Shared/mac/RemoteLayerBackingStore.mm:
     14        (WebKit::RemoteLayerBackingStore::bytesPerPixel):
     15        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
     16        (WebKit::PlatformCALayerRemote::backingStoreBytesPerPixel):
     17        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
     18
    1192015-12-03  Jer Noble  <jer.noble@apple.com>
    220
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.h

    r180799 r193382  
    6262    bool acceleratesDrawing() const { return m_acceleratesDrawing; }
    6363    bool isOpaque() const { return m_isOpaque; }
     64    unsigned bytesPerPixel() const;
    6465
    6566    PlatformCALayerRemote* layer() const { return m_layer; }
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm

    r192701 r193382  
    188188}
    189189
     190unsigned RemoteLayerBackingStore::bytesPerPixel() const
     191{
     192#if USE(IOSURFACE)
     193    WebCore::IOSurface::Format format = bufferFormat(m_isOpaque);
     194    switch (format) {
     195    case IOSurface::Format::RGBA: return 4;
     196    case IOSurface::Format::YUV422: return 2;
     197    case IOSurface::Format::RGB10: return 4;
     198    case IOSurface::Format::RGB10A8: return 5;
     199    }
     200#endif
     201    return 4;
     202}
     203
    190204void RemoteLayerBackingStore::swapToValidFrontBuffer()
    191205{
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp

    r190292 r193382  
    783783}
    784784
     785unsigned PlatformCALayerRemote::backingStoreBytesPerPixel() const
     786{
     787    if (!m_properties.backingStore)
     788        return 4;
     789
     790    return m_properties.backingStore->bytesPerPixel();
     791}
     792
    785793LayerPool& PlatformCALayerRemote::layerPool()
    786794{
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h

    r190292 r193382  
    173173    virtual uint32_t hostingContextID();
    174174
     175    virtual unsigned backingStoreBytesPerPixel() const override;
     176
    175177    void setClonedLayer(const PlatformCALayer*);
    176178
Note: See TracChangeset for help on using the changeset viewer.