[CG] Have Canvas use the IOSurfacePool
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Mar 2015 01:24:14 +0000 (01:24 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Mar 2015 01:24:14 +0000 (01:24 +0000)
commit779447637dd8a5bb2d006edac72db9c3cfb3f7d9
treed5cb2c541e964d3ac6f34c055cb9cd6a2eab0951
parentb5d5adb745348699df1885c587c768f317cdb2c5
[CG] Have Canvas use the IOSurfacePool
https://bugs.webkit.org/show_bug.cgi?id=142417
<rdar://problem/20044440>

Reviewed by Darin Adler.

PerformanceTests:

Lower the number of different canvas sizes from 1000 to 100 so that
the test does not require such a huge cache size. With 100, we now
get over 90% cache hit rate with the default IOSurfacePool size.

* Canvas/reuse.html:

Source/WebCore:

Have ImageBufferDataCG use the IOSurfacePool so that Canvas can
benefit from it. I see a ~75% progression on Canvas/reuse.html
performance test on my Macbook Pro with 1000 different canvas
sizes and ~110% progression with 100 different canvas sizes.

I also see a ~65% cache hit rate on the mobile version of
cnn.com.

Note that ImageData calls CGContextClearRect() after calling
IOSurface::create() so recycling IOSurfaces in this case should
be safe.

Performance test: Canvas/reuse.html

* platform/graphics/ImageBuffer.h:
(WebCore::ImageBuffer::baseTransform):
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::ImageBuffer):
(WebCore::ImageBuffer::context):
(WebCore::ImageBuffer::copyImage):
(WebCore::ImageBuffer::copyNativeImage):
(WebCore::ImageBuffer::draw):
(WebCore::ImageBuffer::clip):
(WebCore::ImageBuffer::putByteArray):
(WebCore::ImageBuffer::toDataURL):
* platform/graphics/cg/ImageBufferDataCG.cpp:
(WebCore::ImageBufferData::~ImageBufferData):
(WebCore::ImageBufferData::getData):
(WebCore::ImageBufferData::putData):
(WebCore::ImageBufferData::ImageBufferData): Deleted.
* platform/graphics/cg/ImageBufferDataCG.h:
* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/cocoa/IOSurface.mm:
(IOSurface::surfaceFromPool):
(IOSurface::create):
(IOSurface::createFromSendRight):
(IOSurface::createFromImage):
(IOSurface::setContextSize):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181301 268f45cc-cd09-0410-ab3c-d52691b4dbfc
PerformanceTests/Canvas/reuse.html
PerformanceTests/ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ImageBuffer.h
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp
Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h
Source/WebCore/platform/graphics/cocoa/IOSurface.h
Source/WebCore/platform/graphics/cocoa/IOSurface.mm