OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surfaces/surface_aggregator.h" | 5 #include "cc/surfaces/surface_aggregator.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 size_t sqs_size = source.shared_quad_state_list.size(); | 260 size_t sqs_size = source.shared_quad_state_list.size(); |
261 size_t dq_size = source.quad_list.size(); | 261 size_t dq_size = source.quad_list.size(); |
262 std::unique_ptr<RenderPass> copy_pass( | 262 std::unique_ptr<RenderPass> copy_pass( |
263 RenderPass::Create(sqs_size, dq_size)); | 263 RenderPass::Create(sqs_size, dq_size)); |
264 | 264 |
265 RenderPassId remapped_pass_id = RemapPassId(source.id, surface_id); | 265 RenderPassId remapped_pass_id = RemapPassId(source.id, surface_id); |
266 | 266 |
267 copy_pass->SetAll(remapped_pass_id, source.output_rect, source.output_rect, | 267 copy_pass->SetAll(remapped_pass_id, source.output_rect, source.output_rect, |
268 source.transform_to_root_target, source.filters, | 268 source.transform_to_root_target, source.filters, |
269 source.background_filters, blending_color_space_, | 269 source.background_filters, blending_color_space_, |
270 source.has_transparent_background); | 270 source.has_transparent_background, |
| 271 source.cache_render_surface, |
| 272 source.has_damage_from_contributing_content); |
271 | 273 |
272 MoveMatchingRequests(source.id, ©_requests, ©_pass->copy_requests); | 274 MoveMatchingRequests(source.id, ©_requests, ©_pass->copy_requests); |
273 | 275 |
274 // Contributing passes aggregated in to the pass list need to take the | 276 // Contributing passes aggregated in to the pass list need to take the |
275 // transform of the surface quad into account to update their transform to | 277 // transform of the surface quad into account to update their transform to |
276 // the root surface. | 278 // the root surface. |
277 copy_pass->transform_to_root_target.ConcatTransform( | 279 copy_pass->transform_to_root_target.ConcatTransform( |
278 surface_quad->shared_quad_state->quad_to_target_transform); | 280 surface_quad->shared_quad_state->quad_to_target_transform); |
279 copy_pass->transform_to_root_target.ConcatTransform(target_transform); | 281 copy_pass->transform_to_root_target.ConcatTransform(target_transform); |
280 copy_pass->transform_to_root_target.ConcatTransform( | 282 copy_pass->transform_to_root_target.ConcatTransform( |
281 dest_pass->transform_to_root_target); | 283 dest_pass->transform_to_root_target); |
282 | 284 |
283 CopyQuadsToPass(source.quad_list, source.shared_quad_state_list, | 285 CopyQuadsToPass(source.quad_list, source.shared_quad_state_list, |
284 child_to_parent_map, gfx::Transform(), ClipData(), | 286 child_to_parent_map, gfx::Transform(), ClipData(), |
285 copy_pass.get(), surface_id); | 287 copy_pass.get(), surface_id); |
286 | 288 |
287 if (!copy_request_passes_.count(remapped_pass_id) && | 289 if (!copy_request_passes_.count(remapped_pass_id) && |
| 290 !cache_render_surface_passes_.count(remapped_pass_id) && |
288 !moved_pixel_passes_.count(remapped_pass_id)) { | 291 !moved_pixel_passes_.count(remapped_pass_id)) { |
289 gfx::Transform inverse_transform(gfx::Transform::kSkipInitialization); | 292 gfx::Transform inverse_transform(gfx::Transform::kSkipInitialization); |
290 if (copy_pass->transform_to_root_target.GetInverse(&inverse_transform)) { | 293 if (copy_pass->transform_to_root_target.GetInverse(&inverse_transform)) { |
291 gfx::Rect damage_rect_in_render_pass_space = | 294 gfx::Rect damage_rect_in_render_pass_space = |
292 MathUtil::ProjectEnclosingClippedRect(inverse_transform, | 295 MathUtil::ProjectEnclosingClippedRect(inverse_transform, |
293 root_damage_rect_); | 296 root_damage_rect_); |
294 copy_pass->damage_rect.Intersect(damage_rect_in_render_pass_space); | 297 copy_pass->damage_rect.Intersect(damage_rect_in_render_pass_space); |
295 } | 298 } |
296 } | 299 } |
297 | 300 |
| 301 passes_id_map.insert(std::make_pair(copy_pass->id, copy_pass.get())); |
298 dest_pass_list_->push_back(std::move(copy_pass)); | 302 dest_pass_list_->push_back(std::move(copy_pass)); |
299 } | 303 } |
300 | 304 |
301 gfx::Transform surface_transform = | 305 gfx::Transform surface_transform = |
302 surface_quad->shared_quad_state->quad_to_target_transform; | 306 surface_quad->shared_quad_state->quad_to_target_transform; |
303 surface_transform.ConcatTransform(target_transform); | 307 surface_transform.ConcatTransform(target_transform); |
304 | 308 |
305 const RenderPass& last_pass = *render_pass_list.back(); | 309 const RenderPass& last_pass = *render_pass_list.back(); |
| 310 // Check if the surface_quad has damage. |
| 311 if (dest_pass->cache_render_surface) { |
| 312 dest_pass->has_damage_from_contributing_content |= |
| 313 !DamageRectForSurface(surface, last_pass, last_pass.output_rect) |
| 314 .IsEmpty(); |
| 315 } |
| 316 |
306 if (merge_pass) { | 317 if (merge_pass) { |
307 // TODO(jamesr): Clean up last pass special casing. | 318 // TODO(jamesr): Clean up last pass special casing. |
308 const QuadList& quads = last_pass.quad_list; | 319 const QuadList& quads = last_pass.quad_list; |
309 | 320 |
310 // Intersect the transformed visible rect and the clip rect to create a | 321 // Intersect the transformed visible rect and the clip rect to create a |
311 // smaller cliprect for the quad. | 322 // smaller cliprect for the quad. |
312 ClipData surface_quad_clip_rect( | 323 ClipData surface_quad_clip_rect( |
313 true, MathUtil::MapEnclosingClippedRect( | 324 true, MathUtil::MapEnclosingClippedRect( |
314 surface_quad->shared_quad_state->quad_to_target_transform, | 325 surface_quad->shared_quad_state->quad_to_target_transform, |
315 surface_quad->visible_rect)); | 326 surface_quad->visible_rect)); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 void SurfaceAggregator::CopyQuadsToPass( | 416 void SurfaceAggregator::CopyQuadsToPass( |
406 const QuadList& source_quad_list, | 417 const QuadList& source_quad_list, |
407 const SharedQuadStateList& source_shared_quad_state_list, | 418 const SharedQuadStateList& source_shared_quad_state_list, |
408 const ResourceProvider::ResourceIdMap& child_to_parent_map, | 419 const ResourceProvider::ResourceIdMap& child_to_parent_map, |
409 const gfx::Transform& target_transform, | 420 const gfx::Transform& target_transform, |
410 const ClipData& clip_rect, | 421 const ClipData& clip_rect, |
411 RenderPass* dest_pass, | 422 RenderPass* dest_pass, |
412 const SurfaceId& surface_id) { | 423 const SurfaceId& surface_id) { |
413 const SharedQuadState* last_copied_source_shared_quad_state = nullptr; | 424 const SharedQuadState* last_copied_source_shared_quad_state = nullptr; |
414 const SharedQuadState* dest_shared_quad_state = nullptr; | 425 const SharedQuadState* dest_shared_quad_state = nullptr; |
415 // If the current frame has copy requests then aggregate the entire | 426 // If the current frame has copy requests or cache render surface, then |
416 // thing, as otherwise parts of the copy requests may be ignored. | 427 // aggregate the entire thing, as otherwise parts of the copy requests or |
417 const bool ignore_undamaged = aggregate_only_damaged_ && | 428 // render surface may be ignored. |
418 !has_copy_requests_ && | 429 const bool ignore_undamaged = |
419 !moved_pixel_passes_.count(dest_pass->id); | 430 aggregate_only_damaged_ && !has_copy_requests_ && |
| 431 !has_cache_render_surfaces_ && !moved_pixel_passes_.count(dest_pass->id); |
420 // Damage rect in the quad space of the current shared quad state. | 432 // Damage rect in the quad space of the current shared quad state. |
421 // TODO(jbauman): This rect may contain unnecessary area if | 433 // TODO(jbauman): This rect may contain unnecessary area if |
422 // transform isn't axis-aligned. | 434 // transform isn't axis-aligned. |
423 gfx::Rect damage_rect_in_quad_space; | 435 gfx::Rect damage_rect_in_quad_space; |
424 bool damage_rect_in_quad_space_valid = false; | 436 bool damage_rect_in_quad_space_valid = false; |
425 | 437 |
426 #if DCHECK_IS_ON() | 438 #if DCHECK_IS_ON() |
427 // If quads have come in with SharedQuadState out of order, or when quads have | 439 // If quads have come in with SharedQuadState out of order, or when quads have |
428 // invalid SharedQuadState pointer, it should DCHECK. | 440 // invalid SharedQuadState pointer, it should DCHECK. |
429 SharedQuadStateList::ConstIterator sqs_iter = | 441 SharedQuadStateList::ConstIterator sqs_iter = |
(...skipping 20 matching lines...) Expand all Loading... |
450 continue; | 462 continue; |
451 | 463 |
452 HandleSurfaceQuad(surface_quad, target_transform, clip_rect, dest_pass, | 464 HandleSurfaceQuad(surface_quad, target_transform, clip_rect, dest_pass, |
453 ignore_undamaged, &damage_rect_in_quad_space, | 465 ignore_undamaged, &damage_rect_in_quad_space, |
454 &damage_rect_in_quad_space_valid); | 466 &damage_rect_in_quad_space_valid); |
455 } else { | 467 } else { |
456 if (quad->shared_quad_state != last_copied_source_shared_quad_state) { | 468 if (quad->shared_quad_state != last_copied_source_shared_quad_state) { |
457 dest_shared_quad_state = CopySharedQuadState( | 469 dest_shared_quad_state = CopySharedQuadState( |
458 quad->shared_quad_state, target_transform, clip_rect, dest_pass); | 470 quad->shared_quad_state, target_transform, clip_rect, dest_pass); |
459 last_copied_source_shared_quad_state = quad->shared_quad_state; | 471 last_copied_source_shared_quad_state = quad->shared_quad_state; |
460 if (aggregate_only_damaged_ && !has_copy_requests_) { | 472 if (aggregate_only_damaged_ && !has_copy_requests_ && |
| 473 !has_cache_render_surfaces_) { |
461 damage_rect_in_quad_space_valid = CalculateQuadSpaceDamageRect( | 474 damage_rect_in_quad_space_valid = CalculateQuadSpaceDamageRect( |
462 dest_shared_quad_state->quad_to_target_transform, | 475 dest_shared_quad_state->quad_to_target_transform, |
463 dest_pass->transform_to_root_target, root_damage_rect_, | 476 dest_pass->transform_to_root_target, root_damage_rect_, |
464 &damage_rect_in_quad_space); | 477 &damage_rect_in_quad_space); |
465 } | 478 } |
466 } | 479 } |
467 | 480 |
468 if (ignore_undamaged) { | 481 if (ignore_undamaged) { |
469 if (damage_rect_in_quad_space_valid && | 482 if (damage_rect_in_quad_space_valid && |
470 !damage_rect_in_quad_space.Intersects(quad->visible_rect)) | 483 !damage_rect_in_quad_space.Intersects(quad->visible_rect)) |
471 continue; | 484 continue; |
472 } | 485 } |
473 | 486 |
474 DrawQuad* dest_quad; | 487 DrawQuad* dest_quad; |
475 if (quad->material == DrawQuad::RENDER_PASS) { | 488 if (quad->material == DrawQuad::RENDER_PASS) { |
476 const RenderPassDrawQuad* pass_quad = | 489 const RenderPassDrawQuad* pass_quad = |
477 RenderPassDrawQuad::MaterialCast(quad); | 490 RenderPassDrawQuad::MaterialCast(quad); |
478 int original_pass_id = pass_quad->render_pass_id; | 491 int original_pass_id = pass_quad->render_pass_id; |
479 int remapped_pass_id = RemapPassId(original_pass_id, surface_id); | 492 int remapped_pass_id = RemapPassId(original_pass_id, surface_id); |
480 | 493 if (dest_pass->cache_render_surface) { |
| 494 auto iter = passes_id_map.find(remapped_pass_id); |
| 495 if (iter != passes_id_map.end()) { |
| 496 dest_pass->has_damage_from_contributing_content |= |
| 497 iter->second->has_damage_from_contributing_content; |
| 498 } |
| 499 } |
481 dest_quad = dest_pass->CopyFromAndAppendRenderPassDrawQuad( | 500 dest_quad = dest_pass->CopyFromAndAppendRenderPassDrawQuad( |
482 pass_quad, dest_shared_quad_state, remapped_pass_id); | 501 pass_quad, dest_shared_quad_state, remapped_pass_id); |
483 } else if (quad->material == DrawQuad::TEXTURE_CONTENT) { | 502 } else if (quad->material == DrawQuad::TEXTURE_CONTENT) { |
484 const TextureDrawQuad* texture_quad = | 503 const TextureDrawQuad* texture_quad = |
485 TextureDrawQuad::MaterialCast(quad); | 504 TextureDrawQuad::MaterialCast(quad); |
486 if (texture_quad->secure_output_only && | 505 if (texture_quad->secure_output_only && |
487 (!output_is_secure_ || copy_request_passes_.count(dest_pass->id))) { | 506 (!output_is_secure_ || copy_request_passes_.count(dest_pass->id))) { |
488 SolidColorDrawQuad* solid_color_quad = | 507 SolidColorDrawQuad* solid_color_quad = |
489 dest_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 508 dest_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
490 solid_color_quad->SetNew(dest_shared_quad_state, quad->rect, | 509 solid_color_quad->SetNew(dest_shared_quad_state, quad->rect, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 RenderPass::Create(sqs_size, dq_size)); | 560 RenderPass::Create(sqs_size, dq_size)); |
542 | 561 |
543 MoveMatchingRequests(source.id, ©_requests, ©_pass->copy_requests); | 562 MoveMatchingRequests(source.id, ©_requests, ©_pass->copy_requests); |
544 | 563 |
545 RenderPassId remapped_pass_id = | 564 RenderPassId remapped_pass_id = |
546 RemapPassId(source.id, surface->surface_id()); | 565 RemapPassId(source.id, surface->surface_id()); |
547 | 566 |
548 copy_pass->SetAll(remapped_pass_id, source.output_rect, source.output_rect, | 567 copy_pass->SetAll(remapped_pass_id, source.output_rect, source.output_rect, |
549 source.transform_to_root_target, source.filters, | 568 source.transform_to_root_target, source.filters, |
550 source.background_filters, blending_color_space_, | 569 source.background_filters, blending_color_space_, |
551 source.has_transparent_background); | 570 source.has_transparent_background, |
| 571 source.cache_render_surface, |
| 572 source.has_damage_from_contributing_content); |
552 | 573 |
553 CopyQuadsToPass(source.quad_list, source.shared_quad_state_list, | 574 CopyQuadsToPass(source.quad_list, source.shared_quad_state_list, |
554 child_to_parent_map, gfx::Transform(), ClipData(), | 575 child_to_parent_map, gfx::Transform(), ClipData(), |
555 copy_pass.get(), surface->surface_id()); | 576 copy_pass.get(), surface->surface_id()); |
556 if (!copy_request_passes_.count(remapped_pass_id) && | 577 if (!copy_request_passes_.count(remapped_pass_id) && |
| 578 !cache_render_surface_passes_.count(remapped_pass_id) && |
557 !moved_pixel_passes_.count(remapped_pass_id)) { | 579 !moved_pixel_passes_.count(remapped_pass_id)) { |
558 gfx::Transform inverse_transform(gfx::Transform::kSkipInitialization); | 580 gfx::Transform inverse_transform(gfx::Transform::kSkipInitialization); |
559 if (copy_pass->transform_to_root_target.GetInverse(&inverse_transform)) { | 581 if (copy_pass->transform_to_root_target.GetInverse(&inverse_transform)) { |
560 gfx::Rect damage_rect_in_render_pass_space = | 582 gfx::Rect damage_rect_in_render_pass_space = |
561 MathUtil::ProjectEnclosingClippedRect(inverse_transform, | 583 MathUtil::ProjectEnclosingClippedRect(inverse_transform, |
562 root_damage_rect_); | 584 root_damage_rect_); |
563 copy_pass->damage_rect.Intersect(damage_rect_in_render_pass_space); | 585 copy_pass->damage_rect.Intersect(damage_rect_in_render_pass_space); |
564 } | 586 } |
565 } | 587 } |
566 | 588 |
| 589 passes_id_map.insert(std::make_pair(copy_pass->id, copy_pass.get())); |
567 dest_pass_list_->push_back(std::move(copy_pass)); | 590 dest_pass_list_->push_back(std::move(copy_pass)); |
568 } | 591 } |
569 } | 592 } |
570 | 593 |
571 void SurfaceAggregator::ProcessAddedAndRemovedSurfaces() { | 594 void SurfaceAggregator::ProcessAddedAndRemovedSurfaces() { |
572 for (const auto& surface : previous_contained_surfaces_) { | 595 for (const auto& surface : previous_contained_surfaces_) { |
573 if (!contained_surfaces_.count(surface.first)) { | 596 if (!contained_surfaces_.count(surface.first)) { |
574 // Release resources of removed surface. | 597 // Release resources of removed surface. |
575 auto it = surface_id_to_resource_child_id_.find(surface.first); | 598 auto it = surface_id_to_resource_child_id_.find(surface.first); |
576 if (it != surface_id_to_resource_child_id_.end()) { | 599 if (it != surface_id_to_resource_child_id_.end()) { |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 } | 783 } |
761 | 784 |
762 CHECK(debug_weak_this.get()); | 785 CHECK(debug_weak_this.get()); |
763 // TODO(staraz): It shouldn't need to call the callback when the damage is | 786 // TODO(staraz): It shouldn't need to call the callback when the damage is |
764 // from |surface| and not from |child_surfaces|. | 787 // from |surface| and not from |child_surfaces|. |
765 if (!damage_rect.IsEmpty()) | 788 if (!damage_rect.IsEmpty()) |
766 surface->RunWillDrawCallback(damage_rect); | 789 surface->RunWillDrawCallback(damage_rect); |
767 | 790 |
768 CHECK(debug_weak_this.get()); | 791 CHECK(debug_weak_this.get()); |
769 for (const auto& render_pass : frame.render_pass_list) { | 792 for (const auto& render_pass : frame.render_pass_list) { |
770 if (!render_pass->copy_requests.empty()) { | 793 RenderPassId remapped_pass_id = RemapPassId(render_pass->id, surface_id); |
771 RenderPassId remapped_pass_id = RemapPassId(render_pass->id, surface_id); | 794 if (!render_pass->copy_requests.empty()) |
772 copy_request_passes_.insert(remapped_pass_id); | 795 copy_request_passes_.insert(remapped_pass_id); |
773 } | 796 if (render_pass->cache_render_surface) |
| 797 cache_render_surface_passes_.insert(remapped_pass_id); |
774 } | 798 } |
775 | 799 |
776 referenced_surfaces_.erase(referenced_surfaces_.find(surface->surface_id())); | 800 referenced_surfaces_.erase(referenced_surfaces_.find(surface->surface_id())); |
777 if (!damage_rect.IsEmpty() && frame.metadata.may_contain_video) | 801 if (!damage_rect.IsEmpty() && frame.metadata.may_contain_video) |
778 result->may_contain_video = true; | 802 result->may_contain_video = true; |
779 return damage_rect; | 803 return damage_rect; |
780 } | 804 } |
781 | 805 |
782 void SurfaceAggregator::CopyUndrawnSurfaces(PrewalkResult* prewalk_result) { | 806 void SurfaceAggregator::CopyUndrawnSurfaces(PrewalkResult* prewalk_result) { |
783 // undrawn_surfaces are Surfaces that were identified by prewalk as being | 807 // undrawn_surfaces are Surfaces that were identified by prewalk as being |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 } | 840 } |
817 } else { | 841 } else { |
818 referenced_surfaces_.insert(surface_id); | 842 referenced_surfaces_.insert(surface_id); |
819 CopyPasses(frame, surface); | 843 CopyPasses(frame, surface); |
820 // CopyPasses may have mutated container, need to re-query to erase. | 844 // CopyPasses may have mutated container, need to re-query to erase. |
821 referenced_surfaces_.erase(referenced_surfaces_.find(surface_id)); | 845 referenced_surfaces_.erase(referenced_surfaces_.find(surface_id)); |
822 } | 846 } |
823 } | 847 } |
824 } | 848 } |
825 | 849 |
826 void SurfaceAggregator::PropagateCopyRequestPasses() { | 850 void SurfaceAggregator::PropagatePasses(base::flat_set<RenderPassId>* passes) { |
827 std::vector<RenderPassId> copy_requests_to_iterate( | 851 std::vector<RenderPassId> passes_to_iterate(passes->begin(), passes->end()); |
828 copy_request_passes_.begin(), copy_request_passes_.end()); | 852 while (!passes_to_iterate.empty()) { |
829 while (!copy_requests_to_iterate.empty()) { | 853 RenderPassId first = passes_to_iterate.back(); |
830 int first = copy_requests_to_iterate.back(); | 854 passes_to_iterate.pop_back(); |
831 copy_requests_to_iterate.pop_back(); | |
832 auto it = render_pass_dependencies_.find(first); | 855 auto it = render_pass_dependencies_.find(first); |
833 if (it == render_pass_dependencies_.end()) | 856 if (it == render_pass_dependencies_.end()) |
834 continue; | 857 continue; |
835 for (auto pass : it->second) { | 858 for (auto pass : it->second) { |
836 if (copy_request_passes_.insert(pass).second) { | 859 if (passes->insert(pass).second) { |
837 copy_requests_to_iterate.push_back(pass); | 860 passes_to_iterate.push_back(pass); |
838 } | 861 } |
839 } | 862 } |
840 } | 863 } |
841 } | 864 } |
842 | 865 |
843 CompositorFrame SurfaceAggregator::Aggregate(const SurfaceId& surface_id) { | 866 CompositorFrame SurfaceAggregator::Aggregate(const SurfaceId& surface_id) { |
844 uma_stats_.Reset(); | 867 uma_stats_.Reset(); |
845 | 868 |
846 Surface* surface = manager_->GetSurfaceForId(surface_id); | 869 Surface* surface = manager_->GetSurfaceForId(surface_id); |
847 DCHECK(surface); | 870 DCHECK(surface); |
848 contained_surfaces_[surface_id] = surface->frame_index(); | 871 contained_surfaces_[surface_id] = surface->frame_index(); |
849 | 872 |
850 if (!surface->HasActiveFrame()) | 873 if (!surface->HasActiveFrame()) |
851 return CompositorFrame(); | 874 return CompositorFrame(); |
852 | 875 |
853 const CompositorFrame& root_surface_frame = surface->GetActiveFrame(); | 876 const CompositorFrame& root_surface_frame = surface->GetActiveFrame(); |
854 TRACE_EVENT0("cc", "SurfaceAggregator::Aggregate"); | 877 TRACE_EVENT0("cc", "SurfaceAggregator::Aggregate"); |
855 | 878 |
856 CompositorFrame frame; | 879 CompositorFrame frame; |
857 | 880 |
858 dest_pass_list_ = &frame.render_pass_list; | 881 dest_pass_list_ = &frame.render_pass_list; |
859 | 882 |
860 valid_surfaces_.clear(); | 883 valid_surfaces_.clear(); |
861 PrewalkResult prewalk_result; | 884 PrewalkResult prewalk_result; |
862 root_damage_rect_ = PrewalkTree(surface_id, false, 0, &prewalk_result); | 885 root_damage_rect_ = PrewalkTree(surface_id, false, 0, &prewalk_result); |
863 PropagateCopyRequestPasses(); | 886 PropagatePasses(©_request_passes_); |
| 887 PropagatePasses(&cache_render_surface_passes_); |
864 has_copy_requests_ = !copy_request_passes_.empty(); | 888 has_copy_requests_ = !copy_request_passes_.empty(); |
| 889 has_cache_render_surfaces_ = !cache_render_surface_passes_.empty(); |
865 frame.metadata.may_contain_video = prewalk_result.may_contain_video; | 890 frame.metadata.may_contain_video = prewalk_result.may_contain_video; |
866 | 891 |
867 CopyUndrawnSurfaces(&prewalk_result); | 892 CopyUndrawnSurfaces(&prewalk_result); |
868 referenced_surfaces_.insert(surface_id); | 893 referenced_surfaces_.insert(surface_id); |
869 CopyPasses(root_surface_frame, surface); | 894 CopyPasses(root_surface_frame, surface); |
870 // CopyPasses may have mutated container, need to re-query to erase. | 895 // CopyPasses may have mutated container, need to re-query to erase. |
871 referenced_surfaces_.erase(referenced_surfaces_.find(surface_id)); | 896 referenced_surfaces_.erase(referenced_surfaces_.find(surface_id)); |
872 AddColorConversionPass(); | 897 AddColorConversionPass(); |
873 | 898 |
874 moved_pixel_passes_.clear(); | 899 moved_pixel_passes_.clear(); |
875 copy_request_passes_.clear(); | 900 copy_request_passes_.clear(); |
| 901 cache_render_surface_passes_.clear(); |
876 render_pass_dependencies_.clear(); | 902 render_pass_dependencies_.clear(); |
877 | 903 |
878 // Remove all render pass mappings that weren't used in the current frame. | 904 // Remove all render pass mappings that weren't used in the current frame. |
879 for (auto it = render_pass_allocator_map_.begin(); | 905 for (auto it = render_pass_allocator_map_.begin(); |
880 it != render_pass_allocator_map_.end();) { | 906 it != render_pass_allocator_map_.end();) { |
881 if (it->second.in_use) { | 907 if (it->second.in_use) { |
882 it->second.in_use = false; | 908 it->second.in_use = false; |
883 it++; | 909 it++; |
884 } else { | 910 } else { |
885 it = render_pass_allocator_map_.erase(it); | 911 it = render_pass_allocator_map_.erase(it); |
886 } | 912 } |
887 } | 913 } |
888 | 914 |
889 DCHECK(referenced_surfaces_.empty()); | 915 DCHECK(referenced_surfaces_.empty()); |
890 | 916 |
891 if (dest_pass_list_->empty()) | 917 if (dest_pass_list_->empty()) |
892 return CompositorFrame(); | 918 return CompositorFrame(); |
893 | 919 |
894 dest_pass_list_ = NULL; | 920 dest_pass_list_ = NULL; |
| 921 passes_id_map.clear(); |
895 ProcessAddedAndRemovedSurfaces(); | 922 ProcessAddedAndRemovedSurfaces(); |
896 contained_surfaces_.swap(previous_contained_surfaces_); | 923 contained_surfaces_.swap(previous_contained_surfaces_); |
897 contained_surfaces_.clear(); | 924 contained_surfaces_.clear(); |
898 | 925 |
899 for (auto it : previous_contained_surfaces_) { | 926 for (auto it : previous_contained_surfaces_) { |
900 Surface* surface = manager_->GetSurfaceForId(it.first); | 927 Surface* surface = manager_->GetSurfaceForId(it.first); |
901 if (surface) | 928 if (surface) |
902 surface->TakeLatencyInfo(&frame.metadata.latency_info); | 929 surface->TakeLatencyInfo(&frame.metadata.latency_info); |
903 } | 930 } |
904 | 931 |
(...skipping 29 matching lines...) Expand all Loading... |
934 } | 961 } |
935 | 962 |
936 void SurfaceAggregator::SetOutputColorSpace( | 963 void SurfaceAggregator::SetOutputColorSpace( |
937 const gfx::ColorSpace& blending_color_space, | 964 const gfx::ColorSpace& blending_color_space, |
938 const gfx::ColorSpace& output_color_space) { | 965 const gfx::ColorSpace& output_color_space) { |
939 blending_color_space_ = blending_color_space; | 966 blending_color_space_ = blending_color_space; |
940 output_color_space_ = output_color_space; | 967 output_color_space_ = output_color_space; |
941 } | 968 } |
942 | 969 |
943 } // namespace cc | 970 } // namespace cc |
OLD | NEW |