| OLD | NEW |
| 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/base/lap_timer.h" | 6 #include "cc/base/lap_timer.h" |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/quads/surface_draw_quad.h" | 8 #include "cc/quads/surface_draw_quad.h" |
| 9 #include "cc/quads/texture_draw_quad.h" | 9 #include "cc/quads/texture_draw_quad.h" |
| 10 #include "cc/surfaces/surface_aggregator.h" | 10 #include "cc/surfaces/surface_aggregator.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 SurfaceDrawQuad* surface_quad = | 91 SurfaceDrawQuad* surface_quad = |
| 92 pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); | 92 pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); |
| 93 surface_quad->SetNew( | 93 surface_quad->SetNew( |
| 94 sqs, gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), | 94 sqs, gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), |
| 95 SurfaceId(FrameSinkId(1, i), LocalSurfaceId(i, kArbitraryToken)), | 95 SurfaceId(FrameSinkId(1, i), LocalSurfaceId(i, kArbitraryToken)), |
| 96 SurfaceDrawQuadType::PRIMARY, nullptr); | 96 SurfaceDrawQuadType::PRIMARY, nullptr); |
| 97 } | 97 } |
| 98 | 98 |
| 99 frame.render_pass_list.push_back(std::move(pass)); | 99 frame.render_pass_list.push_back(std::move(pass)); |
| 100 child_factories[i]->SubmitCompositorFrame( | 100 child_factories[i]->SubmitCompositorFrame( |
| 101 local_surface_id, std::move(frame), SurfaceFactory::DrawCallback()); | 101 local_surface_id, std::move(frame), SurfaceFactory::DrawCallback(), |
| 102 SurfaceFactory::WillDrawCallback()); |
| 102 } | 103 } |
| 103 | 104 |
| 104 SurfaceFactory root_factory(FrameSinkId(1, num_surfaces + 1), &manager_, | 105 SurfaceFactory root_factory(FrameSinkId(1, num_surfaces + 1), &manager_, |
| 105 &empty_client_); | 106 &empty_client_); |
| 106 timer_.Reset(); | 107 timer_.Reset(); |
| 107 do { | 108 do { |
| 108 std::unique_ptr<RenderPass> pass(RenderPass::Create()); | 109 std::unique_ptr<RenderPass> pass(RenderPass::Create()); |
| 109 CompositorFrame frame; | 110 CompositorFrame frame; |
| 110 | 111 |
| 111 SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); | 112 SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); |
| 112 SurfaceDrawQuad* surface_quad = | 113 SurfaceDrawQuad* surface_quad = |
| 113 pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); | 114 pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); |
| 114 surface_quad->SetNew( | 115 surface_quad->SetNew( |
| 115 sqs, gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 100, 100), | 116 sqs, gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 100, 100), |
| 116 SurfaceId(FrameSinkId(1, num_surfaces), | 117 SurfaceId(FrameSinkId(1, num_surfaces), |
| 117 LocalSurfaceId(num_surfaces, kArbitraryToken)), | 118 LocalSurfaceId(num_surfaces, kArbitraryToken)), |
| 118 SurfaceDrawQuadType::PRIMARY, nullptr); | 119 SurfaceDrawQuadType::PRIMARY, nullptr); |
| 119 | 120 |
| 120 if (full_damage) | 121 if (full_damage) |
| 121 pass->damage_rect = gfx::Rect(0, 0, 100, 100); | 122 pass->damage_rect = gfx::Rect(0, 0, 100, 100); |
| 122 else | 123 else |
| 123 pass->damage_rect = gfx::Rect(0, 0, 1, 1); | 124 pass->damage_rect = gfx::Rect(0, 0, 1, 1); |
| 124 | 125 |
| 125 frame.render_pass_list.push_back(std::move(pass)); | 126 frame.render_pass_list.push_back(std::move(pass)); |
| 126 | 127 |
| 127 root_factory.SubmitCompositorFrame( | 128 root_factory.SubmitCompositorFrame( |
| 128 LocalSurfaceId(num_surfaces + 1, kArbitraryToken), std::move(frame), | 129 LocalSurfaceId(num_surfaces + 1, kArbitraryToken), std::move(frame), |
| 129 SurfaceFactory::DrawCallback()); | 130 SurfaceFactory::DrawCallback(), SurfaceFactory::WillDrawCallback()); |
| 130 | 131 |
| 131 CompositorFrame aggregated = aggregator_->Aggregate( | 132 CompositorFrame aggregated = aggregator_->Aggregate( |
| 132 SurfaceId(FrameSinkId(1, num_surfaces + 1), | 133 SurfaceId(FrameSinkId(1, num_surfaces + 1), |
| 133 LocalSurfaceId(num_surfaces + 1, kArbitraryToken))); | 134 LocalSurfaceId(num_surfaces + 1, kArbitraryToken))); |
| 134 timer_.NextLap(); | 135 timer_.NextLap(); |
| 135 } while (!timer_.HasTimeLimitExpired()); | 136 } while (!timer_.HasTimeLimitExpired()); |
| 136 | 137 |
| 137 perf_test::PrintResult("aggregator_speed", "", name, timer_.LapsPerSecond(), | 138 perf_test::PrintResult("aggregator_speed", "", name, timer_.LapsPerSecond(), |
| 138 "runs/s", true); | 139 "runs/s", true); |
| 139 for (int i = 0; i < num_surfaces; i++) | 140 for (int i = 0; i < num_surfaces; i++) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 TEST_F(SurfaceAggregatorPerfTest, FewSurfacesDamageCalc) { | 175 TEST_F(SurfaceAggregatorPerfTest, FewSurfacesDamageCalc) { |
| 175 RunTest(3, 1000, 1.f, true, true, "few_surfaces_damage_calc"); | 176 RunTest(3, 1000, 1.f, true, true, "few_surfaces_damage_calc"); |
| 176 } | 177 } |
| 177 | 178 |
| 178 TEST_F(SurfaceAggregatorPerfTest, FewSurfacesAggregateDamaged) { | 179 TEST_F(SurfaceAggregatorPerfTest, FewSurfacesAggregateDamaged) { |
| 179 RunTest(3, 1000, 1.f, true, false, "few_surfaces_aggregate_damaged"); | 180 RunTest(3, 1000, 1.f, true, false, "few_surfaces_aggregate_damaged"); |
| 180 } | 181 } |
| 181 | 182 |
| 182 } // namespace | 183 } // namespace |
| 183 } // namespace cc | 184 } // namespace cc |
| OLD | NEW |