Commit 5f26315f authored by dcastagna's avatar dcastagna Committed by Commit bot

cc: Don't subtract transparent overlay from damage.

After processing overlay candidates we used to remove the overlay rects
from the damage rect.
The assumption was that all the overlays would be opaque.

Since we started allowing alpha blended overaly, we should avoid
subtracting from the damage when blending might be allowed.
Otherwise any element animating below a transparent overlay might
not be updated.

We haven't noticed any problem so far since partial update was disabled
on Mali. crrev.com/2829543003 enables empty swap, surfacing the problem
when the damage region is a subset of a transparent overlay.

BUG=705290
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Review-Url: https://codereview.chromium.org/2842383003
Cr-Commit-Position: refs/heads/master@{#467727}
parent 81369708
...@@ -176,6 +176,7 @@ OverlayCandidate::OverlayCandidate() ...@@ -176,6 +176,7 @@ OverlayCandidate::OverlayCandidate()
format(gfx::BufferFormat::RGBA_8888), format(gfx::BufferFormat::RGBA_8888),
uv_rect(0.f, 0.f, 1.f, 1.f), uv_rect(0.f, 0.f, 1.f, 1.f),
is_clipped(false), is_clipped(false),
is_opaque(false),
use_output_surface_for_resource(false), use_output_surface_for_resource(false),
resource_id(0), resource_id(0),
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
...@@ -211,6 +212,7 @@ bool OverlayCandidate::FromDrawQuad(ResourceProvider* resource_provider, ...@@ -211,6 +212,7 @@ bool OverlayCandidate::FromDrawQuad(ResourceProvider* resource_provider,
candidate->clip_rect = quad->shared_quad_state->clip_rect; candidate->clip_rect = quad->shared_quad_state->clip_rect;
candidate->is_clipped = quad->shared_quad_state->is_clipped; candidate->is_clipped = quad->shared_quad_state->is_clipped;
candidate->is_opaque = !quad->ShouldDrawWithBlending();
switch (quad->material) { switch (quad->material) {
case DrawQuad::TEXTURE_CONTENT: case DrawQuad::TEXTURE_CONTENT:
......
...@@ -67,6 +67,8 @@ class CC_EXPORT OverlayCandidate { ...@@ -67,6 +67,8 @@ class CC_EXPORT OverlayCandidate {
gfx::Rect clip_rect; gfx::Rect clip_rect;
// If the quad is clipped after composition. // If the quad is clipped after composition.
bool is_clipped; bool is_clipped;
// If the quad doesn't require blending.
bool is_opaque;
// True if the texture for this overlay should be the same one used by the // True if the texture for this overlay should be the same one used by the
// output surface's main overlay. // output surface's main overlay.
bool use_output_surface_for_resource; bool use_output_surface_for_resource;
......
...@@ -163,7 +163,7 @@ void OverlayProcessor::ProcessForOverlays( ...@@ -163,7 +163,7 @@ void OverlayProcessor::ProcessForOverlays(
} }
} }
// Subtract on-top overlays from the damage rect, unless the overlays use // Subtract on-top opaque overlays from the damage rect, unless the overlays use
// the backbuffer as their content (in which case, add their combined rect // the backbuffer as their content (in which case, add their combined rect
// back to the damage at the end). // back to the damage at the end).
// Also subtract unoccluded underlays from the damage rect if we know that the // Also subtract unoccluded underlays from the damage rect if we know that the
...@@ -176,7 +176,7 @@ void OverlayProcessor::UpdateDamageRect(OverlayCandidateList* candidates, ...@@ -176,7 +176,7 @@ void OverlayProcessor::UpdateDamageRect(OverlayCandidateList* candidates,
gfx::Rect output_surface_overlay_damage_rect; gfx::Rect output_surface_overlay_damage_rect;
gfx::Rect this_frame_underlay_rect; gfx::Rect this_frame_underlay_rect;
for (const OverlayCandidate& overlay : *candidates) { for (const OverlayCandidate& overlay : *candidates) {
if (overlay.plane_z_order > 0) { if (overlay.plane_z_order > 0 && overlay.is_opaque) {
const gfx::Rect overlay_display_rect = const gfx::Rect overlay_display_rect =
ToEnclosedRect(overlay.display_rect); ToEnclosedRect(overlay.display_rect);
overlay_damage_rect_.Union(overlay_display_rect); overlay_damage_rect_.Union(overlay_display_rect);
......
...@@ -757,7 +757,7 @@ TEST_F(SingleOverlayOnTopTest, DamageRect) { ...@@ -757,7 +757,7 @@ TEST_F(SingleOverlayOnTopTest, DamageRect) {
resource_provider_.get(), pass.get(), render_pass_filters, resource_provider_.get(), pass.get(), render_pass_filters,
render_pass_background_filters, &candidate_list, nullptr, nullptr, render_pass_background_filters, &candidate_list, nullptr, nullptr,
&damage_rect_, &content_bounds_); &damage_rect_, &content_bounds_);
DCHECK(damage_rect_.IsEmpty()); EXPECT_TRUE(damage_rect_.IsEmpty());
} }
TEST_F(SingleOverlayOnTopTest, NoCandidates) { TEST_F(SingleOverlayOnTopTest, NoCandidates) {
...@@ -850,11 +850,13 @@ TEST_F(SingleOverlayOnTopTest, AcceptBlending) { ...@@ -850,11 +850,13 @@ TEST_F(SingleOverlayOnTopTest, AcceptBlending) {
OverlayCandidateList candidate_list; OverlayCandidateList candidate_list;
base::flat_map<int, FilterOperations*> render_pass_filters; base::flat_map<int, FilterOperations*> render_pass_filters;
base::flat_map<int, FilterOperations*> render_pass_background_filters; base::flat_map<int, FilterOperations*> render_pass_background_filters;
damage_rect_ = quad->rect;
overlay_processor_->ProcessForOverlays( overlay_processor_->ProcessForOverlays(
resource_provider_.get(), pass.get(), render_pass_filters, resource_provider_.get(), pass.get(), render_pass_filters,
render_pass_background_filters, &candidate_list, nullptr, nullptr, render_pass_background_filters, &candidate_list, nullptr, nullptr,
&damage_rect_, &content_bounds_); &damage_rect_, &content_bounds_);
EXPECT_EQ(1U, candidate_list.size()); EXPECT_EQ(1U, candidate_list.size());
EXPECT_FALSE(damage_rect_.IsEmpty());
} }
TEST_F(SingleOverlayOnTopTest, RejectBackgroundColor) { TEST_F(SingleOverlayOnTopTest, RejectBackgroundColor) {
......
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