- Revision
- 193382
- Author
- simon.fra...@apple.com
- Date
- 2015-12-03 15:44:52 -0800 (Thu, 03 Dec 2015)
Log 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:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (193381 => 193382)
--- trunk/Source/WebCore/ChangeLog 2015-12-03 23:39:38 UTC (rev 193381)
+++ trunk/Source/WebCore/ChangeLog 2015-12-03 23:44:52 UTC (rev 193382)
@@ -1,3 +1,17 @@
+2015-12-03 Simon Fraser <simon.fra...@apple.com>
+
+ 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.
+
+ 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:
+
2015-12-03 Anders Carlsson <ander...@apple.com>
Remove Objective-C GC support
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (193381 => 193382)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2015-12-03 23:39:38 UTC (rev 193381)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2015-12-03 23:44:52 UTC (rev 193382)
@@ -3775,7 +3775,7 @@
if (!m_layer->backingContributesToMemoryEstimate())
return 0;
- return 4.0 * size().width() * m_layer->contentsScale() * size().height() * m_layer->contentsScale();
+ return m_layer->backingStoreBytesPerPixel() * size().width() * m_layer->contentsScale() * size().height() * m_layer->contentsScale();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (193381 => 193382)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2015-12-03 23:39:38 UTC (rev 193381)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2015-12-03 23:44:52 UTC (rev 193382)
@@ -230,6 +230,8 @@
virtual void drawTextAtPoint(CGContextRef, CGFloat x, CGFloat y, CGSize scale, CGFloat fontSize, const char* text, size_t length) const;
static void flipContext(CGContextRef, CGFloat height);
+
+ virtual unsigned backingStoreBytesPerPixel() const { return 4; }
#if PLATFORM(WIN)
virtual PlatformCALayer* rootLayer() const = 0;
Modified: trunk/Source/WebKit2/ChangeLog (193381 => 193382)
--- trunk/Source/WebKit2/ChangeLog 2015-12-03 23:39:38 UTC (rev 193381)
+++ trunk/Source/WebKit2/ChangeLog 2015-12-03 23:44:52 UTC (rev 193382)
@@ -1,3 +1,21 @@
+2015-12-03 Simon Fraser <simon.fra...@apple.com>
+
+ 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.
+
+ 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:
+
2015-12-03 Jer Noble <jer.no...@apple.com>
Expose WebCore's InvisibleAutoplayNotPermitted setting to WebKit & WebKit2
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.h (193381 => 193382)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.h 2015-12-03 23:39:38 UTC (rev 193381)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.h 2015-12-03 23:44:52 UTC (rev 193382)
@@ -61,6 +61,7 @@
float scale() const { return m_scale; }
bool acceleratesDrawing() const { return m_acceleratesDrawing; }
bool isOpaque() const { return m_isOpaque; }
+ unsigned bytesPerPixel() const;
PlatformCALayerRemote* layer() const { return m_layer; }
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (193381 => 193382)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm 2015-12-03 23:39:38 UTC (rev 193381)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm 2015-12-03 23:44:52 UTC (rev 193382)
@@ -187,6 +187,20 @@
return roundedIntSize(scaledSize);
}
+unsigned RemoteLayerBackingStore::bytesPerPixel() const
+{
+#if USE(IOSURFACE)
+ WebCore::IOSurface::Format format = bufferFormat(m_isOpaque);
+ switch (format) {
+ case IOSurface::Format::RGBA: return 4;
+ case IOSurface::Format::YUV422: return 2;
+ case IOSurface::Format::RGB10: return 4;
+ case IOSurface::Format::RGB10A8: return 5;
+ }
+#endif
+ return 4;
+}
+
void RemoteLayerBackingStore::swapToValidFrontBuffer()
{
IntSize expandedScaledSize = backingStoreSize();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (193381 => 193382)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2015-12-03 23:39:38 UTC (rev 193381)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2015-12-03 23:44:52 UTC (rev 193382)
@@ -782,6 +782,14 @@
return 0;
}
+unsigned PlatformCALayerRemote::backingStoreBytesPerPixel() const
+{
+ if (!m_properties.backingStore)
+ return 4;
+
+ return m_properties.backingStore->bytesPerPixel();
+}
+
LayerPool& PlatformCALayerRemote::layerPool()
{
return m_context->layerPool();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (193381 => 193382)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h 2015-12-03 23:39:38 UTC (rev 193381)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h 2015-12-03 23:44:52 UTC (rev 193382)
@@ -172,6 +172,8 @@
virtual uint32_t hostingContextID();
+ virtual unsigned backingStoreBytesPerPixel() const override;
+
void setClonedLayer(const PlatformCALayer*);
RemoteLayerTreeTransaction::LayerProperties& properties() { return m_properties; }