Commit af9e865e authored by Daniel Nicoara's avatar Daniel Nicoara Committed by Commit Bot

Change primary plane candidate to transparent when underlay is found

If the output surface is displayed as an overlay plane and there is a
video underlay, make the primary plane blend with the underlay such that
the transparent video hole in the primary plane allows the video to
show.

Bug: b/74998539
Test: Ran on device and verified video shows
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel
Change-Id: I01fd6c325dd2e93f7781fbbf1619bca402998217
Reviewed-on: https://chromium-review.googlesource.com/1005808Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Reviewed-by: default avatarSergey Volk <servolk@chromium.org>
Commit-Queue: Daniel Nicoara <dnicoara@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550474}
parent 316c04d2
...@@ -63,6 +63,14 @@ bool OverlayStrategyUnderlayCast::Attempt( ...@@ -63,6 +63,14 @@ bool OverlayStrategyUnderlayCast::Attempt(
} }
if (found_underlay) { if (found_underlay) {
// If the primary plane shows up in the candidates list make sure it isn't
// opaque otherwise the video underlay won't be visible.
if (!candidate_list->empty()) {
DCHECK_EQ(1u, candidate_list->size());
DCHECK(candidate_list->front().use_output_surface_for_resource);
candidate_list->front().is_opaque = false;
}
for (auto it = quad_list.begin(); it != quad_list.end(); ++it) { for (auto it = quad_list.begin(); it != quad_list.end(); ++it) {
cc::OverlayCandidate candidate; cc::OverlayCandidate candidate;
if (!cc::OverlayCandidate::FromDrawQuad( if (!cc::OverlayCandidate::FromDrawQuad(
......
...@@ -1883,6 +1883,37 @@ TEST_F(UnderlayCastTest, RoundContentBounds) { ...@@ -1883,6 +1883,37 @@ TEST_F(UnderlayCastTest, RoundContentBounds) {
EXPECT_EQ(kOverlayRect, content_bounds_[0]); EXPECT_EQ(kOverlayRect, content_bounds_[0]);
} }
TEST_F(UnderlayCastTest, PrimaryPlaneOverlayIsTransparentWithUnderlay) {
std::unique_ptr<RenderPass> pass = CreateRenderPass();
gfx::Rect output_rect = pass->output_rect;
CreateOpaqueQuadAt(resource_provider_.get(),
pass->shared_quad_state_list.back(), pass.get(),
output_rect, SK_ColorWHITE);
CreateCandidateQuadAt(
resource_provider_.get(), child_resource_provider_.get(),
pass->shared_quad_state_list.back(), pass.get(), kOverlayRect);
cc::OverlayCandidateList candidate_list;
cc::OverlayCandidate candidate;
candidate.use_output_surface_for_resource = true;
candidate.is_opaque = true;
candidate_list.push_back(candidate);
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_);
ASSERT_EQ(false, candidate_list[0].is_opaque);
EXPECT_EQ(1U, content_bounds_.size());
EXPECT_EQ(output_rect, content_bounds_[0]);
}
cc::OverlayCandidateList BackbufferOverlayList( cc::OverlayCandidateList BackbufferOverlayList(
const RenderPass* root_render_pass) { const RenderPass* root_render_pass) {
cc::OverlayCandidateList list; cc::OverlayCandidateList list;
......
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