| 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/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/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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 uv_bottom_right, background_color, vertex_opacity, flipped, | 85 uv_bottom_right, background_color, vertex_opacity, flipped, |
| 86 nearest_neighbor, false); | 86 nearest_neighbor, false); |
| 87 } | 87 } |
| 88 sqs = pass->CreateAndAppendSharedQuadState(); | 88 sqs = pass->CreateAndAppendSharedQuadState(); |
| 89 sqs->opacity = opacity; | 89 sqs->opacity = opacity; |
| 90 if (i >= 1) { | 90 if (i >= 1) { |
| 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 } | 97 } |
| 97 | 98 |
| 98 frame.render_pass_list.push_back(std::move(pass)); | 99 frame.render_pass_list.push_back(std::move(pass)); |
| 99 child_factories[i]->SubmitCompositorFrame( | 100 child_factories[i]->SubmitCompositorFrame( |
| 100 local_surface_id, std::move(frame), SurfaceFactory::DrawCallback()); | 101 local_surface_id, std::move(frame), SurfaceFactory::DrawCallback()); |
| 101 } | 102 } |
| 102 | 103 |
| 103 SurfaceFactory root_factory(FrameSinkId(1, num_surfaces + 1), &manager_, | 104 SurfaceFactory root_factory(FrameSinkId(1, num_surfaces + 1), &manager_, |
| 104 &empty_client_); | 105 &empty_client_); |
| 105 timer_.Reset(); | 106 timer_.Reset(); |
| 106 do { | 107 do { |
| 107 std::unique_ptr<RenderPass> pass(RenderPass::Create()); | 108 std::unique_ptr<RenderPass> pass(RenderPass::Create()); |
| 108 CompositorFrame frame; | 109 CompositorFrame frame; |
| 109 | 110 |
| 110 SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); | 111 SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); |
| 111 SurfaceDrawQuad* surface_quad = | 112 SurfaceDrawQuad* surface_quad = |
| 112 pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); | 113 pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); |
| 113 surface_quad->SetNew( | 114 surface_quad->SetNew( |
| 114 sqs, gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 100, 100), | 115 sqs, gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 100, 100), |
| 115 SurfaceId(FrameSinkId(1, num_surfaces), | 116 SurfaceId(FrameSinkId(1, num_surfaces), |
| 116 LocalSurfaceId(num_surfaces, kArbitraryToken))); | 117 LocalSurfaceId(num_surfaces, kArbitraryToken)), |
| 118 SurfaceDrawQuadType::PRIMARY, nullptr); |
| 117 | 119 |
| 118 if (full_damage) | 120 if (full_damage) |
| 119 pass->damage_rect = gfx::Rect(0, 0, 100, 100); | 121 pass->damage_rect = gfx::Rect(0, 0, 100, 100); |
| 120 else | 122 else |
| 121 pass->damage_rect = gfx::Rect(0, 0, 1, 1); | 123 pass->damage_rect = gfx::Rect(0, 0, 1, 1); |
| 122 | 124 |
| 123 frame.render_pass_list.push_back(std::move(pass)); | 125 frame.render_pass_list.push_back(std::move(pass)); |
| 124 | 126 |
| 125 root_factory.SubmitCompositorFrame( | 127 root_factory.SubmitCompositorFrame( |
| 126 LocalSurfaceId(num_surfaces + 1, kArbitraryToken), std::move(frame), | 128 LocalSurfaceId(num_surfaces + 1, kArbitraryToken), std::move(frame), |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 TEST_F(SurfaceAggregatorPerfTest, FewSurfacesDamageCalc) { | 174 TEST_F(SurfaceAggregatorPerfTest, FewSurfacesDamageCalc) { |
| 173 RunTest(3, 1000, 1.f, true, true, "few_surfaces_damage_calc"); | 175 RunTest(3, 1000, 1.f, true, true, "few_surfaces_damage_calc"); |
| 174 } | 176 } |
| 175 | 177 |
| 176 TEST_F(SurfaceAggregatorPerfTest, FewSurfacesAggregateDamaged) { | 178 TEST_F(SurfaceAggregatorPerfTest, FewSurfacesAggregateDamaged) { |
| 177 RunTest(3, 1000, 1.f, true, false, "few_surfaces_aggregate_damaged"); | 179 RunTest(3, 1000, 1.f, true, false, "few_surfaces_aggregate_damaged"); |
| 178 } | 180 } |
| 179 | 181 |
| 180 } // namespace | 182 } // namespace |
| 181 } // namespace cc | 183 } // namespace cc |
| OLD | NEW |