Skip to content

Commit

Permalink
Remove the feature flag CALayerTreeOptimization
Browse files Browse the repository at this point in the history
CALayerTreeOptimization has been enabled by default since M107

Bug: 40214116
Change-Id: Ib538dbd48097d56328134acf9242088eb0bb81f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5549057
Reviewed-by: ccameron chromium <[email protected]>
Commit-Queue: Maggie Chen <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1303823}
  • Loading branch information
Maggie Chen authored and Chromium LUCI CQ committed May 21, 2024
1 parent fc79321 commit bead720
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
6 changes: 0 additions & 6 deletions ui/accelerated_widget_mac/ca_renderer_layer_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ namespace ui {

ACCELERATED_WIDGET_MAC_EXPORT BASE_DECLARE_FEATURE(
kFullscreenLowPowerBackdropMac);
ACCELERATED_WIDGET_MAC_EXPORT BASE_DECLARE_FEATURE(kCALayerTreeOptimization);

struct CARendererLayerParams;

Expand Down Expand Up @@ -101,7 +100,6 @@ class ACCELERATED_WIDGET_MAC_EXPORT CARendererLayerTree {
using CALayerMap =
std::unordered_map<IOSurfaceRef, base::WeakPtr<ContentLayer>>;

void MatchLayersToOldTreeDefault(CARendererLayerTree* old_tree);
void MatchLayersToOldTree(CARendererLayerTree* old_tree);

class RootLayer {
Expand Down Expand Up @@ -321,10 +319,6 @@ class ACCELERATED_WIDGET_MAC_EXPORT CARendererLayerTree {
const bool allow_solid_color_layers_ = true;
id<MTLDevice> __strong metal_device_ = nil;

// Enable CALayerTree optimization that will try to reuse the CALayer with a
// matched CALayer from the old CALayerTree in the previous frame.
const bool ca_layer_tree_optimization_;

// Map of content IOSurface.
CALayerMap ca_layer_map_;
};
Expand Down
30 changes: 3 additions & 27 deletions ui/accelerated_widget_mac/ca_renderer_layer_tree.mm
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
"FullscreenLowPowerBackdropMac",
base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE(kCALayerTreeOptimization,
"CALayerTreeOptimization",
base::FEATURE_ENABLED_BY_DEFAULT);

#if BUILDFLAG(IS_MAC)
// Show borders around RenderPassDrawQuad CALayers. which is the output of a
// non-root render pass.
Expand Down Expand Up @@ -315,9 +311,7 @@ CATransform3D ToCATransform3D(const gfx::Transform& t) {
bool allow_solid_color_layers)
: allow_av_sample_buffer_display_layer_(
allow_av_sample_buffer_display_layer),
allow_solid_color_layers_(allow_solid_color_layers),
ca_layer_tree_optimization_(
base::FeatureList::IsEnabled(kCALayerTreeOptimization)) {}
allow_solid_color_layers_(allow_solid_color_layers) {}
CARendererLayerTree::~CARendererLayerTree() = default;

bool CARendererLayerTree::ScheduleCALayer(const CARendererLayerParams& params) {
Expand All @@ -336,10 +330,8 @@ CATransform3D ToCATransform3D(const gfx::Transform& t) {
TRACE_EVENT0("gpu", "CARendererLayerTree::CommitScheduledCALayers");
scale_factor_ = scale_factor;

if (ca_layer_tree_optimization_)
MatchLayersToOldTree(old_tree.get());
else
MatchLayersToOldTreeDefault(old_tree.get());
// The CALayerTree optimization reuses the matched CALayer from the previous.
MatchLayersToOldTree(old_tree.get());

root_layer_.CommitToCA(superlayer, pixel_size);
// If there are any extra CALayers in |old_tree| that were not stolen by this
Expand All @@ -348,22 +340,6 @@ CATransform3D ToCATransform3D(const gfx::Transform& t) {
has_committed_ = true;
}

void CARendererLayerTree::MatchLayersToOldTreeDefault(
CARendererLayerTree* old_tree) {
if (!old_tree)
return;
DCHECK(old_tree->has_committed_);

// Match the root layer.
if (old_tree->scale_factor_ != scale_factor_)
return;

root_layer_.old_layer_ =
old_tree->root_layer_.weak_factory_for_new_layer_.GetWeakPtr();

root_layer_.CALayerFallBack();
}

void CARendererLayerTree::MatchLayersToOldTree(CARendererLayerTree* old_tree) {
if (!old_tree)
return;
Expand Down

0 comments on commit bead720

Please sign in to comment.