diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-10 19:19:32 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-10 19:19:32 +0000 |
commit | 188d11b3bc1156441d2b71fb3db295a5f119b067 (patch) | |
tree | 7e33d78805f5207dbafa0c1ee020a725aeb512b4 | |
parent | 7a4f405ceecdb788fa22fd8bea1c5738c32d278d (diff) | |
download | chromium_src-188d11b3bc1156441d2b71fb3db295a5f119b067.zip chromium_src-188d11b3bc1156441d2b71fb3db295a5f119b067.tar.gz chromium_src-188d11b3bc1156441d2b71fb3db295a5f119b067.tar.bz2 |
cc: Do not limit number of raster tasks for upload limit.
BUG=368936
Review URL: https://codereview.chromium.org/270333003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269617 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/resources/tile_manager.cc | 21 | ||||
-rw-r--r-- | cc/resources/tile_manager.h | 3 | ||||
-rw-r--r-- | cc/resources/tile_manager_perftest.cc | 5 | ||||
-rw-r--r-- | cc/test/fake_tile_manager.cc | 15 | ||||
-rw-r--r-- | cc/test/fake_tile_manager.h | 3 | ||||
-rw-r--r-- | cc/test/test_web_graphics_context_3d.cc | 9 | ||||
-rw-r--r-- | cc/test/test_web_graphics_context_3d.h | 5 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 9 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest.cc | 6 |
9 files changed, 7 insertions, 69 deletions
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc index 4128650..1c04d07 100644 --- a/cc/resources/tile_manager.cc +++ b/cc/resources/tile_manager.cc @@ -369,14 +369,12 @@ scoped_ptr<TileManager> TileManager::Create( ResourcePool* resource_pool, Rasterizer* rasterizer, Rasterizer* gpu_rasterizer, - size_t max_raster_usage_bytes, bool use_rasterize_on_demand, RenderingStatsInstrumentation* rendering_stats_instrumentation) { return make_scoped_ptr(new TileManager(client, resource_pool, rasterizer, gpu_rasterizer, - max_raster_usage_bytes, use_rasterize_on_demand, rendering_stats_instrumentation)); } @@ -386,7 +384,6 @@ TileManager::TileManager( ResourcePool* resource_pool, Rasterizer* rasterizer, Rasterizer* gpu_rasterizer, - size_t max_raster_usage_bytes, bool use_rasterize_on_demand, RenderingStatsInstrumentation* rendering_stats_instrumentation) : client_(client), @@ -398,7 +395,6 @@ TileManager::TileManager( memory_nice_to_have_bytes_(0), bytes_releasable_(0), resources_releasable_(0), - max_raster_usage_bytes_(max_raster_usage_bytes), ever_exceeded_memory_budget_(false), rendering_stats_instrumentation_(rendering_stats_instrumentation), did_initialize_visible_tile_(false), @@ -829,14 +825,6 @@ void TileManager::AssignGpuMemoryToTiles( bool oomed_hard = false; bool have_hit_soft_memory = false; // Soft memory comes after hard. - // Memory we assign to raster tasks now will be deducted from our memory - // in future iterations if priorities change. By assigning at most half - // the raster limit, we will always have another 50% left even if priorities - // change completely (assuming we check for completed/cancelled rasters - // between each call to this function). - size_t max_raster_bytes = max_raster_usage_bytes_ / 2; - size_t raster_bytes = 0; - unsigned schedule_priority = 1u; for (PrioritizedTileSet::Iterator it(tiles, true); it; ++it) { Tile* tile = *it; @@ -861,7 +849,6 @@ void TileManager::AssignGpuMemoryToTiles( const bool tile_uses_hard_limit = mts.bin <= NOW_BIN; const size_t bytes_if_allocated = BytesConsumedIfAllocated(tile); - const size_t raster_bytes_if_rastered = raster_bytes + bytes_if_allocated; const size_t tile_bytes_left = (tile_uses_hard_limit) ? hard_bytes_left : soft_bytes_left; @@ -885,7 +872,9 @@ void TileManager::AssignGpuMemoryToTiles( // Allow lower priority tiles with initialized resources to keep // their memory by only assigning memory to new raster tasks if // they can be scheduled. - if (raster_bytes_if_rastered <= max_raster_bytes) { + bool reached_scheduled_raster_tasks_limit = + tiles_that_need_to_be_rasterized->size() >= kScheduledRasterTasksLimit; + if (!reached_scheduled_raster_tasks_limit) { // If we don't have the required version, and it's not in flight // then we'll have to pay to create a new task. if (!tile_version.resource_ && !tile_version.raster_task_) { @@ -929,8 +918,7 @@ void TileManager::AssignGpuMemoryToTiles( // 2. Tiles with existing raster task could otherwise incorrectly // be added as they are not affected by |bytes_allocatable|. bool can_schedule_tile = - !oomed_soft && raster_bytes_if_rastered <= max_raster_bytes && - tiles_that_need_to_be_rasterized->size() < kScheduledRasterTasksLimit; + !oomed_soft && !reached_scheduled_raster_tasks_limit; if (!can_schedule_tile) { all_tiles_that_need_to_be_rasterized_have_memory_ = false; @@ -940,7 +928,6 @@ void TileManager::AssignGpuMemoryToTiles( continue; } - raster_bytes = raster_bytes_if_rastered; tiles_that_need_to_be_rasterized->push_back(tile); } diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h index f48fef6..beca880 100644 --- a/cc/resources/tile_manager.h +++ b/cc/resources/tile_manager.h @@ -158,7 +158,6 @@ class CC_EXPORT TileManager : public RasterizerClient, ResourcePool* resource_pool, Rasterizer* rasterizer, Rasterizer* gpu_rasterizer, - size_t max_raster_usage_bytes, bool use_rasterize_on_demand, RenderingStatsInstrumentation* rendering_stats_instrumentation); virtual ~TileManager(); @@ -230,7 +229,6 @@ class CC_EXPORT TileManager : public RasterizerClient, ResourcePool* resource_pool, Rasterizer* rasterizer, Rasterizer* gpu_rasterizer, - size_t max_raster_usage_bytes, bool use_rasterize_on_demand, RenderingStatsInstrumentation* rendering_stats_instrumentation); @@ -308,7 +306,6 @@ class CC_EXPORT TileManager : public RasterizerClient, size_t bytes_releasable_; size_t resources_releasable_; - size_t max_raster_usage_bytes_; bool ever_exceeded_memory_budget_; MemoryHistory::Entry memory_stats_from_last_assign_; diff --git a/cc/resources/tile_manager_perftest.cc b/cc/resources/tile_manager_perftest.cc index d16eba82..cc2bc9c 100644 --- a/cc/resources/tile_manager_perftest.cc +++ b/cc/resources/tile_manager_perftest.cc @@ -51,9 +51,8 @@ class TileManagerPerfTest : public testing::Test { false); resource_pool_ = ResourcePool::Create( resource_provider_.get(), GL_TEXTURE_2D, RGBA_8888); - size_t raster_task_limit_bytes = 32 * 1024 * 1024; // 16-64MB in practice. - tile_manager_ = make_scoped_ptr(new FakeTileManager( - &tile_manager_client_, resource_pool_.get(), raster_task_limit_bytes)); + tile_manager_ = make_scoped_ptr( + new FakeTileManager(&tile_manager_client_, resource_pool_.get())); picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); } diff --git a/cc/test/fake_tile_manager.cc b/cc/test/fake_tile_manager.cc index 3b86035..d197c3f 100644 --- a/cc/test/fake_tile_manager.cc +++ b/cc/test/fake_tile_manager.cc @@ -5,7 +5,6 @@ #include "cc/test/fake_tile_manager.h" #include <deque> -#include <limits> #include "base/lazy_instance.h" #include "cc/resources/rasterizer.h" @@ -67,7 +66,6 @@ FakeTileManager::FakeTileManager(TileManagerClient* client) NULL, g_fake_rasterizer.Pointer(), g_fake_rasterizer.Pointer(), - std::numeric_limits<unsigned>::max(), true, NULL) {} @@ -77,7 +75,6 @@ FakeTileManager::FakeTileManager(TileManagerClient* client, resource_pool, g_fake_rasterizer.Pointer(), g_fake_rasterizer.Pointer(), - std::numeric_limits<unsigned>::max(), true, NULL) {} @@ -88,21 +85,9 @@ FakeTileManager::FakeTileManager(TileManagerClient* client, resource_pool, g_fake_rasterizer.Pointer(), g_fake_rasterizer.Pointer(), - std::numeric_limits<unsigned>::max(), allow_on_demand_raster, NULL) {} -FakeTileManager::FakeTileManager(TileManagerClient* client, - ResourcePool* resource_pool, - size_t raster_task_limit_bytes) - : TileManager(client, - resource_pool, - g_fake_rasterizer.Pointer(), - g_fake_rasterizer.Pointer(), - raster_task_limit_bytes, - true, - NULL) {} - FakeTileManager::~FakeTileManager() {} void FakeTileManager::AssignMemoryToTiles( diff --git a/cc/test/fake_tile_manager.h b/cc/test/fake_tile_manager.h index 162aebe..c5c7a25 100644 --- a/cc/test/fake_tile_manager.h +++ b/cc/test/fake_tile_manager.h @@ -19,9 +19,6 @@ class FakeTileManager : public TileManager { FakeTileManager(TileManagerClient* client, ResourcePool* resource_pool, bool allow_on_demand_raster); - FakeTileManager(TileManagerClient* client, - ResourcePool* resource_pool, - size_t raster_task_limit_bytes); virtual ~FakeTileManager(); bool HasBeenAssignedMemory(Tile* tile); diff --git a/cc/test/test_web_graphics_context_3d.cc b/cc/test/test_web_graphics_context_3d.cc index 7d03c38..613c5d0 100644 --- a/cc/test/test_web_graphics_context_3d.cc +++ b/cc/test/test_web_graphics_context_3d.cc @@ -67,7 +67,6 @@ TestWebGraphicsContext3D::TestWebGraphicsContext3D() next_insert_sync_point_(1), last_waited_sync_point_(0), bound_buffer_(0), - peak_transfer_buffer_memory_used_bytes_(0), weak_ptr_factory_(this) { CreateNamespace(); } @@ -503,10 +502,6 @@ void TestWebGraphicsContext3D::bufferData(GLenum target, buffer->size = size; if (data != NULL) memcpy(buffer->pixels.get(), data, size); - - peak_transfer_buffer_memory_used_bytes_ = - std::max(peak_transfer_buffer_memory_used_bytes_, - GetTransferBufferMemoryUsedBytes()); } void* TestWebGraphicsContext3D::mapBufferCHROMIUM(GLenum target, @@ -522,10 +517,6 @@ void* TestWebGraphicsContext3D::mapBufferCHROMIUM(GLenum target, --times_map_buffer_chromium_succeeds_; } - peak_transfer_buffer_memory_used_bytes_ = - std::max(peak_transfer_buffer_memory_used_bytes_, - GetTransferBufferMemoryUsedBytes()); - return buffers.get(bound_buffer_)->pixels.get(); } diff --git a/cc/test/test_web_graphics_context_3d.h b/cc/test/test_web_graphics_context_3d.h index ae32a27..3ce3ddd 100644 --- a/cc/test/test_web_graphics_context_3d.h +++ b/cc/test/test_web_graphics_context_3d.h @@ -325,9 +325,6 @@ class TestWebGraphicsContext3D { size_t GetTransferBufferMemoryUsedBytes() const; void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes); - size_t GetPeakTransferBufferMemoryUsedBytes() const { - return peak_transfer_buffer_memory_used_bytes_; - } void set_test_support(TestContextSupport* test_support) { test_support_ = test_support; @@ -439,8 +436,6 @@ class TestWebGraphicsContext3D { unsigned bound_buffer_; TextureTargets texture_targets_; - size_t peak_transfer_buffer_memory_used_bytes_; - scoped_refptr<Namespace> namespace_; static Namespace* shared_namespace_; diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index bf37c51..1cd0d05 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -103,14 +103,6 @@ size_t GetMaxTransferBufferUsageBytes(cc::ContextProvider* context_provider) { kMaxTransferBufferUsageBytes); } -size_t GetMaxRasterTasksUsageBytes(cc::ContextProvider* context_provider) { - // Transfer-buffer/raster-tasks limits are different but related. We make - // equal here, as this is ideal when using transfer buffers. When not using - // transfer buffers we should still limit raster to something similar, to - // preserve caching behavior (and limit memory waste when priorities change). - return GetMaxTransferBufferUsageBytes(context_provider); -} - unsigned GetMapImageTextureTarget(cc::ContextProvider* context_provider) { if (!context_provider) return GL_TEXTURE_2D; @@ -1904,7 +1896,6 @@ void LayerTreeHostImpl::CreateAndSetTileManager( resource_pool_.get(), raster_worker_pool_->AsRasterizer(), direct_raster_worker_pool_->AsRasterizer(), - GetMaxRasterTasksUsageBytes(context_provider), allow_rasterize_on_demand, rendering_stats_instrumentation_); diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 24f6e4d..ea490cd 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -4511,7 +4511,6 @@ class LayerTreeHostTestMaxTransferBufferUsageBytes : public LayerTreeHostTest { protected: virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { settings->impl_side_painting = true; - settings->default_tile_size = gfx::Size(128, 128); } virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(bool fallback) @@ -4542,10 +4541,7 @@ class LayerTreeHostTestMaxTransferBufferUsageBytes : public LayerTreeHostTest { // Expect that the transfer buffer memory used is equal to the // MaxTransferBufferUsageBytes value set in CreateOutputSurface. - // NOTE: This is now 1/2 due to raster memory limit in TileManager. - // Only half the limit will be reached unless the task set - // thrashes to a completly new set of tiles. - EXPECT_EQ(512 * 1024u, context->GetPeakTransferBufferMemoryUsedBytes()); + EXPECT_EQ(1024 * 1024u, context->GetTransferBufferMemoryUsedBytes()); EndTest(); } |