Skip to content

Commit

Permalink
Cleanup IsOverlayPrioritizationEnabled feature
Browse files Browse the repository at this point in the history
This is now enabled by default everywhere.

Things I'll do in follow-up CLs:
 - Drop "Prioritized" from remaining ProposePrioritized and
   AttemptPrioritized function names. It simplifies this diff.
 - Cleanup references to EnableOverlayPrioritization in buildbot configs

Change-Id: I12976adae310a57c420eb9ab866a10f7cd46a6e7
Bug: 1396151
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4104661
Reviewed-by: Peter McNeeley <petermcneeley@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Kevin Haslett <khaslett@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1103456}
  • Loading branch information
Kevin Haslett authored and Chromium LUCI CQ committed Feb 9, 2023
1 parent 1a6c625 commit 94847b1
Show file tree
Hide file tree
Showing 15 changed files with 8 additions and 454 deletions.
12 changes: 0 additions & 12 deletions components/viz/common/features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ const char kDynamicSchedulerPercentile[] = "percentile";

namespace features {

BASE_FEATURE(kEnableOverlayPrioritization,
"EnableOverlayPrioritization",
base::FEATURE_ENABLED_BY_DEFAULT);

BASE_FEATURE(kUseMultipleOverlays,
"UseMultipleOverlays",
#if BUILDFLAG(IS_CHROMEOS_ASH)
Expand Down Expand Up @@ -230,10 +226,6 @@ BASE_FEATURE(kRendererAllocatesImages,
BASE_FEATURE(kEvictSubtree, "EvictSubtree", base::FEATURE_DISABLED_BY_DEFAULT);
#endif

bool IsOverlayPrioritizationEnabled() {
return base::FeatureList::IsEnabled(kEnableOverlayPrioritization);
}

bool IsDelegatedCompositingEnabled() {
return base::FeatureList::IsEnabled(kDelegatedCompositing);
}
Expand Down Expand Up @@ -356,10 +348,6 @@ absl::optional<double> IsDynamicSchedulerEnabledForClients() {
}

int MaxOverlaysConsidered() {
if (!IsOverlayPrioritizationEnabled()) {
return 1;
}

if (!base::FeatureList::IsEnabled(kUseMultipleOverlays)) {
return 1;
}
Expand Down
2 changes: 0 additions & 2 deletions components/viz/common/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

namespace features {

VIZ_COMMON_EXPORT BASE_DECLARE_FEATURE(kEnableOverlayPrioritization);
VIZ_COMMON_EXPORT BASE_DECLARE_FEATURE(kDelegatedCompositing);
VIZ_COMMON_EXPORT BASE_DECLARE_FEATURE(kRecordSkPicture);
VIZ_COMMON_EXPORT BASE_DECLARE_FEATURE(kUseMultipleOverlays);
Expand Down Expand Up @@ -79,7 +78,6 @@ VIZ_COMMON_EXPORT bool IsSimpleFrameRateThrottlingEnabled();
#if BUILDFLAG(IS_ANDROID)
VIZ_COMMON_EXPORT bool IsDynamicColorGamutEnabled();
#endif
VIZ_COMMON_EXPORT bool IsOverlayPrioritizationEnabled();
VIZ_COMMON_EXPORT bool IsDelegatedCompositingEnabled();
VIZ_COMMON_EXPORT bool IsUsingVizFrameSubmissionForWebView();
VIZ_COMMON_EXPORT bool IsUsingPreferredIntervalForVideo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,9 @@ TEST(OverlayProcessorOzoneTest, ObserveHardwareCapabilites) {
OverlayCandidateList candidates;
// Enable 4 overlays
const std::vector<base::test::FeatureRefAndParams> feature_and_params_list = {
{features::kEnableOverlayPrioritization, {}},
{features::kUseMultipleOverlays, {{features::kMaxOverlaysParam, "4"}}}};
base::test::ScopedFeatureList scoped_features;
scoped_features.InitWithFeaturesAndParameters(feature_and_params_list, {});
// When overlay prioritization is explicitly disabled (Lacros) we should
// skip multiple overlays tests.
if (!features::IsOverlayPrioritizationEnabled()) {
GTEST_SKIP();
}

auto fake_candidates_unique = std::make_unique<FakeOverlayCandidatesOzone>();
auto* fake_candidates = fake_candidates_unique.get();
Expand Down
15 changes: 0 additions & 15 deletions components/viz/service/display/overlay_processor_strategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,6 @@ class VIZ_SERVICE_EXPORT OverlayProcessorStrategy {
virtual ~OverlayProcessorStrategy() = default;
using PrimaryPlane = OverlayProcessorInterface::OutputSurfaceOverlayPlane;

// Returns false if the strategy cannot be made to work with the
// current set of render passes. Returns true if the strategy was successful
// and adds any additional passes necessary to represent overlays to
// |render_pass_list|. Most strategies should look at the primary
// RenderPass, the last element.
virtual bool Attempt(const SkM44& output_color_matrix,
const OverlayProcessorInterface::FilterOperationsMap&
render_pass_backdrop_filters,
DisplayResourceProvider* resource_provider,
AggregatedRenderPassList* render_pass_list,
SurfaceDamageRectList* surface_damage_rect_list,
const PrimaryPlane* primary_plane,
OverlayCandidateList* candidates,
std::vector<gfx::Rect>* content_bounds) = 0;

// Appends all legitimate overlay candidates to the list |candidates|
// for this strategy. It is very important to note that this function
// should not attempt a specific candidate it should merely identify them
Expand Down
44 changes: 4 additions & 40 deletions components/viz/service/display/overlay_processor_using_strategy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,10 @@ void OverlayProcessorUsingStrategy::ProcessForOverlays(
// CALayers because the framebuffer would be missing the removed quads'
// contents.
if (render_pass->copy_requests.empty()) {
if (features::IsOverlayPrioritizationEnabled()) {
success = AttemptWithStrategiesPrioritized(
output_color_matrix, render_pass_backdrop_filters, resource_provider,
render_passes, &surface_damage_rect_list, output_surface_plane,
candidates, content_bounds, damage_rect);
} else {
success = AttemptWithStrategies(
output_color_matrix, render_pass_backdrop_filters, resource_provider,
render_passes, &surface_damage_rect_list, output_surface_plane,
candidates, content_bounds);
}
success = AttemptWithStrategiesPrioritized(
output_color_matrix, render_pass_backdrop_filters, resource_provider,
render_passes, &surface_damage_rect_list, output_surface_plane,
candidates, content_bounds, damage_rect);
}
LogCheckOverlaySupportMetrics();

Expand Down Expand Up @@ -438,35 +431,6 @@ void OverlayProcessorUsingStrategy::AdjustOutputSurfaceOverlay(
output_surface_plane->reset();
}

bool OverlayProcessorUsingStrategy::AttemptWithStrategies(
const SkM44& output_color_matrix,
const OverlayProcessorInterface::FilterOperationsMap&
render_pass_backdrop_filters,
DisplayResourceProvider* resource_provider,
AggregatedRenderPassList* render_pass_list,
SurfaceDamageRectList* surface_damage_rect_list,
OverlayProcessorInterface::OutputSurfaceOverlayPlane* primary_plane,
OverlayCandidateList* candidates,
std::vector<gfx::Rect>* content_bounds) {
last_successful_strategy_ = nullptr;
for (const auto& strategy : strategies_) {
if (strategy->Attempt(output_color_matrix, render_pass_backdrop_filters,
resource_provider, render_pass_list,
surface_damage_rect_list, primary_plane, candidates,
content_bounds)) {
// This function is used by underlay strategy to mark the primary plane as
// enable_blending.
strategy->AdjustOutputSurfaceOverlay(primary_plane);
LogStrategyEnumUMA(strategy->GetUMAEnum());
last_successful_strategy_ = strategy.get();
return true;
}
}

LogStrategyEnumUMA(OverlayStrategy::kNoStrategyUsed);
return false;
}

void OverlayProcessorUsingStrategy::SortProposedOverlayCandidatesPrioritized(
std::vector<OverlayProposedCandidate>* proposed_candidates) {
// Removes trackers for candidates that are no longer being rendered.
Expand Down
18 changes: 0 additions & 18 deletions components/viz/service/display/overlay_processor_using_strategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,24 +178,6 @@ class VIZ_SERVICE_EXPORT OverlayProcessorUsingStrategy
const SurfaceDamageRectList& surface_damage_rect_list,
const gfx::Rect& existing_damage);

// Iterate through a list of strategies and attempt to overlay with each.
// Returns true if one of the attempts is successful. Has to be called after
// InitializeStrategies(). A |primary_plane| represents the output surface's
// buffer that comes from |BufferQueue|. It is passed in here so it could be
// pass through to hardware through CheckOverlaySupport. It is not passed
// through as a const member because the underlay strategy changes the
// |primary_plane|'s blending setting.
bool AttemptWithStrategies(
const SkM44& output_color_matrix,
const OverlayProcessorInterface::FilterOperationsMap&
render_pass_backdrop_filters,
DisplayResourceProvider* resource_provider,
AggregatedRenderPassList* render_pass_list,
SurfaceDamageRectList* surface_damage_rect_list,
OverlayProcessorInterface::OutputSurfaceOverlayPlane* primary_plane,
OverlayCandidateList* candidates,
std::vector<gfx::Rect>* content_bounds);

// Iterate through a list of strategies and attempt to overlay with each.
// Returns true if one of the attempts is successful. Has to be called after
// InitializeStrategies(). A |primary_plane| represents the output surface's
Expand Down
59 changes: 0 additions & 59 deletions components/viz/service/display/overlay_strategy_fullscreen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,65 +22,6 @@ OverlayStrategyFullscreen::OverlayStrategyFullscreen(

OverlayStrategyFullscreen::~OverlayStrategyFullscreen() {}

bool OverlayStrategyFullscreen::Attempt(
const SkM44& output_color_matrix,
const OverlayProcessorInterface::FilterOperationsMap&
render_pass_backdrop_filters,
DisplayResourceProvider* resource_provider,
AggregatedRenderPassList* render_pass_list,
SurfaceDamageRectList* surface_damage_rect_list,
const PrimaryPlane* primary_plane,
OverlayCandidateList* candidate_list,
std::vector<gfx::Rect>* content_bounds) {
// Before we attempt an overlay strategy, the candidate list should be empty.
DCHECK(candidate_list->empty());
auto* render_pass = render_pass_list->back().get();
QuadList* quad_list = &render_pass->quad_list;
// First quad of quad_list is the top most quad.
auto front = quad_list->begin();
while (front != quad_list->end()) {
if (!OverlayCandidate::IsInvisibleQuad(*front))
break;
++front;
}

if (front == quad_list->end())
return false;

const DrawQuad* quad = *front;
if (quad->ShouldDrawWithBlending())
return false;

OverlayCandidate candidate;
OverlayCandidateFactory candidate_factory = OverlayCandidateFactory(
render_pass, resource_provider, surface_damage_rect_list,
&output_color_matrix, GetPrimaryPlaneDisplayRect(primary_plane));
if (candidate_factory.FromDrawQuad(quad, candidate) !=
OverlayCandidate::CandidateStatus::kSuccess) {
return false;
}

if (!candidate.display_rect.origin().IsOrigin() ||
gfx::ToRoundedSize(candidate.display_rect.size()) !=
render_pass->output_rect.size()) {
return false;
}
candidate.is_opaque = true;
candidate.plane_z_order = 0;
OverlayCandidateList new_candidate_list;
new_candidate_list.push_back(candidate);
capability_checker_->CheckOverlaySupport(nullptr, &new_candidate_list);
if (!new_candidate_list.front().overlay_handled)
return false;

candidate_list->swap(new_candidate_list);

OverlayProposedCandidate proposed_candidate(front, candidate, this);
CommitCandidate(proposed_candidate, render_pass);

return true;
}

void OverlayStrategyFullscreen::ProposePrioritized(
const SkM44& output_color_matrix,
const OverlayProcessorInterface::FilterOperationsMap&
Expand Down
10 changes: 0 additions & 10 deletions components/viz/service/display/overlay_strategy_fullscreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ class VIZ_SERVICE_EXPORT OverlayStrategyFullscreen

~OverlayStrategyFullscreen() override;

bool Attempt(const SkM44& output_color_matrix,
const OverlayProcessorInterface::FilterOperationsMap&
render_pass_backdrop_filters,
DisplayResourceProvider* resource_provider,
AggregatedRenderPassList* render_pass,
SurfaceDamageRectList* surface_damage_rect_list,
const PrimaryPlane* primary_plane,
OverlayCandidateList* candidate_list,
std::vector<gfx::Rect>* content_bounds) override;

void ProposePrioritized(const SkM44& output_color_matrix,
const OverlayProcessorInterface::FilterOperationsMap&
render_pass_backdrop_filters,
Expand Down
62 changes: 0 additions & 62 deletions components/viz/service/display/overlay_strategy_single_on_top.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,68 +20,6 @@ OverlayStrategySingleOnTop::OverlayStrategySingleOnTop(

OverlayStrategySingleOnTop::~OverlayStrategySingleOnTop() {}

bool OverlayStrategySingleOnTop::Attempt(
const SkM44& output_color_matrix,
const OverlayProcessorInterface::FilterOperationsMap&
render_pass_backdrop_filters,
DisplayResourceProvider* resource_provider,
AggregatedRenderPassList* render_pass_list,
SurfaceDamageRectList* surface_damage_rect_list,
const PrimaryPlane* primary_plane,
OverlayCandidateList* candidate_list,
std::vector<gfx::Rect>* content_bounds) {
// Before we attempt an overlay strategy, we shouldn't have a candidate.
DCHECK(candidate_list->empty());
auto* render_pass = render_pass_list->back().get();
QuadList* quad_list = &render_pass->quad_list;
// Build a list of candidates with the associated quad.
OverlayCandidate best_candidate;
OverlayCandidateFactory candidate_factory = OverlayCandidateFactory(
render_pass, resource_provider, surface_damage_rect_list,
&output_color_matrix, GetPrimaryPlaneDisplayRect(primary_plane));

auto best_quad_it = quad_list->end();
for (auto it = quad_list->begin(); it != quad_list->end(); ++it) {
OverlayCandidate candidate;
if (candidate_factory.FromDrawQuad(*it, candidate) ==
OverlayCandidate::CandidateStatus::kSuccess &&
!candidate.has_mask_filter &&
!OverlayCandidate::IsOccluded(candidate, quad_list->cbegin(), it)) {
// If the candidate has been promoted previously and has not changed
// (resource ID is the same) for 3 frames, do not use it as Overlay as
// flattening it to the main fb will be more power efficient when the
// contents don't change.
if (candidate.resource_id == previous_frame_resource_id_ &&
++same_resource_id_frames_count_ >
kMaxFrameCandidateWithSameResourceId) {
continue;
}
if (candidate.display_rect.size().GetArea() >
best_candidate.display_rect.size().GetArea()) {
best_candidate = candidate;
best_quad_it = it;
}
}
}
if (best_quad_it == quad_list->end())
return false;

OverlayProposedCandidate proposed_candidate(best_quad_it, best_candidate,
this);
if (TryOverlay(render_pass, primary_plane, candidate_list,
proposed_candidate)) {
if (previous_frame_resource_id_ != best_candidate.resource_id) {
previous_frame_resource_id_ = best_candidate.resource_id;
same_resource_id_frames_count_ = 1;
}
return true;
} else {
previous_frame_resource_id_ = kInvalidResourceId;
same_resource_id_frames_count_ = 0;
return false;
}
}

void OverlayStrategySingleOnTop::ProposePrioritized(
const SkM44& output_color_matrix,
const OverlayProcessorInterface::FilterOperationsMap&
Expand Down
11 changes: 0 additions & 11 deletions components/viz/service/display/overlay_strategy_single_on_top.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ class VIZ_SERVICE_EXPORT OverlayStrategySingleOnTop

~OverlayStrategySingleOnTop() override;

bool Attempt(const SkM44& output_color_matrix,
const OverlayProcessorInterface::FilterOperationsMap&
render_pass_backdrop_filters,
DisplayResourceProvider* resource_provider,
AggregatedRenderPassList* render_pass,
SurfaceDamageRectList* surface_damage_rect_list,
const PrimaryPlane* primary_plane,
OverlayCandidateList* candidate_list,
std::vector<gfx::Rect>* content_bounds) override;

void ProposePrioritized(const SkM44& output_color_matrix,
const OverlayProcessorInterface::FilterOperationsMap&
render_pass_backdrop_filters,
Expand Down Expand Up @@ -75,7 +65,6 @@ class VIZ_SERVICE_EXPORT OverlayStrategySingleOnTop
raw_ptr<OverlayProcessorUsingStrategy> capability_checker_; // Weak.

ResourceId previous_frame_resource_id_ = kInvalidResourceId;
size_t same_resource_id_frames_count_ = 0;
};

} // namespace viz
Expand Down

0 comments on commit 94847b1

Please sign in to comment.