Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 // Copyright 2014 The Chromium Authors. All rights reserved. | 2 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #include "components/viz/service/display/surface_aggregator.h" | 6 #include "components/viz/service/display/surface_aggregator.h" |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 2439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2450 EXPECT_EQ(color_space2, aggregated_frame.render_pass_list[1]->color_space); | 2450 EXPECT_EQ(color_space2, aggregated_frame.render_pass_list[1]->color_space); |
| 2451 | 2451 |
| 2452 aggregator_.SetOutputColorSpace(color_space1, color_space3); | 2452 aggregator_.SetOutputColorSpace(color_space1, color_space3); |
| 2453 aggregated_frame = aggregator_.Aggregate(surface_id); | 2453 aggregated_frame = aggregator_.Aggregate(surface_id); |
| 2454 EXPECT_EQ(3u, aggregated_frame.render_pass_list.size()); | 2454 EXPECT_EQ(3u, aggregated_frame.render_pass_list.size()); |
| 2455 EXPECT_EQ(color_space1, aggregated_frame.render_pass_list[0]->color_space); | 2455 EXPECT_EQ(color_space1, aggregated_frame.render_pass_list[0]->color_space); |
| 2456 EXPECT_EQ(color_space1, aggregated_frame.render_pass_list[1]->color_space); | 2456 EXPECT_EQ(color_space1, aggregated_frame.render_pass_list[1]->color_space); |
| 2457 EXPECT_EQ(color_space3, aggregated_frame.render_pass_list[2]->color_space); | 2457 EXPECT_EQ(color_space3, aggregated_frame.render_pass_list[2]->color_space); |
| 2458 } | 2458 } |
| 2459 | 2459 |
| 2460 // Tests that has_damage_from_contributing_content are aggregated correctly from | |
| 2461 // surface quads. | |
| 2462 TEST_F(SurfaceAggregatorValidSurfaceTest, HasDamageFromSurfaces) { | |
|
danakj
2017/07/25 18:55:03
Can you split this into smaller test cases?
wutao
2017/07/26 07:48:53
I added a new test for jbauman@'s corner case.
I
| |
| 2463 auto grand_child_support = CompositorFrameSinkSupport::Create( | |
| 2464 nullptr, &manager_, kArbitraryMiddleFrameSinkId, kChildIsRoot, | |
| 2465 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); | |
| 2466 | |
| 2467 Quad child_surface_quads[] = {Quad::RenderPassQuad(1)}; | |
| 2468 Pass child_surface_passes[] = { | |
| 2469 Pass(child_surface_quads, arraysize(child_surface_quads), 1)}; | |
| 2470 | |
| 2471 cc::CompositorFrame child_surface_frame = | |
| 2472 cc::test::MakeEmptyCompositorFrame(); | |
| 2473 AddPasses(&child_surface_frame.render_pass_list, gfx::Rect(SurfaceSize()), | |
| 2474 child_surface_passes, arraysize(child_surface_passes)); | |
| 2475 | |
| 2476 LocalSurfaceId child_local_surface_id = allocator_.GenerateId(); | |
| 2477 SurfaceId child_surface_id(child_support_->frame_sink_id(), | |
| 2478 child_local_surface_id); | |
| 2479 child_support_->SubmitCompositorFrame(child_local_surface_id, | |
| 2480 std::move(child_surface_frame)); | |
| 2481 | |
| 2482 Quad root_surface_quads[] = { | |
| 2483 Quad::SurfaceQuad(child_surface_id, InvalidSurfaceId(), 1.f)}; | |
| 2484 Pass root_passes[] = { | |
| 2485 Pass(root_surface_quads, arraysize(root_surface_quads), 1)}; | |
| 2486 | |
| 2487 cc::CompositorFrame root_frame = cc::test::MakeEmptyCompositorFrame(); | |
| 2488 AddPasses(&root_frame.render_pass_list, gfx::Rect(SurfaceSize()), root_passes, | |
| 2489 arraysize(root_passes)); | |
| 2490 root_frame.render_pass_list[0]->cache_render_surface = true; | |
| 2491 | |
| 2492 SurfaceId root_surface_id(support_->frame_sink_id(), root_local_surface_id_); | |
| 2493 support_->SubmitCompositorFrame(root_local_surface_id_, | |
| 2494 std::move(root_frame)); | |
| 2495 | |
| 2496 cc::CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id); | |
| 2497 // First aggregation shold be true. | |
| 2498 EXPECT_TRUE(aggregated_frame.render_pass_list[0] | |
| 2499 ->has_damage_from_contributing_content); | |
|
danakj
2017/07/25 18:55:03
This is related to my questions in the aggregator,
wutao
2017/07/26 07:48:53
DamageRectForSurface() makes a surface fully damag
| |
| 2500 | |
| 2501 // No Surface changed, so no damage should be given. | |
| 2502 { | |
| 2503 cc::CompositorFrame aggregated_frame = | |
| 2504 aggregator_.Aggregate(root_surface_id); | |
| 2505 EXPECT_FALSE(aggregated_frame.render_pass_list[0] | |
| 2506 ->has_damage_from_contributing_content); | |
| 2507 } | |
| 2508 | |
| 2509 // Change child_frame should cause damage. | |
| 2510 { | |
| 2511 cc::CompositorFrame child_surface_frame = | |
| 2512 cc::test::MakeEmptyCompositorFrame(); | |
| 2513 AddPasses(&child_surface_frame.render_pass_list, gfx::Rect(SurfaceSize()), | |
| 2514 child_surface_passes, arraysize(child_surface_passes)); | |
| 2515 child_support_->SubmitCompositorFrame(child_local_surface_id, | |
| 2516 std::move(child_surface_frame)); | |
| 2517 | |
| 2518 cc::CompositorFrame aggregated_frame = | |
| 2519 aggregator_.Aggregate(root_surface_id); | |
| 2520 // True for new child_frame. | |
| 2521 EXPECT_TRUE(aggregated_frame.render_pass_list[0] | |
| 2522 ->has_damage_from_contributing_content); | |
| 2523 } | |
| 2524 | |
| 2525 // No Surface changed, so no damage should be given. | |
| 2526 { | |
| 2527 cc::CompositorFrame aggregated_frame = | |
| 2528 aggregator_.Aggregate(root_surface_id); | |
| 2529 EXPECT_FALSE(aggregated_frame.render_pass_list[0] | |
| 2530 ->has_damage_from_contributing_content); | |
| 2531 } | |
| 2532 | |
| 2533 // Add a grand_child_frame should cause damage. | |
| 2534 Quad grand_child_quads[] = {Quad::RenderPassQuad(1)}; | |
| 2535 Pass grand_child_passes[] = { | |
| 2536 Pass(grand_child_quads, arraysize(grand_child_quads), 1)}; | |
| 2537 LocalSurfaceId grand_child_local_surface_id = allocator_.GenerateId(); | |
| 2538 SurfaceId grand_child_surface_id(grand_child_support->frame_sink_id(), | |
| 2539 grand_child_local_surface_id); | |
| 2540 { | |
| 2541 cc::CompositorFrame grand_child_frame = | |
| 2542 cc::test::MakeEmptyCompositorFrame(); | |
| 2543 AddPasses(&grand_child_frame.render_pass_list, gfx::Rect(SurfaceSize()), | |
| 2544 grand_child_passes, arraysize(grand_child_passes)); | |
| 2545 | |
| 2546 grand_child_support->SubmitCompositorFrame(grand_child_local_surface_id, | |
| 2547 std::move(grand_child_frame)); | |
| 2548 | |
| 2549 Quad new_child_surface_quads[] = { | |
| 2550 child_surface_quads[0], | |
| 2551 Quad::SurfaceQuad(grand_child_surface_id, InvalidSurfaceId(), 1.f)}; | |
| 2552 Pass new_child_surface_passes[] = { | |
| 2553 Pass(new_child_surface_quads, arraysize(new_child_surface_quads), 1)}; | |
| 2554 child_surface_frame = cc::test::MakeEmptyCompositorFrame(); | |
| 2555 AddPasses(&child_surface_frame.render_pass_list, gfx::Rect(SurfaceSize()), | |
| 2556 new_child_surface_passes, arraysize(new_child_surface_passes)); | |
| 2557 child_support_->SubmitCompositorFrame(child_local_surface_id, | |
| 2558 std::move(child_surface_frame)); | |
| 2559 | |
| 2560 cc::CompositorFrame aggregated_frame = | |
| 2561 aggregator_.Aggregate(root_surface_id); | |
| 2562 // True for new grand_child_frame. | |
| 2563 EXPECT_TRUE(aggregated_frame.render_pass_list[0] | |
| 2564 ->has_damage_from_contributing_content); | |
|
danakj
2017/07/25 18:55:03
This is related to my questions in the aggregator,
wutao
2017/07/26 07:48:53
Similar to previous comments, root aggregated dama
| |
| 2565 } | |
| 2566 | |
| 2567 // No Surface changed, so no damage should be given. | |
| 2568 { | |
| 2569 cc::CompositorFrame aggregated_frame = | |
| 2570 aggregator_.Aggregate(root_surface_id); | |
| 2571 EXPECT_FALSE(aggregated_frame.render_pass_list[0] | |
| 2572 ->has_damage_from_contributing_content); | |
| 2573 } | |
| 2574 | |
| 2575 // Change grand_child_frame should cause damage. | |
| 2576 { | |
| 2577 cc::CompositorFrame grand_child_frame = | |
| 2578 cc::test::MakeEmptyCompositorFrame(); | |
| 2579 AddPasses(&grand_child_frame.render_pass_list, gfx::Rect(SurfaceSize()), | |
| 2580 grand_child_passes, arraysize(grand_child_passes)); | |
| 2581 grand_child_support->SubmitCompositorFrame(grand_child_local_surface_id, | |
| 2582 std::move(grand_child_frame)); | |
| 2583 | |
| 2584 cc::CompositorFrame aggregated_frame = | |
| 2585 aggregator_.Aggregate(root_surface_id); | |
| 2586 // True for new grand_child_frame. | |
| 2587 EXPECT_TRUE(aggregated_frame.render_pass_list[0] | |
| 2588 ->has_damage_from_contributing_content); | |
| 2589 } | |
| 2590 | |
| 2591 // No Surface changed, so no damage should be given. | |
| 2592 { | |
| 2593 cc::CompositorFrame aggregated_frame = | |
| 2594 aggregator_.Aggregate(root_surface_id); | |
| 2595 EXPECT_FALSE(aggregated_frame.render_pass_list[0] | |
| 2596 ->has_damage_from_contributing_content); | |
| 2597 } | |
| 2598 | |
| 2599 // Remove a grand_child_frame should cause damage. | |
| 2600 { | |
| 2601 Quad new_child_surface_quads[] = {child_surface_quads[0]}; | |
| 2602 Pass new_child_surface_passes[] = { | |
| 2603 Pass(new_child_surface_quads, arraysize(new_child_surface_quads), 1)}; | |
| 2604 child_surface_frame = cc::test::MakeEmptyCompositorFrame(); | |
| 2605 AddPasses(&child_surface_frame.render_pass_list, gfx::Rect(SurfaceSize()), | |
| 2606 new_child_surface_passes, arraysize(new_child_surface_passes)); | |
| 2607 child_support_->SubmitCompositorFrame(child_local_surface_id, | |
| 2608 std::move(child_surface_frame)); | |
| 2609 | |
| 2610 cc::CompositorFrame aggregated_frame = | |
| 2611 aggregator_.Aggregate(root_surface_id); | |
| 2612 // True for new child_frame. | |
| 2613 EXPECT_TRUE(aggregated_frame.render_pass_list[0] | |
| 2614 ->has_damage_from_contributing_content); | |
|
danakj
2017/07/25 18:55:03
This is related to my questions in the aggregator,
wutao
2017/07/26 07:48:53
Actually, it seems no point for this test, just as
| |
| 2615 } | |
| 2616 | |
| 2617 grand_child_support->EvictCurrentSurface(); | |
| 2618 } | |
| 2619 | |
| 2460 } // namespace | 2620 } // namespace |
| 2461 } // namespace viz | 2621 } // namespace viz |
| OLD | NEW |