Commit fc4125b0 authored by Jeffrey Kardatzke's avatar Jeffrey Kardatzke Committed by Chromium LUCI CQ

viz: Skip compositing of quads that require overlay

Quads that require an overlay cannot be properly composited. This
replaces those quads with solid black. This will fix animations,
multiple protected videos and other cases that were trying to
composite protected video.

Also contains a few other required overlay fixes:
-fixes overlay prioritization sort for required overlays so the sort
is stable between them
-skips empty quads for overlays

BUG=b:155511837
TEST=Window and rotation animations no longer display encrypted content
when playing protected video on volteer

Change-Id: Ibd9b812e23e798aa80034862d2d957809bb0fe09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2616743
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842239}
parent 73320317
......@@ -26,6 +26,7 @@
#include "components/viz/common/quads/aggregated_render_pass_draw_quad.h"
#include "components/viz/common/quads/compositor_render_pass_draw_quad.h"
#include "components/viz/common/quads/draw_quad.h"
#include "components/viz/common/quads/solid_color_draw_quad.h"
#include "components/viz/service/display/bsp_tree.h"
#include "components/viz/service/display/bsp_walk_action.h"
#include "components/viz/service/display/output_surface.h"
......@@ -688,6 +689,16 @@ void DirectRenderer::DrawRenderPass(const AggregatedRenderPass* render_pass) {
SetScissorStateForQuad(quad, render_pass_scissor_in_draw_space,
render_pass_requires_scissor);
if (OverlayCandidate::RequiresOverlay(&quad)) {
// We cannot composite this quad properly, replace it with solid black.
SolidColorDrawQuad solid_black;
solid_black.SetAll(quad.shared_quad_state, quad.rect, quad.rect,
/*needs_blending=*/false, SK_ColorBLACK,
/*force_anti_aliasing_off=*/true);
DoDrawQuad(&solid_black, nullptr);
continue;
}
DoDrawQuad(&quad, nullptr);
}
FlushPolygons(&poly_list, render_pass_scissor_in_draw_space,
......
......@@ -305,6 +305,8 @@ bool OverlayCandidate::FromDrawQuadResource(
OverlayCandidate* candidate) {
if (!resource_provider->IsOverlayCandidate(resource_id))
return false;
if (quad->visible_rect.IsEmpty())
return false;
candidate->format = resource_provider->GetBufferFormat(resource_id);
candidate->color_space = resource_provider->GetColorSpace(resource_id);
......
......@@ -326,9 +326,9 @@ void OverlayProcessorUsingStrategy::SortProposedOverlayCandidatesPrioritized(
// DRM/CDM HW overlay required:
// This comparison is for correctness over performance reasons. Some
// candidates must be an HW overlay to function. If both require an HW
// overlay we sort on the remaining criteria below.
if (a.candidate.requires_overlay ^ b.candidate.requires_overlay) {
return a.candidate.requires_overlay;
// overlay we leave them in order so the topmost one gets the overlay.
if (a.candidate.requires_overlay || b.candidate.requires_overlay) {
return a.candidate.requires_overlay && !b.candidate.requires_overlay;
}
// Opaque Power Metric:
......
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