Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Unified Diff: cc/output/overlay_strategy_single_on_top.cc

Issue 2749783006: cc: Enable non-opaque harware overlays. (Closed)
Patch Set: Blank lines! Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/overlay_strategy_fullscreen.cc ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/overlay_strategy_single_on_top.cc
diff --git a/cc/output/overlay_strategy_single_on_top.cc b/cc/output/overlay_strategy_single_on_top.cc
index f55a4350d6a327c053669b89ab78ce97401dc0ed..0cc5d998564c1fd3b16f45010a00114e4d155afb 100644
--- a/cc/output/overlay_strategy_single_on_top.cc
+++ b/cc/output/overlay_strategy_single_on_top.cc
@@ -7,9 +7,15 @@
#include "cc/base/math_util.h"
#include "cc/output/overlay_candidate_validator.h"
#include "cc/quads/draw_quad.h"
+#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/rect_conversions.h"
namespace cc {
+namespace {
+
+const gfx::BufferFormat kOverlayFormatsWithAlpha[] = {
+ gfx::BufferFormat::RGBA_8888, gfx::BufferFormat::BGRA_8888};
+}
OverlayStrategySingleOnTop::OverlayStrategySingleOnTop(
OverlayCandidateValidator* capability_checker)
@@ -34,6 +40,17 @@ bool OverlayStrategySingleOnTop::Attempt(
// TODO(dcastagna): Remove this once drm platform supports transforms.
candidate.transform == gfx::OVERLAY_TRANSFORM_NONE &&
!OverlayCandidate::IsOccluded(candidate, quad_list->cbegin(), it)) {
+ // We currently reject quads with alpha that do not request alpha blending
+ // since the alpha channel might not be set to 1 and we're not disabling
+ // blending when scanning out.
+ // TODO(dcastagna): We should support alpha formats without blending using
+ // the opaque FB at scanout.
+ if (std::find(std::begin(kOverlayFormatsWithAlpha),
+ std::end(kOverlayFormatsWithAlpha),
+ candidate.format) != std::end(kOverlayFormatsWithAlpha) &&
+ it->shared_quad_state->blend_mode == SkBlendMode::kSrc)
+ continue;
+
if (candidate.display_rect.size().GetArea() >
best_candidate.display_rect.size().GetArea()) {
best_candidate = candidate;
« no previous file with comments | « cc/output/overlay_strategy_fullscreen.cc ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698