Commit 8ec016ed authored by Fritz Koenig's avatar Fritz Koenig Committed by Commit Bot

viz : Update damage tracking for underlays

Make sure to damage the previous underlay area
when switching underlays so that it is repainted.

BUG=854790
TEST=UnderlayTest.UpdateDamageWhenChangingUnderlays

Change-Id: Idec0e30e0cf65e4937f85dfd3bdfd9ba4120d5fe
Reviewed-on: https://chromium-review.googlesource.com/1161393
Commit-Queue: Fritz Koenig <frkoenig@chromium.org>
Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580957}
parent e9a02078
......@@ -189,8 +189,7 @@ void OverlayProcessor::ProcessForOverlays(
// Also subtract unoccluded underlays from the damage rect if we know that the
// same underlay was scheduled on the previous frame. If the renderer decides
// not to swap the framebuffer there will still be a transparent hole in the
// previous frame. This only handles the common case of a single underlay quad
// for fullscreen video.
// previous frame.
void OverlayProcessor::UpdateDamageRect(
OverlayCandidateList* candidates,
const gfx::Rect& previous_frame_underlay_rect,
......@@ -209,13 +208,26 @@ void OverlayProcessor::UpdateDamageRect(
if (overlay.is_opaque)
damage_rect->Subtract(overlay_display_rect);
}
} else if (overlay.is_unoccluded && this_frame_underlay_rect.IsEmpty()) {
} else if (this_frame_underlay_rect.IsEmpty()) {
// Process underlay candidates:
// Track the underlay_rect from frame to frame. If it is the same
// and nothing is on top of it then that rect doesn't need to
// be damaged because the drawing is occurring on a different plane.
// If it is different then that indicates that a different underlay
// has been chosen and the previous underlay rect should be damaged
// because it has changed planes from the underlay plane to the
// main plane.
this_frame_underlay_rect = ToEnclosedRect(overlay.display_rect);
if ((this_frame_underlay_rect == previous_frame_underlay_rect) &&
overlay.is_unoccluded) {
damage_rect->Subtract(this_frame_underlay_rect);
}
}
}
if (this_frame_underlay_rect == previous_frame_underlay_rect)
damage_rect->Subtract(this_frame_underlay_rect);
if (this_frame_underlay_rect != previous_frame_underlay_rect)
damage_rect->Union(previous_frame_underlay_rect);
previous_frame_underlay_rect_ = this_frame_underlay_rect;
damage_rect->Union(output_surface_overlay_damage_rect);
......
......@@ -1893,6 +1893,39 @@ TEST_F(UnderlayTest, PrimaryPlaneOverlayIsTransparentWithUnderlay) {
ASSERT_EQ(false, candidate_list[0].is_opaque);
}
TEST_F(UnderlayTest, UpdateDamageWhenChangingUnderlays) {
output_surface_->GetOverlayCandidateValidator()->AddExpectedRect(
gfx::RectF(kOverlayTopLeftRect));
for (size_t i = 0; i < 2; ++i) {
std::unique_ptr<RenderPass> pass = CreateRenderPass();
if (i == 0) {
CreateCandidateQuadAt(
resource_provider_.get(), child_resource_provider_.get(),
child_provider_.get(), pass->shared_quad_state_list.back(),
pass.get(), kOverlayRect);
}
CreateCandidateQuadAt(resource_provider_.get(),
child_resource_provider_.get(), child_provider_.get(),
pass->shared_quad_state_list.back(), pass.get(),
kOverlayTopLeftRect);
OverlayCandidateList candidate_list;
OverlayProcessor::FilterOperationsMap render_pass_filters;
OverlayProcessor::FilterOperationsMap render_pass_background_filters;
RenderPassList pass_list;
pass_list.push_back(std::move(pass));
overlay_processor_->ProcessForOverlays(
resource_provider_.get(), &pass_list, GetIdentityColorMatrix(),
render_pass_filters, render_pass_background_filters, &candidate_list,
nullptr, nullptr, &damage_rect_, &content_bounds_);
}
EXPECT_EQ(kOverlayRect, damage_rect_);
}
TEST_F(UnderlayCastTest, NoOverlayContentBounds) {
std::unique_ptr<RenderPass> pass = CreateRenderPass();
......
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