Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Side by Side Diff: cc/resources/picture_layer_tiling_perftest.cc

Issue 547723002: Reland of: cc: Add occlusion checker as a fixed view of occlusion tracker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/picture_layer_tiling.cc ('k') | cc/resources/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/debug/lap_timer.h" 5 #include "cc/debug/lap_timer.h"
6 #include "cc/resources/picture_layer_tiling.h" 6 #include "cc/resources/picture_layer_tiling.h"
7 #include "cc/resources/resource_provider.h" 7 #include "cc/resources/resource_provider.h"
8 #include "cc/resources/scoped_resource.h" 8 #include "cc/resources/scoped_resource.h"
9 #include "cc/test/fake_output_surface.h" 9 #include "cc/test/fake_output_surface.h"
10 #include "cc/test/fake_output_surface_client.h" 10 #include "cc/test/fake_output_surface_client.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 perf_test::PrintResult( 67 perf_test::PrintResult(
68 "invalidation", "", test_name, timer_.LapsPerSecond(), "runs/s", true); 68 "invalidation", "", test_name, timer_.LapsPerSecond(), "runs/s", true);
69 } 69 }
70 70
71 void RunUpdateTilePrioritiesStationaryTest(const std::string& test_name, 71 void RunUpdateTilePrioritiesStationaryTest(const std::string& test_name,
72 const gfx::Transform& transform) { 72 const gfx::Transform& transform) {
73 gfx::Rect viewport_rect(0, 0, 1024, 768); 73 gfx::Rect viewport_rect(0, 0, 1024, 768);
74 74
75 timer_.Reset(); 75 timer_.Reset();
76 do { 76 do {
77 picture_layer_tiling_->UpdateTilePriorities(PENDING_TREE, 77 picture_layer_tiling_->UpdateTilePriorities(
78 viewport_rect, 78 PENDING_TREE, viewport_rect, 1.f, timer_.NumLaps() + 1, Occlusion());
79 1.f,
80 timer_.NumLaps() + 1,
81 NULL,
82 NULL,
83 gfx::Transform());
84 timer_.NextLap(); 79 timer_.NextLap();
85 } while (!timer_.HasTimeLimitExpired()); 80 } while (!timer_.HasTimeLimitExpired());
86 81
87 perf_test::PrintResult("update_tile_priorities_stationary", 82 perf_test::PrintResult("update_tile_priorities_stationary",
88 "", 83 "",
89 test_name, 84 test_name,
90 timer_.LapsPerSecond(), 85 timer_.LapsPerSecond(),
91 "runs/s", 86 "runs/s",
92 true); 87 true);
93 } 88 }
94 89
95 void RunUpdateTilePrioritiesScrollingTest(const std::string& test_name, 90 void RunUpdateTilePrioritiesScrollingTest(const std::string& test_name,
96 const gfx::Transform& transform) { 91 const gfx::Transform& transform) {
97 gfx::Size viewport_size(1024, 768); 92 gfx::Size viewport_size(1024, 768);
98 gfx::Rect viewport_rect(viewport_size); 93 gfx::Rect viewport_rect(viewport_size);
99 int xoffsets[] = {10, 0, -10, 0}; 94 int xoffsets[] = {10, 0, -10, 0};
100 int yoffsets[] = {0, 10, 0, -10}; 95 int yoffsets[] = {0, 10, 0, -10};
101 int offsetIndex = 0; 96 int offsetIndex = 0;
102 int offsetCount = 0; 97 int offsetCount = 0;
103 const int maxOffsetCount = 1000; 98 const int maxOffsetCount = 1000;
104 99
105 timer_.Reset(); 100 timer_.Reset();
106 do { 101 do {
107 picture_layer_tiling_->UpdateTilePriorities(PENDING_TREE, 102 picture_layer_tiling_->UpdateTilePriorities(
108 viewport_rect, 103 PENDING_TREE, viewport_rect, 1.f, timer_.NumLaps() + 1, Occlusion());
109 1.f,
110 timer_.NumLaps() + 1,
111 NULL,
112 NULL,
113 gfx::Transform());
114 104
115 viewport_rect = gfx::Rect(viewport_rect.x() + xoffsets[offsetIndex], 105 viewport_rect = gfx::Rect(viewport_rect.x() + xoffsets[offsetIndex],
116 viewport_rect.y() + yoffsets[offsetIndex], 106 viewport_rect.y() + yoffsets[offsetIndex],
117 viewport_rect.width(), 107 viewport_rect.width(),
118 viewport_rect.height()); 108 viewport_rect.height());
119 109
120 if (++offsetCount > maxOffsetCount) { 110 if (++offsetCount > maxOffsetCount) {
121 offsetCount = 0; 111 offsetCount = 0;
122 offsetIndex = (offsetIndex + 1) % 4; 112 offsetIndex = (offsetIndex + 1) % 4;
123 } 113 }
124 timer_.NextLap(); 114 timer_.NextLap();
125 } while (!timer_.HasTimeLimitExpired()); 115 } while (!timer_.HasTimeLimitExpired());
126 116
127 perf_test::PrintResult("update_tile_priorities_scrolling", 117 perf_test::PrintResult("update_tile_priorities_scrolling",
128 "", 118 "",
129 test_name, 119 test_name,
130 timer_.LapsPerSecond(), 120 timer_.LapsPerSecond(),
131 "runs/s", 121 "runs/s",
132 true); 122 true);
133 } 123 }
134 124
135 void RunRasterIteratorConstructTest(const std::string& test_name, 125 void RunRasterIteratorConstructTest(const std::string& test_name,
136 const gfx::Rect& viewport) { 126 const gfx::Rect& viewport) {
137 gfx::Size bounds(viewport.size()); 127 gfx::Size bounds(viewport.size());
138 picture_layer_tiling_ = 128 picture_layer_tiling_ =
139 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); 129 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_);
140 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); 130 picture_layer_tiling_client_.set_tree(ACTIVE_TREE);
141 picture_layer_tiling_->UpdateTilePriorities( 131 picture_layer_tiling_->UpdateTilePriorities(
142 ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform()); 132 ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion());
143 133
144 timer_.Reset(); 134 timer_.Reset();
145 do { 135 do {
146 PictureLayerTiling::TilingRasterTileIterator it( 136 PictureLayerTiling::TilingRasterTileIterator it(
147 picture_layer_tiling_.get(), ACTIVE_TREE); 137 picture_layer_tiling_.get(), ACTIVE_TREE);
148 timer_.NextLap(); 138 timer_.NextLap();
149 } while (!timer_.HasTimeLimitExpired()); 139 } while (!timer_.HasTimeLimitExpired());
150 140
151 perf_test::PrintResult("tiling_raster_tile_iterator_construct", 141 perf_test::PrintResult("tiling_raster_tile_iterator_construct",
152 "", 142 "",
153 test_name, 143 test_name,
154 timer_.LapsPerSecond(), 144 timer_.LapsPerSecond(),
155 "runs/s", 145 "runs/s",
156 true); 146 true);
157 } 147 }
158 148
159 void RunRasterIteratorConstructAndIterateTest(const std::string& test_name, 149 void RunRasterIteratorConstructAndIterateTest(const std::string& test_name,
160 int num_tiles, 150 int num_tiles,
161 const gfx::Rect& viewport) { 151 const gfx::Rect& viewport) {
162 gfx::Size bounds(10000, 10000); 152 gfx::Size bounds(10000, 10000);
163 picture_layer_tiling_ = 153 picture_layer_tiling_ =
164 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); 154 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_);
165 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); 155 picture_layer_tiling_client_.set_tree(ACTIVE_TREE);
166 picture_layer_tiling_->UpdateTilePriorities( 156 picture_layer_tiling_->UpdateTilePriorities(
167 ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform()); 157 ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion());
168 158
169 timer_.Reset(); 159 timer_.Reset();
170 do { 160 do {
171 int count = num_tiles; 161 int count = num_tiles;
172 PictureLayerTiling::TilingRasterTileIterator it( 162 PictureLayerTiling::TilingRasterTileIterator it(
173 picture_layer_tiling_.get(), ACTIVE_TREE); 163 picture_layer_tiling_.get(), ACTIVE_TREE);
174 while (count--) { 164 while (count--) {
175 ASSERT_TRUE(it) << "count: " << count; 165 ASSERT_TRUE(it) << "count: " << count;
176 ASSERT_TRUE(*it != NULL) << "count: " << count; 166 ASSERT_TRUE(*it != NULL) << "count: " << count;
177 ++it; 167 ++it;
178 } 168 }
179 timer_.NextLap(); 169 timer_.NextLap();
180 } while (!timer_.HasTimeLimitExpired()); 170 } while (!timer_.HasTimeLimitExpired());
181 171
182 perf_test::PrintResult("tiling_raster_tile_iterator_construct_and_iterate", 172 perf_test::PrintResult("tiling_raster_tile_iterator_construct_and_iterate",
183 "", 173 "",
184 test_name, 174 test_name,
185 timer_.LapsPerSecond(), 175 timer_.LapsPerSecond(),
186 "runs/s", 176 "runs/s",
187 true); 177 true);
188 } 178 }
189 179
190 void RunEvictionIteratorConstructTest(const std::string& test_name, 180 void RunEvictionIteratorConstructTest(const std::string& test_name,
191 const gfx::Rect& viewport) { 181 const gfx::Rect& viewport) {
192 gfx::Size bounds(viewport.size()); 182 gfx::Size bounds(viewport.size());
193 picture_layer_tiling_ = 183 picture_layer_tiling_ =
194 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); 184 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_);
195 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); 185 picture_layer_tiling_client_.set_tree(ACTIVE_TREE);
196 picture_layer_tiling_->UpdateTilePriorities( 186 picture_layer_tiling_->UpdateTilePriorities(
197 ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform()); 187 ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion());
198 188
199 timer_.Reset(); 189 timer_.Reset();
200 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, 190 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
201 SMOOTHNESS_TAKES_PRIORITY, 191 SMOOTHNESS_TAKES_PRIORITY,
202 NEW_CONTENT_TAKES_PRIORITY}; 192 NEW_CONTENT_TAKES_PRIORITY};
203 int priority_count = 0; 193 int priority_count = 0;
204 do { 194 do {
205 PictureLayerTiling::TilingEvictionTileIterator it( 195 PictureLayerTiling::TilingEvictionTileIterator it(
206 picture_layer_tiling_.get(), 196 picture_layer_tiling_.get(),
207 priorities[priority_count], 197 priorities[priority_count],
(...skipping 11 matching lines...) Expand all
219 } 209 }
220 210
221 void RunEvictionIteratorConstructAndIterateTest(const std::string& test_name, 211 void RunEvictionIteratorConstructAndIterateTest(const std::string& test_name,
222 int num_tiles, 212 int num_tiles,
223 const gfx::Rect& viewport) { 213 const gfx::Rect& viewport) {
224 gfx::Size bounds(10000, 10000); 214 gfx::Size bounds(10000, 10000);
225 picture_layer_tiling_ = 215 picture_layer_tiling_ =
226 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); 216 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_);
227 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); 217 picture_layer_tiling_client_.set_tree(ACTIVE_TREE);
228 picture_layer_tiling_->UpdateTilePriorities( 218 picture_layer_tiling_->UpdateTilePriorities(
229 ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform()); 219 ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion());
230 220
231 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, 221 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
232 SMOOTHNESS_TAKES_PRIORITY, 222 SMOOTHNESS_TAKES_PRIORITY,
233 NEW_CONTENT_TAKES_PRIORITY}; 223 NEW_CONTENT_TAKES_PRIORITY};
234 224
235 // Ensure all tiles have resources. 225 // Ensure all tiles have resources.
236 std::vector<Tile*> all_tiles = picture_layer_tiling_->AllTilesForTesting(); 226 std::vector<Tile*> all_tiles = picture_layer_tiling_->AllTilesForTesting();
237 for (std::vector<Tile*>::iterator tile_it = all_tiles.begin(); 227 for (std::vector<Tile*>::iterator tile_it = all_tiles.begin();
238 tile_it != all_tiles.end(); 228 tile_it != all_tiles.end();
239 ++tile_it) { 229 ++tile_it) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 "32_500x500", 32, gfx::Rect(0, 0, 500, 500)); 351 "32_500x500", 32, gfx::Rect(0, 0, 500, 500));
362 RunEvictionIteratorConstructAndIterateTest( 352 RunEvictionIteratorConstructAndIterateTest(
363 "64_100x100", 64, gfx::Rect(0, 0, 100, 100)); 353 "64_100x100", 64, gfx::Rect(0, 0, 100, 100));
364 RunEvictionIteratorConstructAndIterateTest( 354 RunEvictionIteratorConstructAndIterateTest(
365 "64_500x500", 64, gfx::Rect(0, 0, 500, 500)); 355 "64_500x500", 64, gfx::Rect(0, 0, 500, 500));
366 } 356 }
367 357
368 } // namespace 358 } // namespace
369 359
370 } // namespace cc 360 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.cc ('k') | cc/resources/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698