Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -41667,8 +41667,6 @@ ORIGIN: ../../../flutter/flow/flow_test_utils.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/flow_test_utils.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/frame_timings.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/frame_timings.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/layer_snapshot_store.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/layer_snapshot_store.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/layers/backdrop_filter_layer.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/layers/backdrop_filter_layer.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/layers/cacheable_layer.cc + ../../../flutter/LICENSE
Expand Down Expand Up @@ -44551,8 +44549,6 @@ FILE: ../../../flutter/flow/flow_test_utils.cc
FILE: ../../../flutter/flow/flow_test_utils.h
FILE: ../../../flutter/flow/frame_timings.cc
FILE: ../../../flutter/flow/frame_timings.h
FILE: ../../../flutter/flow/layer_snapshot_store.cc
FILE: ../../../flutter/flow/layer_snapshot_store.h
FILE: ../../../flutter/flow/layers/backdrop_filter_layer.cc
FILE: ../../../flutter/flow/layers/backdrop_filter_layer.h
FILE: ../../../flutter/flow/layers/cacheable_layer.cc
Expand Down
2 changes: 0 additions & 2 deletions flow/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ source_set("flow") {
"embedded_views.h",
"frame_timings.cc",
"frame_timings.h",
"layer_snapshot_store.cc",
"layer_snapshot_store.h",
"layers/backdrop_filter_layer.cc",
"layers/backdrop_filter_layer.h",
"layers/cacheable_layer.cc",
Expand Down
4 changes: 0 additions & 4 deletions flow/compositor_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "flutter/common/macros.h"
#include "flutter/flow/diff_context.h"
#include "flutter/flow/embedded_views.h"
#include "flutter/flow/layer_snapshot_store.h"
#include "flutter/flow/raster_cache.h"
#include "flutter/flow/stopwatch.h"
#include "flutter/fml/macros.h"
Expand Down Expand Up @@ -195,14 +194,11 @@ class CompositorContext {

Stopwatch& ui_time() { return ui_time_; }

LayerSnapshotStore& snapshot_store() { return layer_snapshot_store_; }

private:
NOT_SLIMPELLER(RasterCache raster_cache_);
std::shared_ptr<TextureRegistry> texture_registry_;
Stopwatch raster_time_;
Stopwatch ui_time_;
LayerSnapshotStore layer_snapshot_store_;

/// Only used by default constructor of `CompositorContext`.
FixedRefreshRateUpdater fixed_refresh_rate_updater_;
Expand Down
29 changes: 0 additions & 29 deletions flow/layer_snapshot_store.cc

This file was deleted.

76 changes: 0 additions & 76 deletions flow/layer_snapshot_store.h

This file was deleted.

35 changes: 0 additions & 35 deletions flow/layers/display_list_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <utility>

#include "flutter/display_list/dl_builder.h"
#include "flutter/flow/layer_snapshot_store.h"
#include "flutter/flow/layers/cacheable_layer.h"
#include "flutter/flow/layers/offscreen_surface.h"
#include "flutter/flow/raster_cache.h"
Expand Down Expand Up @@ -132,40 +131,6 @@ void DisplayListLayer::Paint(PaintContext& context) const {
#endif // !SLIMPELLER

SkScalar opacity = context.state_stack.outstanding_opacity();

#if !SLIMPELLER
// Leaf layer tracing was never supported in the Impeller backend.
if (context.enable_leaf_layer_tracing) {
const auto canvas_size = context.canvas->GetBaseLayerSize();
auto offscreen_surface =
std::make_unique<OffscreenSurface>(context.gr_context, canvas_size);

const auto& ctm = context.canvas->GetTransform();

const auto start_time = fml::TimePoint::Now();
{
// render display list to offscreen surface.
auto* canvas = offscreen_surface->GetCanvas();
{
DlAutoCanvasRestore save(canvas, true);
canvas->Clear(DlColor::kTransparent());
canvas->SetTransform(ctm);
canvas->DrawDisplayList(display_list_, opacity);
}
canvas->Flush();
}
const fml::TimeDelta offscreen_render_time =
fml::TimePoint::Now() - start_time;

const SkRect device_bounds =
RasterCacheUtil::GetDeviceBounds(paint_bounds(), ctm);
sk_sp<SkData> raster_data = offscreen_surface->GetRasterData(true);
LayerSnapshotData snapshot_data(unique_id(), offscreen_render_time,
raster_data, device_bounds);
context.layer_snapshot_store->Add(snapshot_data);
}
#endif // !SLIMPELLER

context.canvas->DrawDisplayList(display_list_, opacity);
}

Expand Down
35 changes: 0 additions & 35 deletions flow/layers/display_list_layer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -439,41 +439,6 @@ TEST_F(DisplayListLayerDiffTest, DisplayListCompare) {
EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(20, 20, 70, 70));
}

TEST_F(DisplayListLayerTest, LayerTreeSnapshotsWhenEnabled) {
const SkPoint layer_offset = SkPoint::Make(1.5f, -0.5f);
const SkRect picture_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
DisplayListBuilder builder;
builder.DrawRect(picture_bounds, DlPaint());
auto display_list = builder.Build();
auto layer = std::make_shared<DisplayListLayer>(layer_offset, display_list,
false, false);

layer->Preroll(preroll_context());

enable_leaf_layer_tracing();
layer->Paint(paint_context());
disable_leaf_layer_tracing();

auto& snapshot_store = layer_snapshot_store();
EXPECT_EQ(1u, snapshot_store.Size());
}

TEST_F(DisplayListLayerTest, NoLayerTreeSnapshotsWhenDisabledByDefault) {
const SkPoint layer_offset = SkPoint::Make(1.5f, -0.5f);
const SkRect picture_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
DisplayListBuilder builder;
builder.DrawRect(picture_bounds, DlPaint());
auto display_list = builder.Build();
auto layer = std::make_shared<DisplayListLayer>(layer_offset, display_list,
false, false);

layer->Preroll(preroll_context());
layer->Paint(paint_context());

auto& snapshot_store = layer_snapshot_store();
EXPECT_EQ(0u, snapshot_store.Size());
}

TEST_F(DisplayListLayerTest, DisplayListAccessCountDependsOnVisibility) {
const SkPoint layer_offset = SkPoint::Make(1.5f, -0.5f);
const SkRect picture_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
Expand Down
5 changes: 0 additions & 5 deletions flow/layers/layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "flutter/display_list/dl_canvas.h"
#include "flutter/flow/diff_context.h"
#include "flutter/flow/embedded_views.h"
#include "flutter/flow/layer_snapshot_store.h"
#include "flutter/flow/layers/layer_state_stack.h"
#include "flutter/flow/raster_cache.h"
#include "flutter/flow/stopwatch.h"
Expand Down Expand Up @@ -114,10 +113,6 @@ struct PaintContext {
std::shared_ptr<TextureRegistry> texture_registry;
NOT_SLIMPELLER(const RasterCache* raster_cache);

// Snapshot store to collect leaf layer snapshots. The store is non-null
// only when leaf layer tracing is enabled.
LayerSnapshotStore* layer_snapshot_store = nullptr;
bool enable_leaf_layer_tracing = false;
bool impeller_enabled = false;
impeller::AiksContext* aiks_context;
};
Expand Down
12 changes: 0 additions & 12 deletions flow/layers/layer_tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "flutter/display_list/skia/dl_sk_canvas.h"
#include "flutter/flow/embedded_views.h"
#include "flutter/flow/frame_timings.h"
#include "flutter/flow/layer_snapshot_store.h"
#include "flutter/flow/layers/layer.h"
#include "flutter/flow/paint_utils.h"
#include "flutter/flow/raster_cache.h"
Expand Down Expand Up @@ -108,13 +107,6 @@ void LayerTree::Paint(CompositorContext::ScopedFrame& frame,
DlCanvas* canvas = frame.canvas();
state_stack.set_delegate(canvas);

// clear the previous snapshots.
LayerSnapshotStore* snapshot_store = nullptr;
if (enable_leaf_layer_tracing_) {
frame.context().snapshot_store().Clear();
snapshot_store = &frame.context().snapshot_store();
}

SkColorSpace* color_space = GetColorSpace(frame.canvas());

#if !SLIMPELLER
Expand All @@ -135,8 +127,6 @@ void LayerTree::Paint(CompositorContext::ScopedFrame& frame,
#if !SLIMPELLER
.raster_cache = cache,
#endif // !SLIMPELLER
.layer_snapshot_store = snapshot_store,
.enable_leaf_layer_tracing = enable_leaf_layer_tracing_,
.impeller_enabled = !!frame.aiks_context(),
.aiks_context = frame.aiks_context(),
// clang-format on
Expand Down Expand Up @@ -198,8 +188,6 @@ sk_sp<DisplayList> LayerTree::Flatten(
#if !SLIMPELLER
.raster_cache = nullptr,
#endif // !SLIMPELLER
.layer_snapshot_store = nullptr,
.enable_leaf_layer_tracing = false,
// clang-format on
};

Expand Down
15 changes: 0 additions & 15 deletions flow/layers/layer_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,9 @@ class LayerTree {
const PaintRegionMap& paint_region_map() const { return paint_region_map_; }
PaintRegionMap& paint_region_map() { return paint_region_map_; }

/// When `Paint` is called, if leaf layer tracing is enabled, additional
/// metadata around rasterization of leaf layers is collected.
///
/// This is not supported in the Impeller backend.
///
/// See: `LayerSnapshotStore`
void enable_leaf_layer_tracing(bool enable) {
enable_leaf_layer_tracing_ = enable;
}

bool is_leaf_layer_tracing_enabled() const {
return enable_leaf_layer_tracing_;
}

private:
std::shared_ptr<Layer> root_layer_;
SkISize frame_size_ = SkISize::MakeEmpty(); // Physical pixels.
bool enable_leaf_layer_tracing_ = false;

PaintRegionMap paint_region_map_;

Expand Down
3 changes: 0 additions & 3 deletions flow/layers/layer_tree_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,6 @@ TEST_F(LayerTreeTest, PaintContextInitialization) {
EXPECT_EQ(&context.ui_time, &mock_ui_time);
EXPECT_EQ(context.texture_registry.get(), mock_registry.get());
EXPECT_EQ(context.raster_cache, nullptr);

EXPECT_EQ(context.enable_leaf_layer_tracing, false);
EXPECT_EQ(context.layer_snapshot_store, nullptr);
};

// These 4 initializers are required because they are handled by reference
Expand Down
13 changes: 0 additions & 13 deletions flow/testing/layer_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#define FLUTTER_FLOW_TESTING_LAYER_TEST_H_

#include "display_list/dl_color.h"
#include "flutter/flow/layer_snapshot_store.h"
#include "flutter/flow/layers/layer.h"

#include <optional>
Expand Down Expand Up @@ -153,7 +152,6 @@ class LayerTestBase : public CanvasTestBase<BaseT> {
PaintContext& display_list_paint_context() {
return display_list_paint_context_;
}
LayerSnapshotStore& layer_snapshot_store() { return snapshot_store_; }

sk_sp<DisplayList> display_list() {
if (display_list_ == nullptr) {
Expand All @@ -170,16 +168,6 @@ class LayerTestBase : public CanvasTestBase<BaseT> {
FML_DCHECK(display_list_state_stack_.is_empty());
}

void enable_leaf_layer_tracing() {
paint_context_.enable_leaf_layer_tracing = true;
paint_context_.layer_snapshot_store = &snapshot_store_;
}

void disable_leaf_layer_tracing() {
paint_context_.enable_leaf_layer_tracing = false;
paint_context_.layer_snapshot_store = nullptr;
}

private:
void set_raster_cache_(std::unique_ptr<RasterCache> raster_cache) {
raster_cache_ = std::move(raster_cache);
Expand All @@ -201,7 +189,6 @@ class LayerTestBase : public CanvasTestBase<BaseT> {
LayerStateStack display_list_state_stack_;
sk_sp<DisplayList> display_list_;
PaintContext display_list_paint_context_;
LayerSnapshotStore snapshot_store_;

std::vector<RasterCacheItem*> cacheable_items_;

Expand Down
Loading