Chromium Code Reviews| Index: components/viz/service/display/surface_aggregator.cc |
| diff --git a/components/viz/service/display/surface_aggregator.cc b/components/viz/service/display/surface_aggregator.cc |
| index 4e1698d47613c5f605bad661703a0f3dbd279538..2e0c51b341317c1fdf14c862a2ce4feb2df3eed2 100644 |
| --- a/components/viz/service/display/surface_aggregator.cc |
| +++ b/components/viz/service/display/surface_aggregator.cc |
| @@ -265,7 +265,9 @@ void SurfaceAggregator::HandleSurfaceQuad( |
| copy_pass->SetAll(remapped_pass_id, source.output_rect, source.output_rect, |
| source.transform_to_root_target, source.filters, |
| source.background_filters, blending_color_space_, |
| - source.has_transparent_background); |
| + source.has_transparent_background, |
| + source.cache_render_surface, |
| + source.has_damage_from_contributing_content); |
| MoveMatchingRequests(source.id, ©_requests, ©_pass->copy_requests); |
| @@ -283,6 +285,7 @@ void SurfaceAggregator::HandleSurfaceQuad( |
| copy_pass.get(), surface_id); |
| if (!copy_request_passes_.count(remapped_pass_id) && |
| + !copy_pass->cache_render_surface && |
|
danakj
2017/07/25 18:55:02
I feel that each of these 3 conditions needs a com
wutao
2017/07/26 07:48:52
Do not need this change anymore.
But I try to exp
wutao
2017/07/27 02:30:13
Added comments.
|
| !moved_pixel_passes_.count(remapped_pass_id)) { |
| gfx::Transform inverse_transform(gfx::Transform::kSkipInitialization); |
| if (copy_pass->transform_to_root_target.GetInverse(&inverse_transform)) { |
| @@ -301,6 +304,17 @@ void SurfaceAggregator::HandleSurfaceQuad( |
| surface_transform.ConcatTransform(target_transform); |
| const auto& last_pass = *render_pass_list.back(); |
| + // This will check if all the surface_quads (including child surfaces) has |
| + // damage because HandleSurfaceQuad is a recursive call by calling |
| + // CopyQuadsToPass in it. This is different than the damage_rect calculated in |
|
danakj
2017/07/25 18:55:03
I'm not clear why this is talking about Prewalk tr
wutao
2017/07/26 07:48:52
I should mention Prewalk here. I did just because
|
| + // PrewalkTree, which also includes all the damage in the top level surface, |
| + // containing damage from damage_tracker. |
|
danakj
2017/07/25 18:55:03
"containing damage specified with the CompositorFr
wutao
2017/07/26 07:48:52
Deleted comments related to PrewalkTree.
|
| + if (dest_pass->cache_render_surface) { |
| + dest_pass->has_damage_from_contributing_content |= |
|
jbauman
2017/07/25 20:40:34
Suppose we have a
Surface 1 with damage, and a sur
wutao
2017/07/26 07:48:53
Yes. we should set the flag. You example makes me
|
| + !DamageRectForSurface(surface, last_pass, last_pass.output_rect) |
| + .IsEmpty(); |
| + } |
| + |
| if (merge_pass) { |
| // TODO(jamesr): Clean up last pass special casing. |
| const cc::QuadList& quads = last_pass.quad_list; |
| @@ -410,11 +424,11 @@ void SurfaceAggregator::CopyQuadsToPass( |
| const SurfaceId& surface_id) { |
| const cc::SharedQuadState* last_copied_source_shared_quad_state = nullptr; |
| const cc::SharedQuadState* dest_shared_quad_state = nullptr; |
| - // If the current frame has copy requests then aggregate the entire |
| - // thing, as otherwise parts of the copy requests may be ignored. |
| - const bool ignore_undamaged = aggregate_only_damaged_ && |
| - !has_copy_requests_ && |
| - !moved_pixel_passes_.count(dest_pass->id); |
| + // If the current frame has copy requests or cache render surface, then |
| + // aggregate the entire thing, because we want full content. |
|
danakj
2017/07/25 18:55:02
I think this comment is saying what we want as the
jbauman
2017/07/25 20:40:34
I think if the renderpass is partially offscreen i
wutao
2017/07/26 07:48:53
We do not need this change any more for cache rend
wutao
2017/07/27 02:30:13
Yes, if the render pass is off screen, then it is
danakj
2017/07/27 21:24:33
Thanks!
|
| + const bool ignore_undamaged = |
| + aggregate_only_damaged_ && !has_copy_requests_ && |
| + !has_cached_render_surfaces_ && !moved_pixel_passes_.count(dest_pass->id); |
| // Damage rect in the quad space of the current shared quad state. |
| // TODO(jbauman): This rect may contain unnecessary area if |
| // transform isn't axis-aligned. |
| @@ -455,7 +469,8 @@ void SurfaceAggregator::CopyQuadsToPass( |
| dest_shared_quad_state = CopySharedQuadState( |
| quad->shared_quad_state, target_transform, clip_rect, dest_pass); |
| last_copied_source_shared_quad_state = quad->shared_quad_state; |
| - if (aggregate_only_damaged_ && !has_copy_requests_) { |
| + if (aggregate_only_damaged_ && !has_copy_requests_ && |
| + !has_cached_render_surfaces_) { |
| damage_rect_in_quad_space_valid = CalculateQuadSpaceDamageRect( |
| dest_shared_quad_state->quad_to_target_transform, |
| dest_pass->transform_to_root_target, root_damage_rect_, |
| @@ -474,7 +489,6 @@ void SurfaceAggregator::CopyQuadsToPass( |
| const auto* pass_quad = cc::RenderPassDrawQuad::MaterialCast(quad); |
| int original_pass_id = pass_quad->render_pass_id; |
| int remapped_pass_id = RemapPassId(original_pass_id, surface_id); |
| - |
| dest_quad = dest_pass->CopyFromAndAppendRenderPassDrawQuad( |
| pass_quad, dest_shared_quad_state, remapped_pass_id); |
| } else if (quad->material == cc::DrawQuad::TEXTURE_CONTENT) { |
| @@ -542,12 +556,15 @@ void SurfaceAggregator::CopyPasses(const cc::CompositorFrame& frame, |
| copy_pass->SetAll(remapped_pass_id, source.output_rect, source.output_rect, |
| source.transform_to_root_target, source.filters, |
| source.background_filters, blending_color_space_, |
| - source.has_transparent_background); |
| + source.has_transparent_background, |
| + source.cache_render_surface, |
| + source.has_damage_from_contributing_content); |
| CopyQuadsToPass(source.quad_list, source.shared_quad_state_list, |
| child_to_parent_map, gfx::Transform(), ClipData(), |
| copy_pass.get(), surface->surface_id()); |
| if (!copy_request_passes_.count(remapped_pass_id) && |
| + !copy_pass->cache_render_surface && |
|
danakj
2017/07/25 18:55:03
I also think each of these needs the same comments
wutao
2017/07/26 07:48:53
Do not need this any more.
wutao
2017/07/27 02:30:13
Added comments.
|
| !moved_pixel_passes_.count(remapped_pass_id)) { |
| gfx::Transform inverse_transform(gfx::Transform::kSkipInitialization); |
| if (copy_pass->transform_to_root_target.GetInverse(&inverse_transform)) { |
| @@ -761,11 +778,12 @@ gfx::Rect SurfaceAggregator::PrewalkTree(const SurfaceId& surface_id, |
| CHECK(debug_weak_this.get()); |
| for (const auto& render_pass : frame.render_pass_list) { |
| - if (!render_pass->copy_requests.empty()) { |
| - cc::RenderPassId remapped_pass_id = |
| - RemapPassId(render_pass->id, surface_id); |
| + cc::RenderPassId remapped_pass_id = |
| + RemapPassId(render_pass->id, surface_id); |
| + if (!render_pass->copy_requests.empty()) |
| copy_request_passes_.insert(remapped_pass_id); |
| - } |
| + if (render_pass->cache_render_surface) |
| + cached_render_surface_passes_.insert(remapped_pass_id); |
| } |
| referenced_surfaces_.erase(referenced_surfaces_.find(surface->surface_id())); |
| @@ -857,6 +875,7 @@ cc::CompositorFrame SurfaceAggregator::Aggregate(const SurfaceId& surface_id) { |
| root_damage_rect_ = PrewalkTree(surface_id, false, 0, &prewalk_result); |
| PropagateCopyRequestPasses(); |
| has_copy_requests_ = !copy_request_passes_.empty(); |
| + has_cached_render_surfaces_ = !cached_render_surface_passes_.empty(); |
| frame.metadata.may_contain_video = prewalk_result.may_contain_video; |
| CopyUndrawnSurfaces(&prewalk_result); |
| @@ -868,6 +887,7 @@ cc::CompositorFrame SurfaceAggregator::Aggregate(const SurfaceId& surface_id) { |
| moved_pixel_passes_.clear(); |
| copy_request_passes_.clear(); |
| + cached_render_surface_passes_.clear(); |
| render_pass_dependencies_.clear(); |
| // Remove all render pass mappings that weren't used in the current frame. |