Revert "Add a new display_list_benchmarks test suite (#29562)" (flutter/engine#30507)
This reverts commit 7bbc5623d5.
This commit is contained in:
@@ -116,7 +116,6 @@ group("flutter") {
|
||||
# Compile all benchmark targets if enabled.
|
||||
if (enable_unittests && !is_win) {
|
||||
public_deps += [
|
||||
"//flutter/display_list:display_list_benchmarks",
|
||||
"//flutter/fml:fml_benchmarks",
|
||||
"//flutter/lib/ui:ui_benchmarks",
|
||||
"//flutter/shell/common:shell_benchmarks",
|
||||
|
||||
@@ -34,10 +34,6 @@ FILE: ../../../flutter/common/task_runners.cc
|
||||
FILE: ../../../flutter/common/task_runners.h
|
||||
FILE: ../../../flutter/display_list/display_list.cc
|
||||
FILE: ../../../flutter/display_list/display_list.h
|
||||
FILE: ../../../flutter/display_list/display_list_benchmarks.cc
|
||||
FILE: ../../../flutter/display_list/display_list_benchmarks.h
|
||||
FILE: ../../../flutter/display_list/display_list_benchmarks_gl.cc
|
||||
FILE: ../../../flutter/display_list/display_list_benchmarks_metal.cc
|
||||
FILE: ../../../flutter/display_list/display_list_canvas.cc
|
||||
FILE: ../../../flutter/display_list/display_list_canvas.h
|
||||
FILE: ../../../flutter/display_list/display_list_canvas_unittests.cc
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//flutter/testing/testing.gni")
|
||||
|
||||
source_set("display_list") {
|
||||
sources = [
|
||||
"display_list.cc",
|
||||
@@ -37,40 +35,3 @@ source_set("unittests") {
|
||||
|
||||
public_deps = [ ":display_list" ]
|
||||
}
|
||||
|
||||
fixtures_location("display_list_benchmarks_fixtures") {
|
||||
assets_dir = "$target_gen_dir/"
|
||||
}
|
||||
|
||||
if (enable_unittests) {
|
||||
executable("display_list_benchmarks") {
|
||||
testonly = true
|
||||
|
||||
sources = [
|
||||
"display_list_benchmarks.cc",
|
||||
"display_list_benchmarks.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":display_list",
|
||||
":display_list_benchmarks_fixtures",
|
||||
"//flutter/benchmarking",
|
||||
"//flutter/common/graphics",
|
||||
"//flutter/fml",
|
||||
"//flutter/testing:skia",
|
||||
"//flutter/testing:testing_lib",
|
||||
"//third_party/dart/runtime:libdart_jit", # for tracing
|
||||
"//third_party/skia",
|
||||
]
|
||||
|
||||
if (!is_fuchsia) {
|
||||
sources += [ "display_list_benchmarks_gl.cc" ]
|
||||
deps += [ "//flutter/testing:opengl" ]
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
sources += [ "display_list_benchmarks_metal.cc" ]
|
||||
deps += [ "//flutter/testing:metal" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,453 +0,0 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef FLUTTER_FLOW_DISPLAY_LIST_BENCHMARKS_H_
|
||||
#define FLUTTER_FLOW_DISPLAY_LIST_BENCHMARKS_H_
|
||||
|
||||
#include "flutter/benchmarking/benchmarking.h"
|
||||
#include "flutter/fml/mapping.h"
|
||||
#include "flutter/testing/testing.h"
|
||||
|
||||
#include "third_party/skia/include/core/SkCanvas.h"
|
||||
#include "third_party/skia/include/core/SkPath.h"
|
||||
#include "third_party/skia/include/core/SkSurface.h"
|
||||
#include "third_party/skia/include/core/SkVertices.h"
|
||||
|
||||
namespace flutter {
|
||||
|
||||
namespace testing {
|
||||
|
||||
class CanvasProvider {
|
||||
public:
|
||||
virtual ~CanvasProvider() = default;
|
||||
virtual const std::string BackendName() = 0;
|
||||
virtual void InitializeSurface(const size_t width, const size_t height) = 0;
|
||||
virtual sk_sp<SkSurface> GetSurface() = 0;
|
||||
virtual sk_sp<SkSurface> MakeOffscreenSurface(const size_t width,
|
||||
const size_t height) = 0;
|
||||
|
||||
virtual bool Snapshot(std::string filename) {
|
||||
auto image = GetSurface()->makeImageSnapshot();
|
||||
if (!image) {
|
||||
return false;
|
||||
}
|
||||
auto raster = image->makeRasterImage();
|
||||
if (!raster) {
|
||||
return false;
|
||||
}
|
||||
auto data = raster->encodeToData();
|
||||
if (!data) {
|
||||
return false;
|
||||
}
|
||||
fml::NonOwnedMapping mapping(static_cast<const uint8_t*>(data->data()),
|
||||
data->size());
|
||||
return WriteAtomically(OpenFixturesDirectory(), filename.c_str(), mapping);
|
||||
}
|
||||
};
|
||||
|
||||
// Benchmarks
|
||||
|
||||
void BM_DrawLine(benchmark::State& state,
|
||||
std::unique_ptr<CanvasProvider> canvas_provider);
|
||||
void BM_DrawRect(benchmark::State& state,
|
||||
std::unique_ptr<CanvasProvider> canvas_provider);
|
||||
void BM_DrawCircle(benchmark::State& state,
|
||||
std::unique_ptr<CanvasProvider> canvas_provider);
|
||||
void BM_DrawOval(benchmark::State& state,
|
||||
std::unique_ptr<CanvasProvider> canvas_provider);
|
||||
void BM_DrawArc(benchmark::State& state,
|
||||
std::unique_ptr<CanvasProvider> canvas_provider);
|
||||
void BM_DrawRRect(benchmark::State& state,
|
||||
std::unique_ptr<CanvasProvider> canvas_provider,
|
||||
SkRRect::Type type);
|
||||
void BM_DrawPath(benchmark::State& state,
|
||||
std::unique_ptr<CanvasProvider> canvas_provider,
|
||||
SkPath::Verb type);
|
||||
void BM_DrawPoints(benchmark::State& state,
|
||||
std::unique_ptr<CanvasProvider> canvas_provider,
|
||||
SkCanvas::PointMode mode);
|
||||
void BM_DrawVertices(benchmark::State& state,
|
||||
std::unique_ptr<CanvasProvider> canvas_provider,
|
||||
SkVertices::VertexMode mode);
|
||||
void BM_DrawImage(benchmark::State& state,
|
||||
std::unique_ptr<CanvasProvider> canvas_provider,
|
||||
const SkSamplingOptions& options,
|
||||
bool upload_bitmap);
|
||||
void BM_DrawImageRect(benchmark::State& state,
|
||||
std::unique_ptr<CanvasProvider> canvas_provider,
|
||||
const SkSamplingOptions& options,
|
||||
SkCanvas::SrcRectConstraint constraint,
|
||||
bool upload_bitmap);
|
||||
void BM_DrawImageNine(benchmark::State& state,
|
||||
std::unique_ptr<CanvasProvider> canvas_provider,
|
||||
const SkFilterMode filter,
|
||||
bool upload_bitmap);
|
||||
void BM_DrawTextBlob(benchmark::State& state,
|
||||
std::unique_ptr<CanvasProvider> canvas_provider);
|
||||
void BM_DrawShadow(benchmark::State& state,
|
||||
std::unique_ptr<CanvasProvider> canvas_provider,
|
||||
bool transparent_occluder,
|
||||
SkPath::Verb type);
|
||||
|
||||
// clang-format off
|
||||
|
||||
#define RUN_DISPLAYLIST_BENCHMARKS(BACKEND) \
|
||||
\
|
||||
/* \
|
||||
* DrawLine \
|
||||
*/ \
|
||||
BENCHMARK_CAPTURE(BM_DrawLine, BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>()) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(16, 2048) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
/* \
|
||||
* DrawRect \
|
||||
*/ \
|
||||
BENCHMARK_CAPTURE(BM_DrawRect, BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>()) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(16, 2048) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
/* \
|
||||
* DrawOval \
|
||||
*/ \
|
||||
BENCHMARK_CAPTURE(BM_DrawOval, BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>()) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(16, 2048) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
/* \
|
||||
* DrawCircle \
|
||||
*/ \
|
||||
BENCHMARK_CAPTURE(BM_DrawCircle, BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>()) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(16, 2048) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
/* \
|
||||
* DrawArc \
|
||||
*/ \
|
||||
BENCHMARK_CAPTURE(BM_DrawArc, BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>()) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(128, 2048) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
/* \
|
||||
* DrawPath \
|
||||
*/ \
|
||||
BENCHMARK_CAPTURE(BM_DrawPath, \
|
||||
Lines/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkPath::Verb::kLine_Verb) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(8, 1024) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond) \
|
||||
->Complexity(); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawPath, \
|
||||
Quads/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkPath::Verb::kQuad_Verb) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(8, 1024) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond) \
|
||||
->Complexity(); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawPath, \
|
||||
Conics/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkPath::Verb::kConic_Verb) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(8, 1024) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond) \
|
||||
->Complexity(); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawPath, \
|
||||
Cubics/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkPath::Verb::kCubic_Verb) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(8, 1024) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond) \
|
||||
->Complexity(); \
|
||||
\
|
||||
/* \
|
||||
* DrawPoints \
|
||||
*/ \
|
||||
BENCHMARK_CAPTURE(BM_DrawPoints, Points/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkCanvas::kPoints_PointMode) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(1024, 32768) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawPoints, Lines/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkCanvas::kLines_PointMode) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(1024, 32768) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawPoints, Polygon/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkCanvas::kPolygon_PointMode) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(1024, 32768) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
/* \
|
||||
* DrawVertices \
|
||||
*/ \
|
||||
BENCHMARK_CAPTURE(BM_DrawVertices, \
|
||||
TriangleStrip/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkVertices::VertexMode::kTriangleStrip_VertexMode) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(16, 2048) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond) \
|
||||
->Complexity(); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawVertices, \
|
||||
TriangleFan/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkVertices::VertexMode::kTriangleFan_VertexMode) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(16, 2048) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond) \
|
||||
->Complexity(); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawVertices, \
|
||||
Triangles/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkVertices::VertexMode::kTriangles_VertexMode) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(16, 2048) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond) \
|
||||
->Complexity(); \
|
||||
\
|
||||
/* \
|
||||
* DrawRRect \
|
||||
*/ \
|
||||
BENCHMARK_CAPTURE(BM_DrawRRect, Symmetric/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkRRect::Type::kSimple_Type) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(16, 2048) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawRRect, NinePatch/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkRRect::Type::kNinePatch_Type) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(16, 2048) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawRRect, Complex/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkRRect::Type::kComplex_Type) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(16, 2048) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
/* \
|
||||
* DrawImage \
|
||||
*/ \
|
||||
BENCHMARK_CAPTURE(BM_DrawImage, Texture/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkSamplingOptions(), false) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(128, 1024) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawImage, Upload/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkSamplingOptions(), true) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(128, 1024) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
/* \
|
||||
* DrawImageRect \
|
||||
*/ \
|
||||
BENCHMARK_CAPTURE( \
|
||||
BM_DrawImageRect, Texture/Strict/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), SkSamplingOptions(), \
|
||||
SkCanvas::SrcRectConstraint::kStrict_SrcRectConstraint, false) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(32, 256) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE( \
|
||||
BM_DrawImageRect, Texture/Fast/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), SkSamplingOptions(), \
|
||||
SkCanvas::SrcRectConstraint::kFast_SrcRectConstraint, false) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(32, 256) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE( \
|
||||
BM_DrawImageRect, Upload/Strict/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), SkSamplingOptions(), \
|
||||
SkCanvas::SrcRectConstraint::kStrict_SrcRectConstraint, true) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(32, 256) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE( \
|
||||
BM_DrawImageRect, Upload/Fast/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), SkSamplingOptions(), \
|
||||
SkCanvas::SrcRectConstraint::kFast_SrcRectConstraint, true) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(32, 256) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
/* \
|
||||
* DrawImageNine \
|
||||
*/ \
|
||||
BENCHMARK_CAPTURE(BM_DrawImageNine, Texture/Nearest/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkFilterMode::kNearest, false) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(32, 256) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawImageNine, Upload/Nearest/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkFilterMode::kNearest, true) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(32, 256) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawImageNine, Texture/Linear/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkFilterMode::kLinear, false) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(32, 256) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawImageNine, Upload/Linear/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), \
|
||||
SkFilterMode::kLinear, true) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(32, 256) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
/* \
|
||||
* DrawTextBlob \
|
||||
*/ \
|
||||
BENCHMARK_CAPTURE(BM_DrawTextBlob, BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>()) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(1, 256) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond) \
|
||||
->Complexity(); \
|
||||
\
|
||||
/* \
|
||||
* DrawShadow \
|
||||
*/ \
|
||||
BENCHMARK_CAPTURE(BM_DrawShadow, Lines/Transparent/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), true, \
|
||||
SkPath::Verb::kLine_Verb) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(1, 32) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawShadow, Quads/Transparent/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), true, \
|
||||
SkPath::Verb::kQuad_Verb) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(1, 32) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawShadow, Conics/Transparent/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), true, \
|
||||
SkPath::Verb::kConic_Verb) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(1, 32) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawShadow, Cubics/Transparent/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), true, \
|
||||
SkPath::Verb::kCubic_Verb) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(1, 32) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawShadow, Lines/Opaque/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), false, \
|
||||
SkPath::Verb::kLine_Verb) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(1, 32) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawShadow, Quads/Opaque/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), false, \
|
||||
SkPath::Verb::kQuad_Verb) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(1, 32) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawShadow, Conics/Opaque/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), false, \
|
||||
SkPath::Verb::kConic_Verb) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(1, 32) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond); \
|
||||
\
|
||||
BENCHMARK_CAPTURE(BM_DrawShadow, Cubics/Opaque/BACKEND, \
|
||||
std::make_unique<BACKEND##CanvasProvider>(), false, \
|
||||
SkPath::Verb::kCubic_Verb) \
|
||||
->RangeMultiplier(2) \
|
||||
->Range(1, 32) \
|
||||
->UseRealTime() \
|
||||
->Unit(benchmark::kMillisecond);
|
||||
|
||||
// clang-format on
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
||||
#endif // FLUTTER_FLOW_DISPLAY_LIST_BENCHMARKS_H_
|
||||
@@ -1,60 +0,0 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/display_list/display_list_benchmarks.h"
|
||||
#include "flutter/testing/test_gl_surface.h"
|
||||
|
||||
#include "third_party/skia/include/core/SkCanvas.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
class OpenGLCanvasProvider : public CanvasProvider {
|
||||
public:
|
||||
virtual ~OpenGLCanvasProvider() = default;
|
||||
void InitializeSurface(const size_t width, const size_t height) override {
|
||||
surface_size_ = SkISize::Make(width, height);
|
||||
|
||||
gl_surface_ = std::make_unique<TestGLSurface>(surface_size_);
|
||||
gl_surface_->MakeCurrent();
|
||||
|
||||
const auto image_info = SkImageInfo::MakeN32Premul(surface_size_);
|
||||
surface_ = SkSurface::MakeRenderTarget(
|
||||
gl_surface_->GetGrContext().get(), SkBudgeted::kNo, image_info, 1,
|
||||
kTopLeft_GrSurfaceOrigin, nullptr, false);
|
||||
surface_->getCanvas()->clear(SK_ColorTRANSPARENT);
|
||||
}
|
||||
|
||||
sk_sp<SkSurface> GetSurface() override {
|
||||
if (!gl_surface_->MakeCurrent()) {
|
||||
return nullptr;
|
||||
}
|
||||
return surface_;
|
||||
}
|
||||
|
||||
sk_sp<SkSurface> MakeOffscreenSurface(const size_t width,
|
||||
const size_t height) override {
|
||||
surface_size_ = SkISize::Make(width, height);
|
||||
const auto image_info = SkImageInfo::MakeN32Premul(surface_size_);
|
||||
|
||||
auto offscreen_surface = SkSurface::MakeRenderTarget(
|
||||
gl_surface_->GetGrContext().get(), SkBudgeted::kNo, image_info, 1,
|
||||
kTopLeft_GrSurfaceOrigin, nullptr, false);
|
||||
|
||||
offscreen_surface->getCanvas()->clear(SK_ColorTRANSPARENT);
|
||||
return offscreen_surface;
|
||||
}
|
||||
|
||||
const std::string BackendName() override { return "OpenGL"; }
|
||||
|
||||
private:
|
||||
SkISize surface_size_;
|
||||
sk_sp<SkSurface> surface_;
|
||||
std::unique_ptr<TestGLSurface> gl_surface_;
|
||||
};
|
||||
|
||||
RUN_DISPLAYLIST_BENCHMARKS(OpenGL)
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
@@ -1,48 +0,0 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/display_list/display_list_benchmarks.h"
|
||||
#include "flutter/testing/test_metal_surface.h"
|
||||
|
||||
#include "third_party/skia/include/core/SkCanvas.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
class MetalCanvasProvider : public CanvasProvider {
|
||||
public:
|
||||
virtual ~MetalCanvasProvider() = default;
|
||||
void InitializeSurface(const size_t width, const size_t height) override {
|
||||
metal_context_ = std::make_unique<TestMetalContext>();
|
||||
metal_surface_ =
|
||||
TestMetalSurface::Create(*metal_context_, SkISize::Make(width, height));
|
||||
metal_surface_->GetSurface()->getCanvas()->clear(SK_ColorTRANSPARENT);
|
||||
}
|
||||
|
||||
sk_sp<SkSurface> GetSurface() override {
|
||||
if (!metal_surface_) {
|
||||
return nullptr;
|
||||
}
|
||||
return metal_surface_->GetSurface();
|
||||
}
|
||||
|
||||
sk_sp<SkSurface> MakeOffscreenSurface(const size_t width,
|
||||
const size_t height) override {
|
||||
metal_offscreen_surface_ =
|
||||
TestMetalSurface::Create(*metal_context_, SkISize::Make(width, height));
|
||||
return metal_offscreen_surface_->GetSurface();
|
||||
}
|
||||
|
||||
const std::string BackendName() override { return "Metal"; }
|
||||
|
||||
private:
|
||||
std::unique_ptr<TestMetalContext> metal_context_;
|
||||
std::unique_ptr<TestMetalSurface> metal_surface_;
|
||||
std::unique_ptr<TestMetalSurface> metal_offscreen_surface_;
|
||||
};
|
||||
|
||||
RUN_DISPLAYLIST_BENCHMARKS(Metal)
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
Reference in New Issue
Block a user