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

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

Issue 140513006: cc: Simplify picture layer tiling update tile priorities. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: format + clip inverse projected rect Created 6 years, 10 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 | Annotate | Revision Log
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/resources/picture_layer_tiling.h" 5 #include "cc/resources/picture_layer_tiling.h"
6 #include "cc/test/fake_picture_layer_tiling_client.h" 6 #include "cc/test/fake_picture_layer_tiling_client.h"
7 7
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "testing/perf/perf_test.h" 9 #include "testing/perf/perf_test.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 namespace { 13 namespace {
14 14
15 static const int kTimeLimitMillis = 2000; 15 static const int kTimeLimitMillis = 2000;
16 static const int kWarmupRuns = 5; 16 static const int kWarmupRuns = 5;
17 static const int kTimeCheckInterval = 10; 17 static const int kTimeCheckInterval = 10;
18 18
19 class PictureLayerTilingPerfTest : public testing::Test { 19 class PictureLayerTilingPerfTest : public testing::Test {
20 public: 20 public:
21 PictureLayerTilingPerfTest() : num_runs_(0) {} 21 PictureLayerTilingPerfTest() : num_runs_(0) {}
22 22
23 virtual void SetUp() OVERRIDE { 23 virtual void SetUp() OVERRIDE {
24 picture_layer_tiling_client_.SetTileSize(gfx::Size(256, 256)); 24 picture_layer_tiling_client_.SetTileSize(gfx::Size(256, 256));
25 picture_layer_tiling_client_.set_max_tiles_for_interest_area(250);
25 picture_layer_tiling_ = PictureLayerTiling::Create( 26 picture_layer_tiling_ = PictureLayerTiling::Create(
26 1, gfx::Size(256 * 50, 256 * 50), &picture_layer_tiling_client_); 27 1, gfx::Size(256 * 50, 256 * 50), &picture_layer_tiling_client_);
27 picture_layer_tiling_->CreateAllTilesForTesting(); 28 picture_layer_tiling_->CreateAllTilesForTesting();
28 } 29 }
29 30
30 virtual void TearDown() OVERRIDE { 31 virtual void TearDown() OVERRIDE {
31 picture_layer_tiling_.reset(NULL); 32 picture_layer_tiling_.reset(NULL);
32 } 33 }
33 34
34 void EndTest() { 35 void EndTest() {
(...skipping 19 matching lines...) Expand all
54 start_time_ = base::TimeTicks(); 55 start_time_ = base::TimeTicks();
55 num_runs_ = 0; 56 num_runs_ = 0;
56 do { 57 do {
57 picture_layer_tiling_->Invalidate(region); 58 picture_layer_tiling_->Invalidate(region);
58 } while (DidRun()); 59 } while (DidRun());
59 60
60 perf_test::PrintResult("invalidation", "", test_name, 61 perf_test::PrintResult("invalidation", "", test_name,
61 num_runs_ / elapsed_.InSecondsF(), "runs/s", true); 62 num_runs_ / elapsed_.InSecondsF(), "runs/s", true);
62 } 63 }
63 64
64 void RunUpdateTilePrioritiesStationaryTest( 65 void RunUpdateTilePrioritiesStationaryTest(const std::string& test_name) {
65 const std::string& test_name,
66 const gfx::Transform& transform) {
67 start_time_ = base::TimeTicks(); 66 start_time_ = base::TimeTicks();
68 num_runs_ = 0; 67 num_runs_ = 0;
69 68
70 gfx::Size layer_bounds(50 * 256, 50 * 256); 69 gfx::Size layer_bounds(50 * 256, 50 * 256);
70 gfx::Rect viewport_rect(0, 0, 1024, 768);
71 do { 71 do {
72 picture_layer_tiling_->UpdateTilePriorities( 72 picture_layer_tiling_->UpdateTilePriorities(
73 ACTIVE_TREE, 73 ACTIVE_TREE, viewport_rect, 1.f, num_runs_ + 1);
74 layer_bounds,
75 gfx::Rect(layer_bounds),
76 gfx::Rect(layer_bounds),
77 layer_bounds,
78 layer_bounds,
79 1.f,
80 1.f,
81 transform,
82 transform,
83 num_runs_ + 1,
84 250);
85 } while (DidRun()); 74 } while (DidRun());
86 75
87 perf_test::PrintResult("update_tile_priorities_stationary", "", test_name, 76 perf_test::PrintResult("update_tile_priorities_stationary",
88 num_runs_ / elapsed_.InSecondsF(), "runs/s", true); 77 "",
78 test_name,
79 num_runs_ / elapsed_.InSecondsF(),
80 "runs/s",
81 true);
89 } 82 }
90 83
91 void RunUpdateTilePrioritiesScrollingTest( 84 void RunUpdateTilePrioritiesScrollingTest(const std::string& test_name) {
92 const std::string& test_name,
93 const gfx::Transform& transform) {
94 start_time_ = base::TimeTicks(); 85 start_time_ = base::TimeTicks();
95 num_runs_ = 0; 86 num_runs_ = 0;
96 87
97 gfx::Size layer_bounds(50 * 256, 50 * 256); 88 gfx::Size layer_bounds(50 * 256, 50 * 256);
98 gfx::Size viewport_size(1024, 768); 89 gfx::Size viewport_size(1024, 768);
99 gfx::Rect viewport_rect(viewport_size); 90 gfx::Rect viewport_rect(viewport_size);
100 int xoffsets[] = {10, 0, -10, 0}; 91 int xoffsets[] = {10, 0, -10, 0};
101 int yoffsets[] = {0, 10, 0, -10}; 92 int yoffsets[] = {0, 10, 0, -10};
102 int offsetIndex = 0; 93 int offsetIndex = 0;
103 int offsetCount = 0; 94 int offsetCount = 0;
104 const int maxOffsetCount = 1000; 95 const int maxOffsetCount = 1000;
105 do { 96 do {
106 picture_layer_tiling_->UpdateTilePriorities( 97 picture_layer_tiling_->UpdateTilePriorities(
107 ACTIVE_TREE, 98 ACTIVE_TREE, viewport_rect, 1.f, num_runs_ + 1);
108 viewport_size,
109 viewport_rect,
110 gfx::Rect(layer_bounds),
111 layer_bounds,
112 layer_bounds,
113 1.f,
114 1.f,
115 transform,
116 transform,
117 num_runs_ + 1,
118 250);
119 99
120 viewport_rect = gfx::Rect( 100 viewport_rect = gfx::Rect(viewport_rect.x() + xoffsets[offsetIndex],
121 viewport_rect.x() + xoffsets[offsetIndex], 101 viewport_rect.y() + yoffsets[offsetIndex],
122 viewport_rect.y() + yoffsets[offsetIndex], 102 viewport_rect.width(),
123 viewport_rect.width(), 103 viewport_rect.height());
124 viewport_rect.height());
125 104
126 if (++offsetCount > maxOffsetCount) { 105 if (++offsetCount > maxOffsetCount) {
127 offsetCount = 0; 106 offsetCount = 0;
128 offsetIndex = (offsetIndex + 1) % 4; 107 offsetIndex = (offsetIndex + 1) % 4;
129 } 108 }
130 } while (DidRun()); 109 } while (DidRun());
131 110
132 perf_test::PrintResult("update_tile_priorities_scrolling", "", test_name, 111 perf_test::PrintResult("update_tile_priorities_scrolling",
133 num_runs_ / elapsed_.InSecondsF(), "runs/s", true); 112 "",
113 test_name,
114 num_runs_ / elapsed_.InSecondsF(),
115 "runs/s",
116 true);
134 } 117 }
135 118
136 private: 119 private:
137 FakePictureLayerTilingClient picture_layer_tiling_client_; 120 FakePictureLayerTilingClient picture_layer_tiling_client_;
138 scoped_ptr<PictureLayerTiling> picture_layer_tiling_; 121 scoped_ptr<PictureLayerTiling> picture_layer_tiling_;
139 122
140 base::TimeTicks start_time_; 123 base::TimeTicks start_time_;
141 base::TimeDelta elapsed_; 124 base::TimeDelta elapsed_;
142 int num_runs_; 125 int num_runs_;
143 }; 126 };
144 127
145 TEST_F(PictureLayerTilingPerfTest, Invalidate) { 128 TEST_F(PictureLayerTilingPerfTest, Invalidate) {
146 Region one_tile(gfx::Rect(256, 256)); 129 Region one_tile(gfx::Rect(256, 256));
147 RunInvalidateTest("1x1", one_tile); 130 RunInvalidateTest("1x1", one_tile);
148 131
149 Region half_region(gfx::Rect(25 * 256, 50 * 256)); 132 Region half_region(gfx::Rect(25 * 256, 50 * 256));
150 RunInvalidateTest("25x50", half_region); 133 RunInvalidateTest("25x50", half_region);
151 134
152 Region full_region(gfx::Rect(50 * 256, 50 * 256)); 135 Region full_region(gfx::Rect(50 * 256, 50 * 256));
153 RunInvalidateTest("50x50", full_region); 136 RunInvalidateTest("50x50", full_region);
154 } 137 }
155 138
156 #if defined(OS_ANDROID) 139 #if defined(OS_ANDROID)
157 // TODO(vmpstr): Investigate why this is noisy (crbug.com/310220). 140 // TODO(vmpstr): Investigate why this is noisy (crbug.com/310220).
158 TEST_F(PictureLayerTilingPerfTest, DISABLED_UpdateTilePriorities) { 141 TEST_F(PictureLayerTilingPerfTest, DISABLED_UpdateTilePriorities) {
159 #else 142 #else
160 TEST_F(PictureLayerTilingPerfTest, UpdateTilePriorities) { 143 TEST_F(PictureLayerTilingPerfTest, UpdateTilePriorities) {
161 #endif // defined(OS_ANDROID) 144 #endif // defined(OS_ANDROID)
162 gfx::Transform transform; 145 RunUpdateTilePrioritiesStationaryTest("no_transform");
163 RunUpdateTilePrioritiesStationaryTest("no_transform", transform); 146 RunUpdateTilePrioritiesScrollingTest("no_transform");
164 RunUpdateTilePrioritiesScrollingTest("no_transform", transform);
165
166 transform.Rotate(10);
167 RunUpdateTilePrioritiesStationaryTest("rotation", transform);
enne (OOO) 2014/02/11 00:43:56 I think I maybe said remove this, but maybe leave
vmpstr 2014/02/11 23:45:25 Done.
168 RunUpdateTilePrioritiesScrollingTest("rotation", transform);
169
170 transform.ApplyPerspectiveDepth(10);
171 RunUpdateTilePrioritiesStationaryTest("perspective", transform);
172 RunUpdateTilePrioritiesScrollingTest("perspective", transform);
173 } 147 }
174 148
175 } // namespace 149 } // namespace
176 150
177 } // namespace cc 151 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698