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

Side by Side Diff: cc/surfaces/surface_aggregator_perftest.cc

Issue 2337913003: Fork cc::OutputSurface into cc::CompositorFrameSink. (Closed)
Patch Set: cfsfork: ccperftests2 Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/memory/ptr_util.h" 5 #include "base/memory/ptr_util.h"
6 #include "cc/debug/lap_timer.h" 6 #include "cc/debug/lap_timer.h"
7 #include "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/output/delegated_frame_data.h" 8 #include "cc/output/delegated_frame_data.h"
9 #include "cc/quads/surface_draw_quad.h" 9 #include "cc/quads/surface_draw_quad.h"
10 #include "cc/quads/texture_draw_quad.h" 10 #include "cc/quads/texture_draw_quad.h"
11 #include "cc/surfaces/surface_aggregator.h" 11 #include "cc/surfaces/surface_aggregator.h"
12 #include "cc/surfaces/surface_factory.h" 12 #include "cc/surfaces/surface_factory.h"
13 #include "cc/surfaces/surface_factory_client.h" 13 #include "cc/surfaces/surface_factory_client.h"
14 #include "cc/surfaces/surface_manager.h" 14 #include "cc/surfaces/surface_manager.h"
15 #include "cc/test/fake_output_surface.h"
16 #include "cc/test/fake_output_surface_client.h" 15 #include "cc/test/fake_output_surface_client.h"
17 #include "cc/test/fake_resource_provider.h" 16 #include "cc/test/fake_resource_provider.h"
17 #include "cc/test/test_context_provider.h"
18 #include "cc/test/test_shared_bitmap_manager.h" 18 #include "cc/test/test_shared_bitmap_manager.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 #include "testing/perf/perf_test.h" 20 #include "testing/perf/perf_test.h"
21 21
22 namespace cc { 22 namespace cc {
23 namespace { 23 namespace {
24 24
25 static constexpr uint32_t kArbitraryClientId = 0; 25 static constexpr uint32_t kArbitraryClientId = 0;
26 26
27 class EmptySurfaceFactoryClient : public SurfaceFactoryClient { 27 class EmptySurfaceFactoryClient : public SurfaceFactoryClient {
28 public: 28 public:
29 void ReturnResources(const ReturnedResourceArray& resources) override {} 29 void ReturnResources(const ReturnedResourceArray& resources) override {}
30 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override {} 30 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override {}
31 }; 31 };
32 32
33 class SurfaceAggregatorPerfTest : public testing::Test { 33 class SurfaceAggregatorPerfTest : public testing::Test {
34 public: 34 public:
35 SurfaceAggregatorPerfTest() : factory_(&manager_, &empty_client_) { 35 SurfaceAggregatorPerfTest() : factory_(&manager_, &empty_client_) {
36 output_surface_ = FakeOutputSurface::CreateSoftware( 36 context_provider_ = TestContextProvider::Create();
37 base::WrapUnique(new SoftwareOutputDevice)); 37 context_provider_->BindToCurrentThread();
38 output_surface_->BindToClient(&output_surface_client_);
39 shared_bitmap_manager_.reset(new TestSharedBitmapManager); 38 shared_bitmap_manager_.reset(new TestSharedBitmapManager);
40 39
41 resource_provider_ = FakeResourceProvider::Create( 40 resource_provider_ = FakeResourceProvider::Create(
42 output_surface_.get(), shared_bitmap_manager_.get()); 41 context_provider_.get(), shared_bitmap_manager_.get());
43 } 42 }
44 43
45 void RunTest(int num_surfaces, 44 void RunTest(int num_surfaces,
46 int num_textures, 45 int num_textures,
47 float opacity, 46 float opacity,
48 bool optimize_damage, 47 bool optimize_damage,
49 bool full_damage, 48 bool full_damage,
50 const std::string& name) { 49 const std::string& name) {
51 aggregator_.reset(new SurfaceAggregator(&manager_, resource_provider_.get(), 50 aggregator_.reset(new SurfaceAggregator(&manager_, resource_provider_.get(),
52 optimize_damage)); 51 optimize_damage));
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 133
135 factory_.Destroy(SurfaceId(kArbitraryClientId, num_surfaces + 1, 0)); 134 factory_.Destroy(SurfaceId(kArbitraryClientId, num_surfaces + 1, 0));
136 for (int i = 1; i <= num_surfaces; i++) 135 for (int i = 1; i <= num_surfaces; i++)
137 factory_.Destroy(SurfaceId(kArbitraryClientId, i, 0)); 136 factory_.Destroy(SurfaceId(kArbitraryClientId, i, 0));
138 } 137 }
139 138
140 protected: 139 protected:
141 SurfaceManager manager_; 140 SurfaceManager manager_;
142 EmptySurfaceFactoryClient empty_client_; 141 EmptySurfaceFactoryClient empty_client_;
143 SurfaceFactory factory_; 142 SurfaceFactory factory_;
144 FakeOutputSurfaceClient output_surface_client_; 143 scoped_refptr<TestContextProvider> context_provider_;
145 std::unique_ptr<OutputSurface> output_surface_;
146 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; 144 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_;
147 std::unique_ptr<ResourceProvider> resource_provider_; 145 std::unique_ptr<ResourceProvider> resource_provider_;
148 std::unique_ptr<SurfaceAggregator> aggregator_; 146 std::unique_ptr<SurfaceAggregator> aggregator_;
149 LapTimer timer_; 147 LapTimer timer_;
150 }; 148 };
151 149
152 TEST_F(SurfaceAggregatorPerfTest, ManySurfacesOpaque) { 150 TEST_F(SurfaceAggregatorPerfTest, ManySurfacesOpaque) {
153 RunTest(20, 100, 1.f, false, true, "many_surfaces_opaque"); 151 RunTest(20, 100, 1.f, false, true, "many_surfaces_opaque");
154 } 152 }
155 153
(...skipping 16 matching lines...) Expand all
172 TEST_F(SurfaceAggregatorPerfTest, FewSurfacesDamageCalc) { 170 TEST_F(SurfaceAggregatorPerfTest, FewSurfacesDamageCalc) {
173 RunTest(3, 1000, 1.f, true, true, "few_surfaces_damage_calc"); 171 RunTest(3, 1000, 1.f, true, true, "few_surfaces_damage_calc");
174 } 172 }
175 173
176 TEST_F(SurfaceAggregatorPerfTest, FewSurfacesAggregateDamaged) { 174 TEST_F(SurfaceAggregatorPerfTest, FewSurfacesAggregateDamaged) {
177 RunTest(3, 1000, 1.f, true, false, "few_surfaces_aggregate_damaged"); 175 RunTest(3, 1000, 1.f, true, false, "few_surfaces_aggregate_damaged");
178 } 176 }
179 177
180 } // namespace 178 } // namespace
181 } // namespace cc 179 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698