From: mtklein Date: Wed, 16 Jul 2014 21:29:53 +0000 (-0700) Subject: Remove benches from DM. X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~6706 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=103ae71cdd6520f3059c3a18545ac18d5d649f91;p=platform%2Fupstream%2FlibSkiaSharp.git Remove benches from DM. This idea turned out to be more redundant than useful. BUG=skia: R=mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/399463003 --- diff --git a/dm/DM.cpp b/dm/DM.cpp index afe7573..c71450c 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -1,7 +1,6 @@ // Main binary for DM. // For a high-level overview, please see dm/README. -#include "Benchmark.h" #include "CrashHandler.h" #include "SkCommandLineFlags.h" #include "SkForceLinking.h" @@ -11,7 +10,6 @@ #include "Test.h" #include "gm.h" -#include "DMBenchTask.h" #include "DMCpuGMTask.h" #include "DMGpuGMTask.h" #include "DMGpuSupport.h" @@ -68,7 +66,6 @@ DEFINE_bool(leaks, false, "Print leaked instance-counted objects at exit?"); DEFINE_string(skps, "", "Directory to read skps from."); DEFINE_bool(gms, true, "Run GMs?"); -DEFINE_bool(benches, true, "Run benches? Does not run GMs-as-benches."); DEFINE_bool(tests, true, "Run tests?"); DECLARE_bool(verbose); @@ -130,34 +127,6 @@ static void kick_off_gms(const SkTDArray& gms, #undef START } -static void kick_off_benches(const SkTDArray& benches, - const SkTArray& configs, - GrGLStandard gpuAPI, - DM::Reporter* reporter, - DM::TaskRunner* tasks) { -#define START(name, type, ...) \ - if (lowercase(configs[j]).equals(name)) { \ - tasks->add(SkNEW_ARGS(DM::type, (name, reporter, tasks, benches[i], ## __VA_ARGS__))); \ - } - for (int i = 0; i < benches.count(); i++) { - for (int j = 0; j < configs.count(); j++) { - START("nonrendering", NonRenderingBenchTask); - START("565", CpuBenchTask, kRGB_565_SkColorType); - START("8888", CpuBenchTask, kN32_SkColorType); - START("gpu", GpuBenchTask, native, gpuAPI, 0); - START("msaa4", GpuBenchTask, native, gpuAPI, 4); - START("msaa16", GpuBenchTask, native, gpuAPI, 16); - START("nvprmsaa4", GpuBenchTask, nvpr, gpuAPI, 4); - START("nvprmsaa16", GpuBenchTask, nvpr, gpuAPI, 16); - START("gpunull", GpuBenchTask, null, gpuAPI, 0); - START("gpudebug", GpuBenchTask, debug, gpuAPI, 0); - START("angle", GpuBenchTask, angle, gpuAPI, 0); - START("mesa", GpuBenchTask, mesa, gpuAPI, 0); - } - } -#undef START -} - static void kick_off_tests(const SkTDArray& tests, DM::Reporter* reporter, DM::TaskRunner* tasks) { @@ -269,22 +238,16 @@ int tool_main(int argc, char** argv) { } } - SkTDArray benches; - if (FLAGS_benches) { - append_matching_factories(BenchRegistry::Head(), &benches); - } - SkTDArray tests; if (FLAGS_tests) { append_matching_factories(TestRegistry::Head(), &tests); } - SkDebugf("(%d GMs, %d benches) x %d configs, %d tests\n", - gms.count(), benches.count(), configs.count(), tests.count()); + SkDebugf("%d GMs x %d configs, %d tests\n", + gms.count(), configs.count(), tests.count()); DM::Reporter reporter; DM::TaskRunner tasks(FLAGS_threads, FLAGS_gpuThreads); kick_off_gms(gms, configs, gpuAPI, *expectations, &reporter, &tasks); - kick_off_benches(benches, configs, gpuAPI, &reporter, &tasks); kick_off_tests(tests, &reporter, &tasks); kick_off_skps(&reporter, &tasks); tasks.wait(); diff --git a/dm/DMBenchTask.cpp b/dm/DMBenchTask.cpp deleted file mode 100644 index 9bdbbf2..0000000 --- a/dm/DMBenchTask.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include "DMBenchTask.h" -#include "DMUtil.h" -#include "SkSurface.h" - -namespace DM { - -static SkString bench_name(const char* name, const char* config) { - SkString result("bench "); - result.appendf("%s_%s", name, config); - return result; -} - -NonRenderingBenchTask::NonRenderingBenchTask(const char* config, - Reporter* reporter, - TaskRunner* tasks, - BenchRegistry::Factory factory) - : CpuTask(reporter, tasks) - , fBench(factory(NULL)) - , fName(bench_name(fBench->getName(), config)) {} - -CpuBenchTask::CpuBenchTask(const char* config, - Reporter* reporter, - TaskRunner* tasks, - BenchRegistry::Factory factory, - SkColorType colorType) - : CpuTask(reporter, tasks) - , fBench(factory(NULL)) - , fName(bench_name(fBench->getName(), config)) - , fColorType(colorType) {} - -GpuBenchTask::GpuBenchTask(const char* config, - Reporter* reporter, - TaskRunner* tasks, - BenchRegistry::Factory factory, - GrContextFactory::GLContextType contextType, - GrGLStandard gpuAPI, - int sampleCount) - : GpuTask(reporter, tasks) - , fBench(factory(NULL)) - , fName(bench_name(fBench->getName(), config)) - , fContextType(contextType) - , fGpuAPI(gpuAPI) - , fSampleCount(sampleCount) {} - -bool NonRenderingBenchTask::shouldSkip() const { - return !fBench->isSuitableFor(Benchmark::kNonRendering_Backend); -} - -bool CpuBenchTask::shouldSkip() const { - return !fBench->isSuitableFor(Benchmark::kRaster_Backend); -} - -bool GpuBenchTask::shouldSkip() const { - return kGPUDisabled || !fBench->isSuitableFor(Benchmark::kGPU_Backend); -} - -static void draw_raster(Benchmark* bench, SkColorType colorType) { - SkBitmap bitmap; - AllocatePixels(colorType, bench->getSize().x(), bench->getSize().y(), &bitmap); - SkCanvas canvas(bitmap); - - bench->preDraw(); - bench->draw(1, &canvas); -} - -void NonRenderingBenchTask::draw() { - draw_raster(fBench.get(), kN32_SkColorType); -} - -void CpuBenchTask::draw() { - draw_raster(fBench.get(), fColorType); -} - -void GpuBenchTask::draw(GrContextFactory* grFactory) { - SkImageInfo info = SkImageInfo::Make(fBench->getSize().x(), - fBench->getSize().y(), - kN32_SkColorType, - kPremul_SkAlphaType); - SkAutoTUnref surface(NewGpuSurface(grFactory, fContextType, fGpuAPI, info, - fSampleCount)); - if (!surface) { - this->fail("Could not create context for the config and the api."); - return; - } - fBench->preDraw(); - fBench->draw(1, surface->getCanvas()); -} - -} // namespace DM diff --git a/dm/DMBenchTask.h b/dm/DMBenchTask.h deleted file mode 100644 index d2b5800..0000000 --- a/dm/DMBenchTask.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef DMBenchTask_DEFINED -#define DMBenchTask_DEFINED - -#include "Benchmark.h" -#include "DMReporter.h" -#include "DMTask.h" -#include "DMTaskRunner.h" -#include "SkString.h" -#include "SkTemplates.h" - -// Tasks that run an Benchmark once as a check that it doesn't crash. - -namespace DM { - -class NonRenderingBenchTask : public CpuTask { -public: - NonRenderingBenchTask(const char* config, Reporter*, TaskRunner*, BenchRegistry::Factory); - - virtual void draw() SK_OVERRIDE; - virtual bool shouldSkip() const SK_OVERRIDE; - virtual SkString name() const SK_OVERRIDE { return fName; } - -private: - SkAutoTDelete fBench; - const SkString fName; -}; - -class CpuBenchTask : public CpuTask { -public: - CpuBenchTask(const char* config, Reporter*, TaskRunner*, BenchRegistry::Factory, SkColorType); - - virtual void draw() SK_OVERRIDE; - virtual bool shouldSkip() const SK_OVERRIDE; - virtual SkString name() const SK_OVERRIDE { return fName; } - -private: - SkAutoTDelete fBench; - const SkString fName; - const SkColorType fColorType; -}; - -class GpuBenchTask : public GpuTask { -public: - GpuBenchTask(const char* config, - Reporter*, - TaskRunner*, - BenchRegistry::Factory, - GrContextFactory::GLContextType, - GrGLStandard gpuAPI, - int sampleCount); - - virtual void draw(GrContextFactory*) SK_OVERRIDE; - virtual bool shouldSkip() const SK_OVERRIDE; - virtual SkString name() const SK_OVERRIDE { return fName; } - -private: - SkAutoTDelete fBench; - const SkString fName; - const GrContextFactory::GLContextType fContextType; - const GrGLStandard fGpuAPI; - int fSampleCount; -}; - -} // namespace DM - -#endif // DMBenchTask_DEFINED diff --git a/dm/DMUtil.h b/dm/DMUtil.h index c202b04..8de767d 100644 --- a/dm/DMUtil.h +++ b/dm/DMUtil.h @@ -1,7 +1,6 @@ #ifndef DMUtil_DEFINED #define DMUtil_DEFINED -#include "Benchmark.h" #include "SkBitmap.h" #include "SkString.h" #include "gm_expectations.h" diff --git a/gyp/dm.gyp b/gyp/dm.gyp index a2ef037..51c8569 100644 --- a/gyp/dm.gyp +++ b/gyp/dm.gyp @@ -7,7 +7,6 @@ 'target_name': 'dm', 'type': 'executable', 'include_dirs': [ - '../bench', '../dm', '../gm', '../tests', @@ -21,14 +20,12 @@ '../tools', ], 'includes': [ - 'bench.gypi', 'gmslides.gypi', 'pathops_unittest.gypi', 'tests.gypi', ], 'sources': [ '../dm/DM.cpp', - '../dm/DMBenchTask.cpp', '../dm/DMCpuGMTask.cpp', '../dm/DMExpectationsTask.cpp', '../dm/DMGpuGMTask.cpp',