Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 6613428

Browse files
author
Jonah Williams
authored
[engine] remove raster stats feature. (#54187)
This debugging tool does not give accurate measurements and we've decided to remove it. See also: flutter/flutter#131941
1 parent 30e215f commit 6613428

20 files changed

+20
-525
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41667,8 +41667,6 @@ ORIGIN: ../../../flutter/flow/flow_test_utils.cc + ../../../flutter/LICENSE
4166741667
ORIGIN: ../../../flutter/flow/flow_test_utils.h + ../../../flutter/LICENSE
4166841668
ORIGIN: ../../../flutter/flow/frame_timings.cc + ../../../flutter/LICENSE
4166941669
ORIGIN: ../../../flutter/flow/frame_timings.h + ../../../flutter/LICENSE
41670-
ORIGIN: ../../../flutter/flow/layer_snapshot_store.cc + ../../../flutter/LICENSE
41671-
ORIGIN: ../../../flutter/flow/layer_snapshot_store.h + ../../../flutter/LICENSE
4167241670
ORIGIN: ../../../flutter/flow/layers/backdrop_filter_layer.cc + ../../../flutter/LICENSE
4167341671
ORIGIN: ../../../flutter/flow/layers/backdrop_filter_layer.h + ../../../flutter/LICENSE
4167441672
ORIGIN: ../../../flutter/flow/layers/cacheable_layer.cc + ../../../flutter/LICENSE
@@ -44551,8 +44549,6 @@ FILE: ../../../flutter/flow/flow_test_utils.cc
4455144549
FILE: ../../../flutter/flow/flow_test_utils.h
4455244550
FILE: ../../../flutter/flow/frame_timings.cc
4455344551
FILE: ../../../flutter/flow/frame_timings.h
44554-
FILE: ../../../flutter/flow/layer_snapshot_store.cc
44555-
FILE: ../../../flutter/flow/layer_snapshot_store.h
4455644552
FILE: ../../../flutter/flow/layers/backdrop_filter_layer.cc
4455744553
FILE: ../../../flutter/flow/layers/backdrop_filter_layer.h
4455844554
FILE: ../../../flutter/flow/layers/cacheable_layer.cc

flow/BUILD.gn

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ source_set("flow") {
2121
"embedded_views.h",
2222
"frame_timings.cc",
2323
"frame_timings.h",
24-
"layer_snapshot_store.cc",
25-
"layer_snapshot_store.h",
2624
"layers/backdrop_filter_layer.cc",
2725
"layers/backdrop_filter_layer.h",
2826
"layers/cacheable_layer.cc",

flow/compositor_context.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "flutter/common/macros.h"
1313
#include "flutter/flow/diff_context.h"
1414
#include "flutter/flow/embedded_views.h"
15-
#include "flutter/flow/layer_snapshot_store.h"
1615
#include "flutter/flow/raster_cache.h"
1716
#include "flutter/flow/stopwatch.h"
1817
#include "flutter/fml/macros.h"
@@ -195,14 +194,11 @@ class CompositorContext {
195194

196195
Stopwatch& ui_time() { return ui_time_; }
197196

198-
LayerSnapshotStore& snapshot_store() { return layer_snapshot_store_; }
199-
200197
private:
201198
NOT_SLIMPELLER(RasterCache raster_cache_);
202199
std::shared_ptr<TextureRegistry> texture_registry_;
203200
Stopwatch raster_time_;
204201
Stopwatch ui_time_;
205-
LayerSnapshotStore layer_snapshot_store_;
206202

207203
/// Only used by default constructor of `CompositorContext`.
208204
FixedRefreshRateUpdater fixed_refresh_rate_updater_;

flow/layer_snapshot_store.cc

Lines changed: 0 additions & 29 deletions
This file was deleted.

flow/layer_snapshot_store.h

Lines changed: 0 additions & 76 deletions
This file was deleted.

flow/layers/display_list_layer.cc

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <utility>
88

99
#include "flutter/display_list/dl_builder.h"
10-
#include "flutter/flow/layer_snapshot_store.h"
1110
#include "flutter/flow/layers/cacheable_layer.h"
1211
#include "flutter/flow/layers/offscreen_surface.h"
1312
#include "flutter/flow/raster_cache.h"
@@ -132,40 +131,6 @@ void DisplayListLayer::Paint(PaintContext& context) const {
132131
#endif // !SLIMPELLER
133132

134133
SkScalar opacity = context.state_stack.outstanding_opacity();
135-
136-
#if !SLIMPELLER
137-
// Leaf layer tracing was never supported in the Impeller backend.
138-
if (context.enable_leaf_layer_tracing) {
139-
const auto canvas_size = context.canvas->GetBaseLayerSize();
140-
auto offscreen_surface =
141-
std::make_unique<OffscreenSurface>(context.gr_context, canvas_size);
142-
143-
const auto& ctm = context.canvas->GetTransform();
144-
145-
const auto start_time = fml::TimePoint::Now();
146-
{
147-
// render display list to offscreen surface.
148-
auto* canvas = offscreen_surface->GetCanvas();
149-
{
150-
DlAutoCanvasRestore save(canvas, true);
151-
canvas->Clear(DlColor::kTransparent());
152-
canvas->SetTransform(ctm);
153-
canvas->DrawDisplayList(display_list_, opacity);
154-
}
155-
canvas->Flush();
156-
}
157-
const fml::TimeDelta offscreen_render_time =
158-
fml::TimePoint::Now() - start_time;
159-
160-
const SkRect device_bounds =
161-
RasterCacheUtil::GetDeviceBounds(paint_bounds(), ctm);
162-
sk_sp<SkData> raster_data = offscreen_surface->GetRasterData(true);
163-
LayerSnapshotData snapshot_data(unique_id(), offscreen_render_time,
164-
raster_data, device_bounds);
165-
context.layer_snapshot_store->Add(snapshot_data);
166-
}
167-
#endif // !SLIMPELLER
168-
169134
context.canvas->DrawDisplayList(display_list_, opacity);
170135
}
171136

flow/layers/display_list_layer_unittests.cc

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -439,41 +439,6 @@ TEST_F(DisplayListLayerDiffTest, DisplayListCompare) {
439439
EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(20, 20, 70, 70));
440440
}
441441

442-
TEST_F(DisplayListLayerTest, LayerTreeSnapshotsWhenEnabled) {
443-
const SkPoint layer_offset = SkPoint::Make(1.5f, -0.5f);
444-
const SkRect picture_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
445-
DisplayListBuilder builder;
446-
builder.DrawRect(picture_bounds, DlPaint());
447-
auto display_list = builder.Build();
448-
auto layer = std::make_shared<DisplayListLayer>(layer_offset, display_list,
449-
false, false);
450-
451-
layer->Preroll(preroll_context());
452-
453-
enable_leaf_layer_tracing();
454-
layer->Paint(paint_context());
455-
disable_leaf_layer_tracing();
456-
457-
auto& snapshot_store = layer_snapshot_store();
458-
EXPECT_EQ(1u, snapshot_store.Size());
459-
}
460-
461-
TEST_F(DisplayListLayerTest, NoLayerTreeSnapshotsWhenDisabledByDefault) {
462-
const SkPoint layer_offset = SkPoint::Make(1.5f, -0.5f);
463-
const SkRect picture_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
464-
DisplayListBuilder builder;
465-
builder.DrawRect(picture_bounds, DlPaint());
466-
auto display_list = builder.Build();
467-
auto layer = std::make_shared<DisplayListLayer>(layer_offset, display_list,
468-
false, false);
469-
470-
layer->Preroll(preroll_context());
471-
layer->Paint(paint_context());
472-
473-
auto& snapshot_store = layer_snapshot_store();
474-
EXPECT_EQ(0u, snapshot_store.Size());
475-
}
476-
477442
TEST_F(DisplayListLayerTest, DisplayListAccessCountDependsOnVisibility) {
478443
const SkPoint layer_offset = SkPoint::Make(1.5f, -0.5f);
479444
const SkRect picture_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);

flow/layers/layer.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "flutter/display_list/dl_canvas.h"
1616
#include "flutter/flow/diff_context.h"
1717
#include "flutter/flow/embedded_views.h"
18-
#include "flutter/flow/layer_snapshot_store.h"
1918
#include "flutter/flow/layers/layer_state_stack.h"
2019
#include "flutter/flow/raster_cache.h"
2120
#include "flutter/flow/stopwatch.h"
@@ -114,10 +113,6 @@ struct PaintContext {
114113
std::shared_ptr<TextureRegistry> texture_registry;
115114
NOT_SLIMPELLER(const RasterCache* raster_cache);
116115

117-
// Snapshot store to collect leaf layer snapshots. The store is non-null
118-
// only when leaf layer tracing is enabled.
119-
LayerSnapshotStore* layer_snapshot_store = nullptr;
120-
bool enable_leaf_layer_tracing = false;
121116
bool impeller_enabled = false;
122117
impeller::AiksContext* aiks_context;
123118
};

flow/layers/layer_tree.cc

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "flutter/display_list/skia/dl_sk_canvas.h"
88
#include "flutter/flow/embedded_views.h"
99
#include "flutter/flow/frame_timings.h"
10-
#include "flutter/flow/layer_snapshot_store.h"
1110
#include "flutter/flow/layers/layer.h"
1211
#include "flutter/flow/paint_utils.h"
1312
#include "flutter/flow/raster_cache.h"
@@ -108,13 +107,6 @@ void LayerTree::Paint(CompositorContext::ScopedFrame& frame,
108107
DlCanvas* canvas = frame.canvas();
109108
state_stack.set_delegate(canvas);
110109

111-
// clear the previous snapshots.
112-
LayerSnapshotStore* snapshot_store = nullptr;
113-
if (enable_leaf_layer_tracing_) {
114-
frame.context().snapshot_store().Clear();
115-
snapshot_store = &frame.context().snapshot_store();
116-
}
117-
118110
SkColorSpace* color_space = GetColorSpace(frame.canvas());
119111

120112
#if !SLIMPELLER
@@ -135,8 +127,6 @@ void LayerTree::Paint(CompositorContext::ScopedFrame& frame,
135127
#if !SLIMPELLER
136128
.raster_cache = cache,
137129
#endif // !SLIMPELLER
138-
.layer_snapshot_store = snapshot_store,
139-
.enable_leaf_layer_tracing = enable_leaf_layer_tracing_,
140130
.impeller_enabled = !!frame.aiks_context(),
141131
.aiks_context = frame.aiks_context(),
142132
// clang-format on
@@ -198,8 +188,6 @@ sk_sp<DisplayList> LayerTree::Flatten(
198188
#if !SLIMPELLER
199189
.raster_cache = nullptr,
200190
#endif // !SLIMPELLER
201-
.layer_snapshot_store = nullptr,
202-
.enable_leaf_layer_tracing = false,
203191
// clang-format on
204192
};
205193

flow/layers/layer_tree.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,9 @@ class LayerTree {
5656
const PaintRegionMap& paint_region_map() const { return paint_region_map_; }
5757
PaintRegionMap& paint_region_map() { return paint_region_map_; }
5858

59-
/// When `Paint` is called, if leaf layer tracing is enabled, additional
60-
/// metadata around rasterization of leaf layers is collected.
61-
///
62-
/// This is not supported in the Impeller backend.
63-
///
64-
/// See: `LayerSnapshotStore`
65-
void enable_leaf_layer_tracing(bool enable) {
66-
enable_leaf_layer_tracing_ = enable;
67-
}
68-
69-
bool is_leaf_layer_tracing_enabled() const {
70-
return enable_leaf_layer_tracing_;
71-
}
72-
7359
private:
7460
std::shared_ptr<Layer> root_layer_;
7561
SkISize frame_size_ = SkISize::MakeEmpty(); // Physical pixels.
76-
bool enable_leaf_layer_tracing_ = false;
7762

7863
PaintRegionMap paint_region_map_;
7964

0 commit comments

Comments
 (0)