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