diff options
author | 2016-05-11 06:40:32 -0700 | |
---|---|---|
committer | 2016-05-11 06:40:32 -0700 | |
commit | fbb3102d0e5f4c7d4b89d710f806b163ae27c3c8 (patch) | |
tree | 2b8d5d06e384e9b5b539a6cee737f8d46d75bd7b /bench/SkBlend_optsBench.cpp | |
parent | 8b7451aaf6b1c71e9d343a4df107893db277b6aa (diff) |
Revert "Add tests and benches to support the sRGB blitter for SkOpts"
This reverts commit 554784cd85029c05d9ed04b1aeb71520d196153a and
1956b4ae1c9a47833b174f31c054d347ea04db09
Reason for revert - ASAN failures, e.g. from https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-MSAN/builds/2233/steps/perf_skia%20on%20Ubuntu/logs/stdio :
Uninitialized value was created by a heap allocation
0 0x7f69aa96f799 in operator new[](unsigned long) /b/work/skia/third_party/externals/llvm/out/../projects/compiler-rt/lib/msan/msan_new_delete.cc:37
1 0x7f69aaa315c1 in SkAutoTArray<unsigned int>::reset(int) /b/work/skia/out/Build-Ubuntu-GCC-x86_64-Debug-MSAN/Debug/../../../include/private/../private/SkTemplates.h:137:22
2 0x7f69aaa34ee9 in LinearSrcOverBench<SrcOverVSkOptsSSE41>::LinearSrcOverBench(char const*) /b/work/skia/out/Build-Ubuntu-GCC-x86_64-Debug-MSAN/Debug/../../../bench/SkBlend_optsBench.cpp:108:9
3 0x7f69aaa30cf2 in $_24::operator()(void*) const /b/work/skia/out/Build-Ubuntu-GCC-x86_64-Debug-MSAN/Debug/../../../bench/SkBlend_optsBench.cpp:167:1
4 0x7f69aaa30c87 in $_24::__invoke(void*) /b/work/skia/out/Build-Ubuntu-GCC-x86_64-Debug-MSAN/Debug/../../../bench/SkBlend_optsBench.cpp:167:1
5 0x7f69aaa68856 in BenchmarkStream::rawNext() /b/work/skia/out/Build-Ubuntu-GCC-x86_64-Debug-MSAN/Debug/../../../bench/nanobench.cpp:653:32
6 0x7f69aaa61467 in BenchmarkStream::next() /b/work/skia/out/Build-Ubuntu-GCC-x86_64-Debug-MSAN/Debug/../../../bench/nanobench.cpp:642:25
7 0x7f69aaa5b703 in nanobench_main() /b/work/skia/out/Build-Ubuntu-GCC-x86_64-Debug-MSAN/Debug/../../../bench/nanobench.cpp:1119:27
8 0x7f69aaa5e10d in main /b/work/skia/out/Build-Ubuntu-GCC-x86_64-Debug-MSAN/Debug/../../../bench/nanobench.cpp:1290:12
9 0x7f69a8c95ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287
TBR=herb@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1969803002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Review-Url: https://codereview.chromium.org/1969803002
Diffstat (limited to 'bench/SkBlend_optsBench.cpp')
-rw-r--r-- | bench/SkBlend_optsBench.cpp | 167 |
1 files changed, 0 insertions, 167 deletions
diff --git a/bench/SkBlend_optsBench.cpp b/bench/SkBlend_optsBench.cpp deleted file mode 100644 index 24f1f85229..0000000000 --- a/bench/SkBlend_optsBench.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include <tuple> - -#include "Benchmark.h" -#include "Resources.h" -#include "SkCpu.h" -#include "SkImage.h" -#include "SkImage_Base.h" -#include "SkNx.h" -#include "SkOpts.h" -#include "SkString.h" - -#define INNER_LOOPS 10 - -namespace sk_default { -extern void brute_force_srcover_srgb_srgb( - uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); -} - -class SrcOverVSkOptsBruteForce { -public: - static SkString Name() { return SkString{"VSkOptsBruteForce"}; } - static bool WorksOnCpu() { return true; } - static void BlendN(uint32_t* dst, int count, const uint32_t* src) { - sk_default::brute_force_srcover_srgb_srgb(dst, src, count, count); - } -}; - -namespace sk_default { -extern void trivial_srcover_srgb_srgb( - uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); -} - -class SrcOverVSkOptsTrivial { -public: - static SkString Name() { return SkString{"VSkOptsTrivial"}; } - static bool WorksOnCpu() { return true; } - static void BlendN(uint32_t* dst, int count, const uint32_t* src) { - sk_default::trivial_srcover_srgb_srgb(dst, src, count, count); - } -}; - -namespace sk_default { -extern void best_non_simd_srcover_srgb_srgb( - uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); -} - -class SrcOverVSkOptsNonSimdCore { -public: - static SkString Name() { return SkString{"VSkOptsNonSimdCore"}; } - static bool WorksOnCpu() { return true; } - static void BlendN(uint32_t* dst, int count, const uint32_t* src) { - sk_default::best_non_simd_srcover_srgb_srgb(dst, src, count, count); - } -}; - -namespace sk_default { -extern void srcover_srgb_srgb( - uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); -} - -class SrcOverVSkOptsDefault { -public: - static SkString Name() { return SkString{"VSkOptsDefault"}; } - static bool WorksOnCpu() { return true; } - static void BlendN(uint32_t* dst, int count, const uint32_t* src) { - sk_default::srcover_srgb_srgb(dst, src, count, count); - } -}; - -namespace sk_sse41 { - extern void srcover_srgb_srgb( - uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); -} - -class SrcOverVSkOptsSSE41 { -public: - static SkString Name() { return SkString{"VSkOptsSSE41"}; } - static bool WorksOnCpu() { return SkCpu::Supports(SkCpu::SSE41); } - static void BlendN(uint32_t* dst, int count, const uint32_t* src) { - sk_sse41::srcover_srgb_srgb(dst, src, count, count); - } -}; - -/////////////////////////////////////////////////////////////////////////////////////////////////// - -template <typename Blender> -class LinearSrcOverBench : public Benchmark { -public: - LinearSrcOverBench(const char* fileName) { - fName = "LinearSrcOver"; - fName.append(fileName); - fName.append(Blender::Name()); - - sk_sp<SkImage> image = GetResourceAsImage(fileName); - SkBitmap bm; - if (!as_IB(image)->getROPixels(&bm)) { - SkFAIL("Could not read resource"); - } - bm.peekPixels(&fPixmap); - fCount = fPixmap.rowBytesAsPixels(); - fDst.reset(fCount); - - } - -protected: - bool isSuitableFor(Backend backend) override { - return backend == kNonRendering_Backend && Blender::WorksOnCpu(); - } - const char* onGetName() override { return fName.c_str(); } - void onDraw(int loops, SkCanvas*) override { - SkASSERT(fPixmap.colorType() == kN32_SkColorType); - - const int width = fPixmap.rowBytesAsPixels(); - - for (int i = 0; i < loops * INNER_LOOPS; ++i) { - const uint32_t* src = fPixmap.addr32(); - for (int y = 0; y < fPixmap.height(); y++) { - Blender::BlendN(fDst.get(), width, src); - src += width; - } - } - } - - void onPostDraw(SkCanvas*) override { - // Make sure the compiler does not optimize away the operation. - volatile uint32_t v = 0; - for (int i = 0; i < fCount; i++) { - v ^= fDst[i]; - } - } - -private: - int fCount; - SkAutoTArray<uint32_t> fDst; - SkString fName; - SkPixmap fPixmap; - - typedef Benchmark INHERITED; -}; - -#if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) -#define BENCHES(fileName) \ -DEF_BENCH( return new LinearSrcOverBench<SrcOverVSkOptsBruteForce>(fileName); ) \ -DEF_BENCH( return new LinearSrcOverBench<SrcOverVSkOptsTrivial>(fileName); ) \ -DEF_BENCH( return new LinearSrcOverBench<SrcOverVSkOptsNonSimdCore>(fileName); ) \ -DEF_BENCH( return new LinearSrcOverBench<SrcOverVSkOptsDefault>(fileName); ) \ -DEF_BENCH( return new LinearSrcOverBench<SrcOverVSkOptsSSE41>(fileName); ) -#else -#define BENCHES(fileName) \ -DEF_BENCH( return new LinearSrcOverBench<SrcOverVSkOptsBruteForce>(fileName); ) \ -DEF_BENCH( return new LinearSrcOverBench<SrcOverVSkOptsTrivial>(fileName); ) \ -DEF_BENCH( return new LinearSrcOverBench<SrcOverVSkOptsNonSimdCore>(fileName); ) \ -DEF_BENCH( return new LinearSrcOverBench<SrcOverVSkOptsDefault>(fileName); ) -#endif - -BENCHES("yellow_rose.png") -BENCHES("baby_tux.png") -BENCHES("plane.png") -BENCHES("mandrill_512.png") -BENCHES("iconstrip.png") |