Commit eb0f24d5 authored by yjliu's avatar yjliu Committed by Commit Bot

Backdrop cache flag should exclude damage from the same render surface.

When setting the |can_use_backdrop_filter_cached_result| flag, we do
intersection check between the render surface's content rect and current
accumulated damage. This damage should not include the damage on the
same render surface.

This bug was causing ChromeOS window cycling not using backdrop cache
when there's no damage under the cycling container.

Bug: 1141712
Change-Id: I4acb988d109beadf0507fddf98bdbbc881e6bef4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2498646Reviewed-by: default avatarweiliangc <weiliangc@chromium.org>
Commit-Queue: Jun Liu <yjliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821579}
parent 801b4e63
......@@ -435,6 +435,21 @@ void DamageTracker::AccumulateDamageFromRenderSurface(
gfx::ToEnclosingRect(render_surface->DrawableContentRect());
data.Update(surface_rect_in_target_space, mailboxId_);
const FilterOperations& backdrop_filters = render_surface->BackdropFilters();
if (!surface_is_new &&
backdrop_filters.HasFilterOfType(FilterOperation::BLUR)) {
gfx::Rect damage_on_target;
bool valid = damage_for_this_update_.GetAsRect(&damage_on_target);
if (!valid || damage_on_target.Intersects(surface_rect_in_target_space)) {
render_surface->set_can_use_cached_backdrop_filtered_result(false);
} else {
surfaces_with_backdrop_blur_filter.emplace_back(
std::make_pair(render_surface, surface_rect_in_target_space));
}
} else {
render_surface->set_can_use_cached_backdrop_filtered_result(false);
}
if (surface_is_new || render_surface->SurfacePropertyChanged()) {
// The entire surface contributes damage.
damage_for_this_update_.Union(surface_rect_in_target_space);
......@@ -460,21 +475,6 @@ void DamageTracker::AccumulateDamageFromRenderSurface(
}
}
const FilterOperations& backdrop_filters = render_surface->BackdropFilters();
if (!surface_is_new &&
backdrop_filters.HasFilterOfType(FilterOperation::BLUR)) {
gfx::Rect damage_on_target;
bool valid = damage_for_this_update_.GetAsRect(&damage_on_target);
if (!valid || damage_on_target.Intersects(surface_rect_in_target_space)) {
render_surface->set_can_use_cached_backdrop_filtered_result(false);
} else {
surfaces_with_backdrop_blur_filter.push_back(
std::make_pair(render_surface, surface_rect_in_target_space));
}
} else {
render_surface->set_can_use_cached_backdrop_filtered_result(false);
}
// True if any changes from contributing render surface.
has_damage_from_contributing_content_ |= !damage_for_this_update_.IsEmpty();
}
......
......@@ -2059,7 +2059,8 @@ TEST_F(DamageTrackerTest, CanUseCachedBackdropFilterResultTest) {
GetRenderSurface(child1_)->can_use_cached_backdrop_filtered_result());
EmulateDrawingOneFrame(root);
EXPECT_FALSE(
// No change under child1_.
EXPECT_TRUE(
GetRenderSurface(child1_)->can_use_cached_backdrop_filtered_result());
// Let run for one update and there should be no damage left.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment