[chromium] Respect memory needed for RenderSurfaces when reserving contents textures
authordanakj@chromium.org <danakj@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Jul 2012 20:50:54 +0000 (20:50 +0000)
committerdanakj@chromium.org <danakj@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Jul 2012 20:50:54 +0000 (20:50 +0000)
commit4e7b0556d2a1ef5f09aa4081a6fe316e3f81ff86
tree2b22b7ab5c04891cda1aeae660725da289959b96
parent3339b1cd84a1afd25088d658c38f85e043f4686f
[chromium] Respect memory needed for RenderSurfaces when reserving contents textures
https://bugs.webkit.org/show_bug.cgi?id=89901

Reviewed by Adrienne Walker.

Source/WebCore:

Treat the memory allocation given to a tab as an allocation for its
contents and surfaces. Then only use up contents memory such that
the surface textures will still fit within the limit. Report histograms
for the amount of contents and surface texture memory used by each
frame generated by the main thread.

In the context of ubercomp, each nested compositor will use less memory
for contents ensuring that the root compositor has space for surfaces
caused by that nested compositor.

Since surface memory can no longer be taken by contents, we remove the
preferred memory limit from the texture manager.

Tests: TiledLayerChromiumTest.dontAllocateContentsWhenTargetSurfaceCantBeAllocated
       CCPrioritizedTextureTest.renderSurfacesReduceMemoryAvailableOutsideRootSurface
       CCPrioritizedTextureTest.renderSurfacesReduceMemoryAvailableForRequestLate
       CCPrioritizedTextureTest.whenRenderSurfaceNotAvailableTexturesAlsoNotAvailable

* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::drawBackgroundFilters):
* platform/graphics/chromium/ScrollbarLayerChromium.cpp:
(WebCore::ScrollbarLayerChromium::setTexturePriorities):
* platform/graphics/chromium/TiledLayerChromium.cpp:
(WebCore::TiledLayerChromium::setTexturePrioritiesInRect):
* platform/graphics/chromium/TiledLayerChromium.h:
(TiledLayerChromium):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::initializeLayerRenderer):
(WebCore::CCLayerTreeHost::updateLayers):
(WebCore::CCLayerTreeHost::prioritizeTextures):
(WebCore::CCLayerTreeHost::paintLayerContents):
* platform/graphics/chromium/cc/CCOverdrawMetrics.cpp:
(WebCore::CCOverdrawMetrics::CCOverdrawMetrics):
(WebCore::CCOverdrawMetrics::didUseContentsTextureMemoryBytes):
(WebCore):
(WebCore::CCOverdrawMetrics::didUseRenderSurfaceTextureMemoryBytes):
(WebCore::CCOverdrawMetrics::recordMetricsInternal):
* platform/graphics/chromium/cc/CCOverdrawMetrics.h:
(CCOverdrawMetrics):
* platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp:
(WebCore::CCPrioritizedTextureManager::CCPrioritizedTextureManager):
(WebCore::CCPrioritizedTextureManager::prioritizeTextures):
(WebCore::CCPrioritizedTextureManager::requestLate):
(WebCore::CCPrioritizedTextureManager::acquireBackingTextureIfNeeded):
(WebCore::CCPrioritizedTextureManager::reduceMemory):
* platform/graphics/chromium/cc/CCPrioritizedTextureManager.h:
(WebCore::CCPrioritizedTextureManager::create):
(WebCore::CCPrioritizedTextureManager::memoryForRenderSurfacesBytes):
(CCPrioritizedTextureManager):
* platform/graphics/chromium/cc/CCPriorityCalculator.cpp:
(WebCore::CCPriorityCalculator::uiPriority):
(WebCore::CCPriorityCalculator::visiblePriority):
(WebCore):
(WebCore::CCPriorityCalculator::renderSurfacePriority):
(WebCore::CCPriorityCalculator::priorityFromDistance):
(WebCore::CCPriorityCalculator::priorityFromVisibility):
* platform/graphics/chromium/cc/CCPriorityCalculator.h:
(CCPriorityCalculator):

Source/WebKit/chromium:

* tests/CCPrioritizedTextureTest.cpp:
(WTF::CCPrioritizedTextureTest::createManager):
(WTF::TEST_F):
(WTF):
* tests/CCTiledLayerTestCommon.cpp:
(WebKitTests::FakeTiledLayerChromium::setTexturePriorities):
(WebKitTests):
* tests/CCTiledLayerTestCommon.h:
(FakeTiledLayerChromium):
* tests/TiledLayerChromiumTest.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@121870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
Source/WebCore/platform/graphics/chromium/cc/CCOverdrawMetrics.cpp
Source/WebCore/platform/graphics/chromium/cc/CCOverdrawMetrics.h
Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp
Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h
Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.cpp
Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp
Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp
Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h
Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp