skia2/dm/DM.cpp

1433 lines
49 KiB
C++
Raw Normal View History

/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "CrashHandler.h"
#include "DMJsonWriter.h"
#include "DMSrcSink.h"
#include "DMSrcSinkAndroid.h"
#include "ProcStats.h"
#include "Resources.h"
#include "SkBBHFactory.h"
#include "SkChecksum.h"
#include "SkCodec.h"
#include "SkColorPriv.h"
#include "SkCommonFlags.h"
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
#include "SkCommonFlagsConfig.h"
#include "SkData.h"
#include "SkFontMgr.h"
#include "SkGraphics.h"
#include "SkHalf.h"
#include "SkMD5.h"
#include "SkMutex.h"
#include "SkOSFile.h"
#include "SkPM4fPriv.h"
#include "SkSpinlock.h"
#include "SkTHash.h"
#include "SkTaskGroup.h"
#include "SkThreadUtils.h"
#include "Test.h"
#include "Timer.h"
#include "picture_utils.h"
#include "sk_tool_utils.h"
#ifdef SK_PDF_IMAGE_STATS
extern void SkPDFImageDumpStats();
#endif
#include "png.h"
#include <stdlib.h>
#ifndef SK_BUILD_FOR_WIN32
#include <unistd.h>
#endif
DEFINE_string(src, "tests gm skp image", "Source types to test.");
DEFINE_bool(nameByHash, false,
"If true, write to FLAGS_writePath[0]/<hash>.png instead of "
"to FLAGS_writePath[0]/<config>/<sourceType>/<sourceOptions>/<name>.png");
DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests.");
DEFINE_string(matrix, "1 0 0 1",
"2x2 scale+skew matrix to apply or upright when using "
"'matrix' or 'upright' in config.");
DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?");
DEFINE_string(blacklist, "",
"Space-separated config/src/srcOptions/name quadruples to blacklist. '_' matches anything. E.g. \n"
"'--blacklist gpu skp _ _' will blacklist all SKPs drawn into the gpu config.\n"
"'--blacklist gpu skp _ _ 8888 gm _ aarects' will also blacklist the aarects GM on 8888.");
DEFINE_string2(readPath, r, "", "If set check for equality with golden results in this directory.");
DEFINE_string(uninterestingHashesFile, "",
"File containing a list of uninteresting hashes. If a result hashes to something in "
"this list, no image is written for that result.");
DEFINE_int32(shards, 1, "We're splitting source data into this many shards.");
DEFINE_int32(shard, 0, "Which shard do I run?");
DEFINE_bool(simpleCodec, false, "Only decode images to native scale");
using namespace DM;
using sk_gpu_test::GrContextFactory;
using sk_gpu_test::GLTestContext;
using sk_gpu_test::ContextInfo;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
static const double kStartMs = SkTime::GetMSecs();
static FILE* gVLog;
template <typename... Args>
static void vlog(const char* fmt, Args&&... args) {
if (gVLog) {
fprintf(gVLog, "%s\t", HumanizeMs(SkTime::GetMSecs() - kStartMs).c_str());
fprintf(gVLog, fmt, args...);
fflush(gVLog);
}
}
template <typename... Args>
static void info(const char* fmt, Args&&... args) {
vlog(fmt, args...);
if (!FLAGS_quiet) {
printf(fmt, args...);
}
}
static void info(const char* fmt) {
if (!FLAGS_quiet) {
printf("%s", fmt); // Clang warns printf(fmt) is insecure.
}
}
SK_DECLARE_STATIC_MUTEX(gFailuresMutex);
static SkTArray<SkString> gFailures;
static void fail(const SkString& err) {
SkAutoMutexAcquire lock(gFailuresMutex);
SkDebugf("\n\nFAILURE: %s\n\n", err.c_str());
gFailures.push_back(err);
}
// We use a spinlock to make locking this in a signal handler _somewhat_ safe.
static SkSpinlock gMutex;
static int32_t gPending;
static SkTArray<SkString> gRunning;
static void done(const char* config, const char* src, const char* srcOptions, const char* name) {
SkString id = SkStringPrintf("%s %s %s %s", config, src, srcOptions, name);
vlog("done %s\n", id.c_str());
int pending;
{
SkAutoTAcquire<SkSpinlock> lock(gMutex);
for (int i = 0; i < gRunning.count(); i++) {
if (gRunning[i] == id) {
gRunning.removeShuffle(i);
break;
}
}
pending = --gPending;
}
// We write our dm.json file every once in a while in case we crash.
// Notice this also handles the final dm.json when pending == 0.
if (pending % 500 == 0) {
JsonWriter::DumpJson();
}
}
static void start(const char* config, const char* src, const char* srcOptions, const char* name) {
SkString id = SkStringPrintf("%s %s %s %s", config, src, srcOptions, name);
vlog("start %s\n", id.c_str());
SkAutoTAcquire<SkSpinlock> lock(gMutex);
gRunning.push_back(id);
}
static void print_status() {
int curr = sk_tools::getCurrResidentSetSizeMB(),
peak = sk_tools::getMaxResidentSetSizeMB();
SkString elapsed = HumanizeMs(SkTime::GetMSecs() - kStartMs);
SkAutoTAcquire<SkSpinlock> lock(gMutex);
info("\n%s elapsed, %d active, %d queued, %dMB RAM, %dMB peak\n",
elapsed.c_str(), gRunning.count(), gPending - gRunning.count(), curr, peak);
for (auto& task : gRunning) {
info("\t%s\n", task.c_str());
}
}
// Yo dawg, I heard you like signals so I caught a signal in your
// signal handler so you can handle signals while you handle signals.
// Let's not get into that situation. Only print if we're the first ones to get a crash signal.
static std::atomic<bool> in_signal_handler{false};
#if defined(SK_BUILD_FOR_WIN32)
static LONG WINAPI handler(EXCEPTION_POINTERS* e) {
static const struct {
const char* name;
DWORD code;
} kExceptions[] = {
#define _(E) {#E, E}
_(EXCEPTION_ACCESS_VIOLATION),
_(EXCEPTION_BREAKPOINT),
_(EXCEPTION_INT_DIVIDE_BY_ZERO),
_(EXCEPTION_STACK_OVERFLOW),
// TODO: more?
#undef _
};
if (!in_signal_handler.exchange(true)) {
const DWORD code = e->ExceptionRecord->ExceptionCode;
info("\nCaught exception %u", code);
for (const auto& exception : kExceptions) {
if (exception.code == code) {
info(" %s", exception.name);
}
}
info("\n");
print_status();
fflush(stdout);
}
// Execute default exception handler... hopefully, exit.
return EXCEPTION_EXECUTE_HANDLER;
}
static void setup_crash_handler() { SetUnhandledExceptionFilter(handler); }
print stack trace on crash, tweak formatting, _Exit hard Mac example: 1 srcs * 1 sinks + 0 tests == 1 tasks 0ns elapsed, 1 active, 0 queued, 11MB RAM, 11MB peak f16 gm dstreadshuffle ../../src/core/SkXfermode.cpp:935: fatal error: ""r.fVec[i] >= min && r.fVec[i] <= max"" Caught signal 6 [Abort trap: 6], was running: f16 gm dstreadshuffle Stack trace: 0 dm 0x000000010f23fc9d _ZZL19setup_crash_handlervENK3$_5clEi + 397 1 dm 0x000000010f23fb06 _ZZL19setup_crash_handlervEN3$_58__invokeEi + 22 2 libsystem_platform.dylib 0x00007fff9d44e52a _sigtramp + 26 3 ??? 0x00007fff9900b902 0x0 + 140735760349442 4 libsystem_c.dylib 0x00007fff96a836e7 abort + 129 5 dm 0x000000010fcb67c9 _Z17sk_abort_no_printv + 9 6 dm 0x000000010f90fc1f _ZL11assert_unitRK6SkPM4f + 175 7 dm 0x000000010f90e957 _Z7proc_4fIXadL_ZL10lighten_4fRK4SkNxILi4EfES3_EEE6SkPM4fRKS4_S6_ + 103 8 dm 0x000000010f918946 _Z10xfer_u64_nIL7DstType1EEvPK10SkXfermodePyPK6SkPM4fiPKh + 182 9 dm 0x000000010f7a5f3e _ZN22SkState_Shader_BlitterI7State64E9blitAntiHEiiPKhPKs + 398 10 dm 0x000000010f3c730c _ZN9SkBlitter10blitAntiH2Eiijj + 108 11 dm 0x000000010f8d76f4 _ZN25Vertish_SkAntiHairBlitter7drawCapEiiii + 164 12 dm 0x000000010f8d4d92 _ZL16do_anti_hairlineiiiiPK7SkIRectP9SkBlitter + 3058 13 dm 0x000000010f8d40f4 _ZN6SkScan15AntiHairLineRgnEPK7SkPointiPK8SkRegionP9SkBlitter + 900 14 dm 0x000000010f8d8fff _ZL8hairquadPK7SkPointPK8SkRegionP9SkBlitteriPFvS1_iS4_S6_E + 719 15 dm 0x000000010f8da838 _Z9hair_pathILN7SkPaint3CapE0EEvRK6SkPathRK12SkRasterClipP9SkBlitterPFvPK7SkPointiPK8SkRegionS9_E + 1048 16 dm 0x000000010f8d86dc _ZN6SkScan12AntiHairPathERK6SkPathRK12SkRasterClipP9SkBlitter + 44 17 dm 0x000000010f7da8ff _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixbbP9SkBlitter + 2239 18 dm 0x000000010f774993 _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixb + 83 19 dm 0x000000010f774031 _ZN14SkBitmapDevice8drawPathERK6SkDrawRK6SkPathRK7SkPaintPK8SkMatrixb + 97 20 dm 0x000000010f773f6b _ZN14SkBitmapDevice8drawOvalERK6SkDrawRK6SkRectRK7SkPaint + 139 21 dm 0x000000010f7b5072 _ZN8SkCanvas10onDrawOvalERK6SkRectRK7SkPaint + 626 22 dm 0x000000010f7b38a5 _ZN8SkCanvas8drawOvalERK6SkRectRK7SkPaint + 69 23 dm 0x000000010f7b9ee6 _ZN8SkCanvas10drawCircleEfffRK7SkPaint + 294 24 dm 0x000000010f614039 _ZN6skiagm14DstReadShuffle9drawShapeEP8SkCanvasP7SkPaintNS0_9ShapeTypeE + 249 25 dm 0x000000010f613b89 _ZN6skiagm14DstReadShuffle6onDrawEP8SkCanvas + 425 26 dm 0x000000010f268b17 _ZN6skiagm2GM11drawContentEP8SkCanvas + 71 27 dm 0x000000010f268a6c _ZN6skiagm2GM4drawEP8SkCanvas + 60 28 dm 0x000000010f25186b _ZNK2DM5GMSrc4drawEP8SkCanvas + 123 29 dm 0x000000010f256de7 _ZNK2DM10RasterSink4drawERKNS_3SrcEP8SkBitmapP9SkWStreamP8SkString + 295 30 dm 0x000000010f246a96 _ZN4Task3RunERKS_ + 358 31 dm 0x000000010f2447e5 _ZZ7dm_mainvENK3$_3clEv + 21 32 dm 0x000000010f2447bd _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZ7dm_mainvE3$_3EEEvDpOT_ + 45 33 dm 0x000000010f24475c _ZNSt3__110__function6__funcIZ7dm_mainvE3$_3NS_9allocatorIS2_EEFvvEEclEv + 44 34 dm 0x000000010f406aba _ZNKSt3__18functionIFvvEEclEv + 26 35 dm 0x000000010f8fc168 _ZN12_GLOBAL__N_110ThreadPool4WaitEP8SkAtomicIiL15sk_memory_order5EE + 328 36 dm 0x000000010f8fc00c _ZN11SkTaskGroup4waitEv + 28 37 dm 0x000000010f23e9c4 _Z7dm_mainv + 1940 38 dm 0x000000010f23fa77 main + 39 39 dm 0x000000010f23e1a4 start + 52 40 ??? 0x0000000000000007 0x0 + 7 BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1753503002 Review URL: https://codereview.chromium.org/1753503002
2016-03-01 01:02:52 +00:00
#elif !defined(SK_BUILD_FOR_ANDROID)
#include <execinfo.h>
#include <signal.h>
print stack trace on crash, tweak formatting, _Exit hard Mac example: 1 srcs * 1 sinks + 0 tests == 1 tasks 0ns elapsed, 1 active, 0 queued, 11MB RAM, 11MB peak f16 gm dstreadshuffle ../../src/core/SkXfermode.cpp:935: fatal error: ""r.fVec[i] >= min && r.fVec[i] <= max"" Caught signal 6 [Abort trap: 6], was running: f16 gm dstreadshuffle Stack trace: 0 dm 0x000000010f23fc9d _ZZL19setup_crash_handlervENK3$_5clEi + 397 1 dm 0x000000010f23fb06 _ZZL19setup_crash_handlervEN3$_58__invokeEi + 22 2 libsystem_platform.dylib 0x00007fff9d44e52a _sigtramp + 26 3 ??? 0x00007fff9900b902 0x0 + 140735760349442 4 libsystem_c.dylib 0x00007fff96a836e7 abort + 129 5 dm 0x000000010fcb67c9 _Z17sk_abort_no_printv + 9 6 dm 0x000000010f90fc1f _ZL11assert_unitRK6SkPM4f + 175 7 dm 0x000000010f90e957 _Z7proc_4fIXadL_ZL10lighten_4fRK4SkNxILi4EfES3_EEE6SkPM4fRKS4_S6_ + 103 8 dm 0x000000010f918946 _Z10xfer_u64_nIL7DstType1EEvPK10SkXfermodePyPK6SkPM4fiPKh + 182 9 dm 0x000000010f7a5f3e _ZN22SkState_Shader_BlitterI7State64E9blitAntiHEiiPKhPKs + 398 10 dm 0x000000010f3c730c _ZN9SkBlitter10blitAntiH2Eiijj + 108 11 dm 0x000000010f8d76f4 _ZN25Vertish_SkAntiHairBlitter7drawCapEiiii + 164 12 dm 0x000000010f8d4d92 _ZL16do_anti_hairlineiiiiPK7SkIRectP9SkBlitter + 3058 13 dm 0x000000010f8d40f4 _ZN6SkScan15AntiHairLineRgnEPK7SkPointiPK8SkRegionP9SkBlitter + 900 14 dm 0x000000010f8d8fff _ZL8hairquadPK7SkPointPK8SkRegionP9SkBlitteriPFvS1_iS4_S6_E + 719 15 dm 0x000000010f8da838 _Z9hair_pathILN7SkPaint3CapE0EEvRK6SkPathRK12SkRasterClipP9SkBlitterPFvPK7SkPointiPK8SkRegionS9_E + 1048 16 dm 0x000000010f8d86dc _ZN6SkScan12AntiHairPathERK6SkPathRK12SkRasterClipP9SkBlitter + 44 17 dm 0x000000010f7da8ff _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixbbP9SkBlitter + 2239 18 dm 0x000000010f774993 _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixb + 83 19 dm 0x000000010f774031 _ZN14SkBitmapDevice8drawPathERK6SkDrawRK6SkPathRK7SkPaintPK8SkMatrixb + 97 20 dm 0x000000010f773f6b _ZN14SkBitmapDevice8drawOvalERK6SkDrawRK6SkRectRK7SkPaint + 139 21 dm 0x000000010f7b5072 _ZN8SkCanvas10onDrawOvalERK6SkRectRK7SkPaint + 626 22 dm 0x000000010f7b38a5 _ZN8SkCanvas8drawOvalERK6SkRectRK7SkPaint + 69 23 dm 0x000000010f7b9ee6 _ZN8SkCanvas10drawCircleEfffRK7SkPaint + 294 24 dm 0x000000010f614039 _ZN6skiagm14DstReadShuffle9drawShapeEP8SkCanvasP7SkPaintNS0_9ShapeTypeE + 249 25 dm 0x000000010f613b89 _ZN6skiagm14DstReadShuffle6onDrawEP8SkCanvas + 425 26 dm 0x000000010f268b17 _ZN6skiagm2GM11drawContentEP8SkCanvas + 71 27 dm 0x000000010f268a6c _ZN6skiagm2GM4drawEP8SkCanvas + 60 28 dm 0x000000010f25186b _ZNK2DM5GMSrc4drawEP8SkCanvas + 123 29 dm 0x000000010f256de7 _ZNK2DM10RasterSink4drawERKNS_3SrcEP8SkBitmapP9SkWStreamP8SkString + 295 30 dm 0x000000010f246a96 _ZN4Task3RunERKS_ + 358 31 dm 0x000000010f2447e5 _ZZ7dm_mainvENK3$_3clEv + 21 32 dm 0x000000010f2447bd _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZ7dm_mainvE3$_3EEEvDpOT_ + 45 33 dm 0x000000010f24475c _ZNSt3__110__function6__funcIZ7dm_mainvE3$_3NS_9allocatorIS2_EEFvvEEclEv + 44 34 dm 0x000000010f406aba _ZNKSt3__18functionIFvvEEclEv + 26 35 dm 0x000000010f8fc168 _ZN12_GLOBAL__N_110ThreadPool4WaitEP8SkAtomicIiL15sk_memory_order5EE + 328 36 dm 0x000000010f8fc00c _ZN11SkTaskGroup4waitEv + 28 37 dm 0x000000010f23e9c4 _Z7dm_mainv + 1940 38 dm 0x000000010f23fa77 main + 39 39 dm 0x000000010f23e1a4 start + 52 40 ??? 0x0000000000000007 0x0 + 7 BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1753503002 Review URL: https://codereview.chromium.org/1753503002
2016-03-01 01:02:52 +00:00
#include <stdlib.h>
static void setup_crash_handler() {
const int kSignals[] = { SIGABRT, SIGBUS, SIGFPE, SIGILL, SIGSEGV };
for (int sig : kSignals) {
signal(sig, [](int sig) {
if (!in_signal_handler.exchange(true)) {
print stack trace on crash, tweak formatting, _Exit hard Mac example: 1 srcs * 1 sinks + 0 tests == 1 tasks 0ns elapsed, 1 active, 0 queued, 11MB RAM, 11MB peak f16 gm dstreadshuffle ../../src/core/SkXfermode.cpp:935: fatal error: ""r.fVec[i] >= min && r.fVec[i] <= max"" Caught signal 6 [Abort trap: 6], was running: f16 gm dstreadshuffle Stack trace: 0 dm 0x000000010f23fc9d _ZZL19setup_crash_handlervENK3$_5clEi + 397 1 dm 0x000000010f23fb06 _ZZL19setup_crash_handlervEN3$_58__invokeEi + 22 2 libsystem_platform.dylib 0x00007fff9d44e52a _sigtramp + 26 3 ??? 0x00007fff9900b902 0x0 + 140735760349442 4 libsystem_c.dylib 0x00007fff96a836e7 abort + 129 5 dm 0x000000010fcb67c9 _Z17sk_abort_no_printv + 9 6 dm 0x000000010f90fc1f _ZL11assert_unitRK6SkPM4f + 175 7 dm 0x000000010f90e957 _Z7proc_4fIXadL_ZL10lighten_4fRK4SkNxILi4EfES3_EEE6SkPM4fRKS4_S6_ + 103 8 dm 0x000000010f918946 _Z10xfer_u64_nIL7DstType1EEvPK10SkXfermodePyPK6SkPM4fiPKh + 182 9 dm 0x000000010f7a5f3e _ZN22SkState_Shader_BlitterI7State64E9blitAntiHEiiPKhPKs + 398 10 dm 0x000000010f3c730c _ZN9SkBlitter10blitAntiH2Eiijj + 108 11 dm 0x000000010f8d76f4 _ZN25Vertish_SkAntiHairBlitter7drawCapEiiii + 164 12 dm 0x000000010f8d4d92 _ZL16do_anti_hairlineiiiiPK7SkIRectP9SkBlitter + 3058 13 dm 0x000000010f8d40f4 _ZN6SkScan15AntiHairLineRgnEPK7SkPointiPK8SkRegionP9SkBlitter + 900 14 dm 0x000000010f8d8fff _ZL8hairquadPK7SkPointPK8SkRegionP9SkBlitteriPFvS1_iS4_S6_E + 719 15 dm 0x000000010f8da838 _Z9hair_pathILN7SkPaint3CapE0EEvRK6SkPathRK12SkRasterClipP9SkBlitterPFvPK7SkPointiPK8SkRegionS9_E + 1048 16 dm 0x000000010f8d86dc _ZN6SkScan12AntiHairPathERK6SkPathRK12SkRasterClipP9SkBlitter + 44 17 dm 0x000000010f7da8ff _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixbbP9SkBlitter + 2239 18 dm 0x000000010f774993 _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixb + 83 19 dm 0x000000010f774031 _ZN14SkBitmapDevice8drawPathERK6SkDrawRK6SkPathRK7SkPaintPK8SkMatrixb + 97 20 dm 0x000000010f773f6b _ZN14SkBitmapDevice8drawOvalERK6SkDrawRK6SkRectRK7SkPaint + 139 21 dm 0x000000010f7b5072 _ZN8SkCanvas10onDrawOvalERK6SkRectRK7SkPaint + 626 22 dm 0x000000010f7b38a5 _ZN8SkCanvas8drawOvalERK6SkRectRK7SkPaint + 69 23 dm 0x000000010f7b9ee6 _ZN8SkCanvas10drawCircleEfffRK7SkPaint + 294 24 dm 0x000000010f614039 _ZN6skiagm14DstReadShuffle9drawShapeEP8SkCanvasP7SkPaintNS0_9ShapeTypeE + 249 25 dm 0x000000010f613b89 _ZN6skiagm14DstReadShuffle6onDrawEP8SkCanvas + 425 26 dm 0x000000010f268b17 _ZN6skiagm2GM11drawContentEP8SkCanvas + 71 27 dm 0x000000010f268a6c _ZN6skiagm2GM4drawEP8SkCanvas + 60 28 dm 0x000000010f25186b _ZNK2DM5GMSrc4drawEP8SkCanvas + 123 29 dm 0x000000010f256de7 _ZNK2DM10RasterSink4drawERKNS_3SrcEP8SkBitmapP9SkWStreamP8SkString + 295 30 dm 0x000000010f246a96 _ZN4Task3RunERKS_ + 358 31 dm 0x000000010f2447e5 _ZZ7dm_mainvENK3$_3clEv + 21 32 dm 0x000000010f2447bd _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZ7dm_mainvE3$_3EEEvDpOT_ + 45 33 dm 0x000000010f24475c _ZNSt3__110__function6__funcIZ7dm_mainvE3$_3NS_9allocatorIS2_EEFvvEEclEv + 44 34 dm 0x000000010f406aba _ZNKSt3__18functionIFvvEEclEv + 26 35 dm 0x000000010f8fc168 _ZN12_GLOBAL__N_110ThreadPool4WaitEP8SkAtomicIiL15sk_memory_order5EE + 328 36 dm 0x000000010f8fc00c _ZN11SkTaskGroup4waitEv + 28 37 dm 0x000000010f23e9c4 _Z7dm_mainv + 1940 38 dm 0x000000010f23fa77 main + 39 39 dm 0x000000010f23e1a4 start + 52 40 ??? 0x0000000000000007 0x0 + 7 BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1753503002 Review URL: https://codereview.chromium.org/1753503002
2016-03-01 01:02:52 +00:00
SkAutoTAcquire<SkSpinlock> lock(gMutex);
info("\nCaught signal %d [%s], was running:\n", sig, strsignal(sig));
print stack trace on crash, tweak formatting, _Exit hard Mac example: 1 srcs * 1 sinks + 0 tests == 1 tasks 0ns elapsed, 1 active, 0 queued, 11MB RAM, 11MB peak f16 gm dstreadshuffle ../../src/core/SkXfermode.cpp:935: fatal error: ""r.fVec[i] >= min && r.fVec[i] <= max"" Caught signal 6 [Abort trap: 6], was running: f16 gm dstreadshuffle Stack trace: 0 dm 0x000000010f23fc9d _ZZL19setup_crash_handlervENK3$_5clEi + 397 1 dm 0x000000010f23fb06 _ZZL19setup_crash_handlervEN3$_58__invokeEi + 22 2 libsystem_platform.dylib 0x00007fff9d44e52a _sigtramp + 26 3 ??? 0x00007fff9900b902 0x0 + 140735760349442 4 libsystem_c.dylib 0x00007fff96a836e7 abort + 129 5 dm 0x000000010fcb67c9 _Z17sk_abort_no_printv + 9 6 dm 0x000000010f90fc1f _ZL11assert_unitRK6SkPM4f + 175 7 dm 0x000000010f90e957 _Z7proc_4fIXadL_ZL10lighten_4fRK4SkNxILi4EfES3_EEE6SkPM4fRKS4_S6_ + 103 8 dm 0x000000010f918946 _Z10xfer_u64_nIL7DstType1EEvPK10SkXfermodePyPK6SkPM4fiPKh + 182 9 dm 0x000000010f7a5f3e _ZN22SkState_Shader_BlitterI7State64E9blitAntiHEiiPKhPKs + 398 10 dm 0x000000010f3c730c _ZN9SkBlitter10blitAntiH2Eiijj + 108 11 dm 0x000000010f8d76f4 _ZN25Vertish_SkAntiHairBlitter7drawCapEiiii + 164 12 dm 0x000000010f8d4d92 _ZL16do_anti_hairlineiiiiPK7SkIRectP9SkBlitter + 3058 13 dm 0x000000010f8d40f4 _ZN6SkScan15AntiHairLineRgnEPK7SkPointiPK8SkRegionP9SkBlitter + 900 14 dm 0x000000010f8d8fff _ZL8hairquadPK7SkPointPK8SkRegionP9SkBlitteriPFvS1_iS4_S6_E + 719 15 dm 0x000000010f8da838 _Z9hair_pathILN7SkPaint3CapE0EEvRK6SkPathRK12SkRasterClipP9SkBlitterPFvPK7SkPointiPK8SkRegionS9_E + 1048 16 dm 0x000000010f8d86dc _ZN6SkScan12AntiHairPathERK6SkPathRK12SkRasterClipP9SkBlitter + 44 17 dm 0x000000010f7da8ff _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixbbP9SkBlitter + 2239 18 dm 0x000000010f774993 _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixb + 83 19 dm 0x000000010f774031 _ZN14SkBitmapDevice8drawPathERK6SkDrawRK6SkPathRK7SkPaintPK8SkMatrixb + 97 20 dm 0x000000010f773f6b _ZN14SkBitmapDevice8drawOvalERK6SkDrawRK6SkRectRK7SkPaint + 139 21 dm 0x000000010f7b5072 _ZN8SkCanvas10onDrawOvalERK6SkRectRK7SkPaint + 626 22 dm 0x000000010f7b38a5 _ZN8SkCanvas8drawOvalERK6SkRectRK7SkPaint + 69 23 dm 0x000000010f7b9ee6 _ZN8SkCanvas10drawCircleEfffRK7SkPaint + 294 24 dm 0x000000010f614039 _ZN6skiagm14DstReadShuffle9drawShapeEP8SkCanvasP7SkPaintNS0_9ShapeTypeE + 249 25 dm 0x000000010f613b89 _ZN6skiagm14DstReadShuffle6onDrawEP8SkCanvas + 425 26 dm 0x000000010f268b17 _ZN6skiagm2GM11drawContentEP8SkCanvas + 71 27 dm 0x000000010f268a6c _ZN6skiagm2GM4drawEP8SkCanvas + 60 28 dm 0x000000010f25186b _ZNK2DM5GMSrc4drawEP8SkCanvas + 123 29 dm 0x000000010f256de7 _ZNK2DM10RasterSink4drawERKNS_3SrcEP8SkBitmapP9SkWStreamP8SkString + 295 30 dm 0x000000010f246a96 _ZN4Task3RunERKS_ + 358 31 dm 0x000000010f2447e5 _ZZ7dm_mainvENK3$_3clEv + 21 32 dm 0x000000010f2447bd _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZ7dm_mainvE3$_3EEEvDpOT_ + 45 33 dm 0x000000010f24475c _ZNSt3__110__function6__funcIZ7dm_mainvE3$_3NS_9allocatorIS2_EEFvvEEclEv + 44 34 dm 0x000000010f406aba _ZNKSt3__18functionIFvvEEclEv + 26 35 dm 0x000000010f8fc168 _ZN12_GLOBAL__N_110ThreadPool4WaitEP8SkAtomicIiL15sk_memory_order5EE + 328 36 dm 0x000000010f8fc00c _ZN11SkTaskGroup4waitEv + 28 37 dm 0x000000010f23e9c4 _Z7dm_mainv + 1940 38 dm 0x000000010f23fa77 main + 39 39 dm 0x000000010f23e1a4 start + 52 40 ??? 0x0000000000000007 0x0 + 7 BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1753503002 Review URL: https://codereview.chromium.org/1753503002
2016-03-01 01:02:52 +00:00
for (auto& task : gRunning) {
info("\t%s\n", task.c_str());
print stack trace on crash, tweak formatting, _Exit hard Mac example: 1 srcs * 1 sinks + 0 tests == 1 tasks 0ns elapsed, 1 active, 0 queued, 11MB RAM, 11MB peak f16 gm dstreadshuffle ../../src/core/SkXfermode.cpp:935: fatal error: ""r.fVec[i] >= min && r.fVec[i] <= max"" Caught signal 6 [Abort trap: 6], was running: f16 gm dstreadshuffle Stack trace: 0 dm 0x000000010f23fc9d _ZZL19setup_crash_handlervENK3$_5clEi + 397 1 dm 0x000000010f23fb06 _ZZL19setup_crash_handlervEN3$_58__invokeEi + 22 2 libsystem_platform.dylib 0x00007fff9d44e52a _sigtramp + 26 3 ??? 0x00007fff9900b902 0x0 + 140735760349442 4 libsystem_c.dylib 0x00007fff96a836e7 abort + 129 5 dm 0x000000010fcb67c9 _Z17sk_abort_no_printv + 9 6 dm 0x000000010f90fc1f _ZL11assert_unitRK6SkPM4f + 175 7 dm 0x000000010f90e957 _Z7proc_4fIXadL_ZL10lighten_4fRK4SkNxILi4EfES3_EEE6SkPM4fRKS4_S6_ + 103 8 dm 0x000000010f918946 _Z10xfer_u64_nIL7DstType1EEvPK10SkXfermodePyPK6SkPM4fiPKh + 182 9 dm 0x000000010f7a5f3e _ZN22SkState_Shader_BlitterI7State64E9blitAntiHEiiPKhPKs + 398 10 dm 0x000000010f3c730c _ZN9SkBlitter10blitAntiH2Eiijj + 108 11 dm 0x000000010f8d76f4 _ZN25Vertish_SkAntiHairBlitter7drawCapEiiii + 164 12 dm 0x000000010f8d4d92 _ZL16do_anti_hairlineiiiiPK7SkIRectP9SkBlitter + 3058 13 dm 0x000000010f8d40f4 _ZN6SkScan15AntiHairLineRgnEPK7SkPointiPK8SkRegionP9SkBlitter + 900 14 dm 0x000000010f8d8fff _ZL8hairquadPK7SkPointPK8SkRegionP9SkBlitteriPFvS1_iS4_S6_E + 719 15 dm 0x000000010f8da838 _Z9hair_pathILN7SkPaint3CapE0EEvRK6SkPathRK12SkRasterClipP9SkBlitterPFvPK7SkPointiPK8SkRegionS9_E + 1048 16 dm 0x000000010f8d86dc _ZN6SkScan12AntiHairPathERK6SkPathRK12SkRasterClipP9SkBlitter + 44 17 dm 0x000000010f7da8ff _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixbbP9SkBlitter + 2239 18 dm 0x000000010f774993 _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixb + 83 19 dm 0x000000010f774031 _ZN14SkBitmapDevice8drawPathERK6SkDrawRK6SkPathRK7SkPaintPK8SkMatrixb + 97 20 dm 0x000000010f773f6b _ZN14SkBitmapDevice8drawOvalERK6SkDrawRK6SkRectRK7SkPaint + 139 21 dm 0x000000010f7b5072 _ZN8SkCanvas10onDrawOvalERK6SkRectRK7SkPaint + 626 22 dm 0x000000010f7b38a5 _ZN8SkCanvas8drawOvalERK6SkRectRK7SkPaint + 69 23 dm 0x000000010f7b9ee6 _ZN8SkCanvas10drawCircleEfffRK7SkPaint + 294 24 dm 0x000000010f614039 _ZN6skiagm14DstReadShuffle9drawShapeEP8SkCanvasP7SkPaintNS0_9ShapeTypeE + 249 25 dm 0x000000010f613b89 _ZN6skiagm14DstReadShuffle6onDrawEP8SkCanvas + 425 26 dm 0x000000010f268b17 _ZN6skiagm2GM11drawContentEP8SkCanvas + 71 27 dm 0x000000010f268a6c _ZN6skiagm2GM4drawEP8SkCanvas + 60 28 dm 0x000000010f25186b _ZNK2DM5GMSrc4drawEP8SkCanvas + 123 29 dm 0x000000010f256de7 _ZNK2DM10RasterSink4drawERKNS_3SrcEP8SkBitmapP9SkWStreamP8SkString + 295 30 dm 0x000000010f246a96 _ZN4Task3RunERKS_ + 358 31 dm 0x000000010f2447e5 _ZZ7dm_mainvENK3$_3clEv + 21 32 dm 0x000000010f2447bd _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZ7dm_mainvE3$_3EEEvDpOT_ + 45 33 dm 0x000000010f24475c _ZNSt3__110__function6__funcIZ7dm_mainvE3$_3NS_9allocatorIS2_EEFvvEEclEv + 44 34 dm 0x000000010f406aba _ZNKSt3__18functionIFvvEEclEv + 26 35 dm 0x000000010f8fc168 _ZN12_GLOBAL__N_110ThreadPool4WaitEP8SkAtomicIiL15sk_memory_order5EE + 328 36 dm 0x000000010f8fc00c _ZN11SkTaskGroup4waitEv + 28 37 dm 0x000000010f23e9c4 _Z7dm_mainv + 1940 38 dm 0x000000010f23fa77 main + 39 39 dm 0x000000010f23e1a4 start + 52 40 ??? 0x0000000000000007 0x0 + 7 BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1753503002 Review URL: https://codereview.chromium.org/1753503002
2016-03-01 01:02:52 +00:00
}
void* stack[64];
int count = backtrace(stack, SK_ARRAY_COUNT(stack));
char** symbols = backtrace_symbols(stack, count);
info("\nStack trace:\n");
print stack trace on crash, tweak formatting, _Exit hard Mac example: 1 srcs * 1 sinks + 0 tests == 1 tasks 0ns elapsed, 1 active, 0 queued, 11MB RAM, 11MB peak f16 gm dstreadshuffle ../../src/core/SkXfermode.cpp:935: fatal error: ""r.fVec[i] >= min && r.fVec[i] <= max"" Caught signal 6 [Abort trap: 6], was running: f16 gm dstreadshuffle Stack trace: 0 dm 0x000000010f23fc9d _ZZL19setup_crash_handlervENK3$_5clEi + 397 1 dm 0x000000010f23fb06 _ZZL19setup_crash_handlervEN3$_58__invokeEi + 22 2 libsystem_platform.dylib 0x00007fff9d44e52a _sigtramp + 26 3 ??? 0x00007fff9900b902 0x0 + 140735760349442 4 libsystem_c.dylib 0x00007fff96a836e7 abort + 129 5 dm 0x000000010fcb67c9 _Z17sk_abort_no_printv + 9 6 dm 0x000000010f90fc1f _ZL11assert_unitRK6SkPM4f + 175 7 dm 0x000000010f90e957 _Z7proc_4fIXadL_ZL10lighten_4fRK4SkNxILi4EfES3_EEE6SkPM4fRKS4_S6_ + 103 8 dm 0x000000010f918946 _Z10xfer_u64_nIL7DstType1EEvPK10SkXfermodePyPK6SkPM4fiPKh + 182 9 dm 0x000000010f7a5f3e _ZN22SkState_Shader_BlitterI7State64E9blitAntiHEiiPKhPKs + 398 10 dm 0x000000010f3c730c _ZN9SkBlitter10blitAntiH2Eiijj + 108 11 dm 0x000000010f8d76f4 _ZN25Vertish_SkAntiHairBlitter7drawCapEiiii + 164 12 dm 0x000000010f8d4d92 _ZL16do_anti_hairlineiiiiPK7SkIRectP9SkBlitter + 3058 13 dm 0x000000010f8d40f4 _ZN6SkScan15AntiHairLineRgnEPK7SkPointiPK8SkRegionP9SkBlitter + 900 14 dm 0x000000010f8d8fff _ZL8hairquadPK7SkPointPK8SkRegionP9SkBlitteriPFvS1_iS4_S6_E + 719 15 dm 0x000000010f8da838 _Z9hair_pathILN7SkPaint3CapE0EEvRK6SkPathRK12SkRasterClipP9SkBlitterPFvPK7SkPointiPK8SkRegionS9_E + 1048 16 dm 0x000000010f8d86dc _ZN6SkScan12AntiHairPathERK6SkPathRK12SkRasterClipP9SkBlitter + 44 17 dm 0x000000010f7da8ff _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixbbP9SkBlitter + 2239 18 dm 0x000000010f774993 _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixb + 83 19 dm 0x000000010f774031 _ZN14SkBitmapDevice8drawPathERK6SkDrawRK6SkPathRK7SkPaintPK8SkMatrixb + 97 20 dm 0x000000010f773f6b _ZN14SkBitmapDevice8drawOvalERK6SkDrawRK6SkRectRK7SkPaint + 139 21 dm 0x000000010f7b5072 _ZN8SkCanvas10onDrawOvalERK6SkRectRK7SkPaint + 626 22 dm 0x000000010f7b38a5 _ZN8SkCanvas8drawOvalERK6SkRectRK7SkPaint + 69 23 dm 0x000000010f7b9ee6 _ZN8SkCanvas10drawCircleEfffRK7SkPaint + 294 24 dm 0x000000010f614039 _ZN6skiagm14DstReadShuffle9drawShapeEP8SkCanvasP7SkPaintNS0_9ShapeTypeE + 249 25 dm 0x000000010f613b89 _ZN6skiagm14DstReadShuffle6onDrawEP8SkCanvas + 425 26 dm 0x000000010f268b17 _ZN6skiagm2GM11drawContentEP8SkCanvas + 71 27 dm 0x000000010f268a6c _ZN6skiagm2GM4drawEP8SkCanvas + 60 28 dm 0x000000010f25186b _ZNK2DM5GMSrc4drawEP8SkCanvas + 123 29 dm 0x000000010f256de7 _ZNK2DM10RasterSink4drawERKNS_3SrcEP8SkBitmapP9SkWStreamP8SkString + 295 30 dm 0x000000010f246a96 _ZN4Task3RunERKS_ + 358 31 dm 0x000000010f2447e5 _ZZ7dm_mainvENK3$_3clEv + 21 32 dm 0x000000010f2447bd _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZ7dm_mainvE3$_3EEEvDpOT_ + 45 33 dm 0x000000010f24475c _ZNSt3__110__function6__funcIZ7dm_mainvE3$_3NS_9allocatorIS2_EEFvvEEclEv + 44 34 dm 0x000000010f406aba _ZNKSt3__18functionIFvvEEclEv + 26 35 dm 0x000000010f8fc168 _ZN12_GLOBAL__N_110ThreadPool4WaitEP8SkAtomicIiL15sk_memory_order5EE + 328 36 dm 0x000000010f8fc00c _ZN11SkTaskGroup4waitEv + 28 37 dm 0x000000010f23e9c4 _Z7dm_mainv + 1940 38 dm 0x000000010f23fa77 main + 39 39 dm 0x000000010f23e1a4 start + 52 40 ??? 0x0000000000000007 0x0 + 7 BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1753503002 Review URL: https://codereview.chromium.org/1753503002
2016-03-01 01:02:52 +00:00
for (int i = 0; i < count; i++) {
info(" %s\n", symbols[i]);
print stack trace on crash, tweak formatting, _Exit hard Mac example: 1 srcs * 1 sinks + 0 tests == 1 tasks 0ns elapsed, 1 active, 0 queued, 11MB RAM, 11MB peak f16 gm dstreadshuffle ../../src/core/SkXfermode.cpp:935: fatal error: ""r.fVec[i] >= min && r.fVec[i] <= max"" Caught signal 6 [Abort trap: 6], was running: f16 gm dstreadshuffle Stack trace: 0 dm 0x000000010f23fc9d _ZZL19setup_crash_handlervENK3$_5clEi + 397 1 dm 0x000000010f23fb06 _ZZL19setup_crash_handlervEN3$_58__invokeEi + 22 2 libsystem_platform.dylib 0x00007fff9d44e52a _sigtramp + 26 3 ??? 0x00007fff9900b902 0x0 + 140735760349442 4 libsystem_c.dylib 0x00007fff96a836e7 abort + 129 5 dm 0x000000010fcb67c9 _Z17sk_abort_no_printv + 9 6 dm 0x000000010f90fc1f _ZL11assert_unitRK6SkPM4f + 175 7 dm 0x000000010f90e957 _Z7proc_4fIXadL_ZL10lighten_4fRK4SkNxILi4EfES3_EEE6SkPM4fRKS4_S6_ + 103 8 dm 0x000000010f918946 _Z10xfer_u64_nIL7DstType1EEvPK10SkXfermodePyPK6SkPM4fiPKh + 182 9 dm 0x000000010f7a5f3e _ZN22SkState_Shader_BlitterI7State64E9blitAntiHEiiPKhPKs + 398 10 dm 0x000000010f3c730c _ZN9SkBlitter10blitAntiH2Eiijj + 108 11 dm 0x000000010f8d76f4 _ZN25Vertish_SkAntiHairBlitter7drawCapEiiii + 164 12 dm 0x000000010f8d4d92 _ZL16do_anti_hairlineiiiiPK7SkIRectP9SkBlitter + 3058 13 dm 0x000000010f8d40f4 _ZN6SkScan15AntiHairLineRgnEPK7SkPointiPK8SkRegionP9SkBlitter + 900 14 dm 0x000000010f8d8fff _ZL8hairquadPK7SkPointPK8SkRegionP9SkBlitteriPFvS1_iS4_S6_E + 719 15 dm 0x000000010f8da838 _Z9hair_pathILN7SkPaint3CapE0EEvRK6SkPathRK12SkRasterClipP9SkBlitterPFvPK7SkPointiPK8SkRegionS9_E + 1048 16 dm 0x000000010f8d86dc _ZN6SkScan12AntiHairPathERK6SkPathRK12SkRasterClipP9SkBlitter + 44 17 dm 0x000000010f7da8ff _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixbbP9SkBlitter + 2239 18 dm 0x000000010f774993 _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixb + 83 19 dm 0x000000010f774031 _ZN14SkBitmapDevice8drawPathERK6SkDrawRK6SkPathRK7SkPaintPK8SkMatrixb + 97 20 dm 0x000000010f773f6b _ZN14SkBitmapDevice8drawOvalERK6SkDrawRK6SkRectRK7SkPaint + 139 21 dm 0x000000010f7b5072 _ZN8SkCanvas10onDrawOvalERK6SkRectRK7SkPaint + 626 22 dm 0x000000010f7b38a5 _ZN8SkCanvas8drawOvalERK6SkRectRK7SkPaint + 69 23 dm 0x000000010f7b9ee6 _ZN8SkCanvas10drawCircleEfffRK7SkPaint + 294 24 dm 0x000000010f614039 _ZN6skiagm14DstReadShuffle9drawShapeEP8SkCanvasP7SkPaintNS0_9ShapeTypeE + 249 25 dm 0x000000010f613b89 _ZN6skiagm14DstReadShuffle6onDrawEP8SkCanvas + 425 26 dm 0x000000010f268b17 _ZN6skiagm2GM11drawContentEP8SkCanvas + 71 27 dm 0x000000010f268a6c _ZN6skiagm2GM4drawEP8SkCanvas + 60 28 dm 0x000000010f25186b _ZNK2DM5GMSrc4drawEP8SkCanvas + 123 29 dm 0x000000010f256de7 _ZNK2DM10RasterSink4drawERKNS_3SrcEP8SkBitmapP9SkWStreamP8SkString + 295 30 dm 0x000000010f246a96 _ZN4Task3RunERKS_ + 358 31 dm 0x000000010f2447e5 _ZZ7dm_mainvENK3$_3clEv + 21 32 dm 0x000000010f2447bd _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZ7dm_mainvE3$_3EEEvDpOT_ + 45 33 dm 0x000000010f24475c _ZNSt3__110__function6__funcIZ7dm_mainvE3$_3NS_9allocatorIS2_EEFvvEEclEv + 44 34 dm 0x000000010f406aba _ZNKSt3__18functionIFvvEEclEv + 26 35 dm 0x000000010f8fc168 _ZN12_GLOBAL__N_110ThreadPool4WaitEP8SkAtomicIiL15sk_memory_order5EE + 328 36 dm 0x000000010f8fc00c _ZN11SkTaskGroup4waitEv + 28 37 dm 0x000000010f23e9c4 _Z7dm_mainv + 1940 38 dm 0x000000010f23fa77 main + 39 39 dm 0x000000010f23e1a4 start + 52 40 ??? 0x0000000000000007 0x0 + 7 BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1753503002 Review URL: https://codereview.chromium.org/1753503002
2016-03-01 01:02:52 +00:00
}
fflush(stdout);
}
print stack trace on crash, tweak formatting, _Exit hard Mac example: 1 srcs * 1 sinks + 0 tests == 1 tasks 0ns elapsed, 1 active, 0 queued, 11MB RAM, 11MB peak f16 gm dstreadshuffle ../../src/core/SkXfermode.cpp:935: fatal error: ""r.fVec[i] >= min && r.fVec[i] <= max"" Caught signal 6 [Abort trap: 6], was running: f16 gm dstreadshuffle Stack trace: 0 dm 0x000000010f23fc9d _ZZL19setup_crash_handlervENK3$_5clEi + 397 1 dm 0x000000010f23fb06 _ZZL19setup_crash_handlervEN3$_58__invokeEi + 22 2 libsystem_platform.dylib 0x00007fff9d44e52a _sigtramp + 26 3 ??? 0x00007fff9900b902 0x0 + 140735760349442 4 libsystem_c.dylib 0x00007fff96a836e7 abort + 129 5 dm 0x000000010fcb67c9 _Z17sk_abort_no_printv + 9 6 dm 0x000000010f90fc1f _ZL11assert_unitRK6SkPM4f + 175 7 dm 0x000000010f90e957 _Z7proc_4fIXadL_ZL10lighten_4fRK4SkNxILi4EfES3_EEE6SkPM4fRKS4_S6_ + 103 8 dm 0x000000010f918946 _Z10xfer_u64_nIL7DstType1EEvPK10SkXfermodePyPK6SkPM4fiPKh + 182 9 dm 0x000000010f7a5f3e _ZN22SkState_Shader_BlitterI7State64E9blitAntiHEiiPKhPKs + 398 10 dm 0x000000010f3c730c _ZN9SkBlitter10blitAntiH2Eiijj + 108 11 dm 0x000000010f8d76f4 _ZN25Vertish_SkAntiHairBlitter7drawCapEiiii + 164 12 dm 0x000000010f8d4d92 _ZL16do_anti_hairlineiiiiPK7SkIRectP9SkBlitter + 3058 13 dm 0x000000010f8d40f4 _ZN6SkScan15AntiHairLineRgnEPK7SkPointiPK8SkRegionP9SkBlitter + 900 14 dm 0x000000010f8d8fff _ZL8hairquadPK7SkPointPK8SkRegionP9SkBlitteriPFvS1_iS4_S6_E + 719 15 dm 0x000000010f8da838 _Z9hair_pathILN7SkPaint3CapE0EEvRK6SkPathRK12SkRasterClipP9SkBlitterPFvPK7SkPointiPK8SkRegionS9_E + 1048 16 dm 0x000000010f8d86dc _ZN6SkScan12AntiHairPathERK6SkPathRK12SkRasterClipP9SkBlitter + 44 17 dm 0x000000010f7da8ff _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixbbP9SkBlitter + 2239 18 dm 0x000000010f774993 _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixb + 83 19 dm 0x000000010f774031 _ZN14SkBitmapDevice8drawPathERK6SkDrawRK6SkPathRK7SkPaintPK8SkMatrixb + 97 20 dm 0x000000010f773f6b _ZN14SkBitmapDevice8drawOvalERK6SkDrawRK6SkRectRK7SkPaint + 139 21 dm 0x000000010f7b5072 _ZN8SkCanvas10onDrawOvalERK6SkRectRK7SkPaint + 626 22 dm 0x000000010f7b38a5 _ZN8SkCanvas8drawOvalERK6SkRectRK7SkPaint + 69 23 dm 0x000000010f7b9ee6 _ZN8SkCanvas10drawCircleEfffRK7SkPaint + 294 24 dm 0x000000010f614039 _ZN6skiagm14DstReadShuffle9drawShapeEP8SkCanvasP7SkPaintNS0_9ShapeTypeE + 249 25 dm 0x000000010f613b89 _ZN6skiagm14DstReadShuffle6onDrawEP8SkCanvas + 425 26 dm 0x000000010f268b17 _ZN6skiagm2GM11drawContentEP8SkCanvas + 71 27 dm 0x000000010f268a6c _ZN6skiagm2GM4drawEP8SkCanvas + 60 28 dm 0x000000010f25186b _ZNK2DM5GMSrc4drawEP8SkCanvas + 123 29 dm 0x000000010f256de7 _ZNK2DM10RasterSink4drawERKNS_3SrcEP8SkBitmapP9SkWStreamP8SkString + 295 30 dm 0x000000010f246a96 _ZN4Task3RunERKS_ + 358 31 dm 0x000000010f2447e5 _ZZ7dm_mainvENK3$_3clEv + 21 32 dm 0x000000010f2447bd _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZ7dm_mainvE3$_3EEEvDpOT_ + 45 33 dm 0x000000010f24475c _ZNSt3__110__function6__funcIZ7dm_mainvE3$_3NS_9allocatorIS2_EEFvvEEclEv + 44 34 dm 0x000000010f406aba _ZNKSt3__18functionIFvvEEclEv + 26 35 dm 0x000000010f8fc168 _ZN12_GLOBAL__N_110ThreadPool4WaitEP8SkAtomicIiL15sk_memory_order5EE + 328 36 dm 0x000000010f8fc00c _ZN11SkTaskGroup4waitEv + 28 37 dm 0x000000010f23e9c4 _Z7dm_mainv + 1940 38 dm 0x000000010f23fa77 main + 39 39 dm 0x000000010f23e1a4 start + 52 40 ??? 0x0000000000000007 0x0 + 7 BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1753503002 Review URL: https://codereview.chromium.org/1753503002
2016-03-01 01:02:52 +00:00
_Exit(sig);
});
}
}
print stack trace on crash, tweak formatting, _Exit hard Mac example: 1 srcs * 1 sinks + 0 tests == 1 tasks 0ns elapsed, 1 active, 0 queued, 11MB RAM, 11MB peak f16 gm dstreadshuffle ../../src/core/SkXfermode.cpp:935: fatal error: ""r.fVec[i] >= min && r.fVec[i] <= max"" Caught signal 6 [Abort trap: 6], was running: f16 gm dstreadshuffle Stack trace: 0 dm 0x000000010f23fc9d _ZZL19setup_crash_handlervENK3$_5clEi + 397 1 dm 0x000000010f23fb06 _ZZL19setup_crash_handlervEN3$_58__invokeEi + 22 2 libsystem_platform.dylib 0x00007fff9d44e52a _sigtramp + 26 3 ??? 0x00007fff9900b902 0x0 + 140735760349442 4 libsystem_c.dylib 0x00007fff96a836e7 abort + 129 5 dm 0x000000010fcb67c9 _Z17sk_abort_no_printv + 9 6 dm 0x000000010f90fc1f _ZL11assert_unitRK6SkPM4f + 175 7 dm 0x000000010f90e957 _Z7proc_4fIXadL_ZL10lighten_4fRK4SkNxILi4EfES3_EEE6SkPM4fRKS4_S6_ + 103 8 dm 0x000000010f918946 _Z10xfer_u64_nIL7DstType1EEvPK10SkXfermodePyPK6SkPM4fiPKh + 182 9 dm 0x000000010f7a5f3e _ZN22SkState_Shader_BlitterI7State64E9blitAntiHEiiPKhPKs + 398 10 dm 0x000000010f3c730c _ZN9SkBlitter10blitAntiH2Eiijj + 108 11 dm 0x000000010f8d76f4 _ZN25Vertish_SkAntiHairBlitter7drawCapEiiii + 164 12 dm 0x000000010f8d4d92 _ZL16do_anti_hairlineiiiiPK7SkIRectP9SkBlitter + 3058 13 dm 0x000000010f8d40f4 _ZN6SkScan15AntiHairLineRgnEPK7SkPointiPK8SkRegionP9SkBlitter + 900 14 dm 0x000000010f8d8fff _ZL8hairquadPK7SkPointPK8SkRegionP9SkBlitteriPFvS1_iS4_S6_E + 719 15 dm 0x000000010f8da838 _Z9hair_pathILN7SkPaint3CapE0EEvRK6SkPathRK12SkRasterClipP9SkBlitterPFvPK7SkPointiPK8SkRegionS9_E + 1048 16 dm 0x000000010f8d86dc _ZN6SkScan12AntiHairPathERK6SkPathRK12SkRasterClipP9SkBlitter + 44 17 dm 0x000000010f7da8ff _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixbbP9SkBlitter + 2239 18 dm 0x000000010f774993 _ZNK6SkDraw8drawPathERK6SkPathRK7SkPaintPK8SkMatrixb + 83 19 dm 0x000000010f774031 _ZN14SkBitmapDevice8drawPathERK6SkDrawRK6SkPathRK7SkPaintPK8SkMatrixb + 97 20 dm 0x000000010f773f6b _ZN14SkBitmapDevice8drawOvalERK6SkDrawRK6SkRectRK7SkPaint + 139 21 dm 0x000000010f7b5072 _ZN8SkCanvas10onDrawOvalERK6SkRectRK7SkPaint + 626 22 dm 0x000000010f7b38a5 _ZN8SkCanvas8drawOvalERK6SkRectRK7SkPaint + 69 23 dm 0x000000010f7b9ee6 _ZN8SkCanvas10drawCircleEfffRK7SkPaint + 294 24 dm 0x000000010f614039 _ZN6skiagm14DstReadShuffle9drawShapeEP8SkCanvasP7SkPaintNS0_9ShapeTypeE + 249 25 dm 0x000000010f613b89 _ZN6skiagm14DstReadShuffle6onDrawEP8SkCanvas + 425 26 dm 0x000000010f268b17 _ZN6skiagm2GM11drawContentEP8SkCanvas + 71 27 dm 0x000000010f268a6c _ZN6skiagm2GM4drawEP8SkCanvas + 60 28 dm 0x000000010f25186b _ZNK2DM5GMSrc4drawEP8SkCanvas + 123 29 dm 0x000000010f256de7 _ZNK2DM10RasterSink4drawERKNS_3SrcEP8SkBitmapP9SkWStreamP8SkString + 295 30 dm 0x000000010f246a96 _ZN4Task3RunERKS_ + 358 31 dm 0x000000010f2447e5 _ZZ7dm_mainvENK3$_3clEv + 21 32 dm 0x000000010f2447bd _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZ7dm_mainvE3$_3EEEvDpOT_ + 45 33 dm 0x000000010f24475c _ZNSt3__110__function6__funcIZ7dm_mainvE3$_3NS_9allocatorIS2_EEFvvEEclEv + 44 34 dm 0x000000010f406aba _ZNKSt3__18functionIFvvEEclEv + 26 35 dm 0x000000010f8fc168 _ZN12_GLOBAL__N_110ThreadPool4WaitEP8SkAtomicIiL15sk_memory_order5EE + 328 36 dm 0x000000010f8fc00c _ZN11SkTaskGroup4waitEv + 28 37 dm 0x000000010f23e9c4 _Z7dm_mainv + 1940 38 dm 0x000000010f23fa77 main + 39 39 dm 0x000000010f23e1a4 start + 52 40 ??? 0x0000000000000007 0x0 + 7 BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1753503002 Review URL: https://codereview.chromium.org/1753503002
2016-03-01 01:02:52 +00:00
#else // Android
static void setup_crash_handler() {}
#endif
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
struct Gold : public SkString {
Gold() : SkString("") {}
Gold(const SkString& sink, const SkString& src,
const SkString& srcOptions, const SkString& name,
const SkString& md5)
: SkString("") {
this->append(sink);
this->append(src);
this->append(srcOptions);
this->append(name);
this->append(md5);
}
struct Hash {
uint32_t operator()(const Gold& g) const {
return SkGoodHash()((const SkString&)g);
}
};
};
static SkTHashSet<Gold, Gold::Hash> gGold;
static void add_gold(JsonWriter::BitmapResult r) {
gGold.add(Gold(r.config, r.sourceType, r.sourceOptions, r.name, r.md5));
}
static void gather_gold() {
if (!FLAGS_readPath.isEmpty()) {
SkString path(FLAGS_readPath[0]);
path.append("/dm.json");
if (!JsonWriter::ReadJson(path.c_str(), add_gold)) {
fail(SkStringPrintf("Couldn't read %s for golden results.", path.c_str()));
}
}
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#if defined(SK_BUILD_FOR_WIN32)
static const char* kNewline = "\r\n";
#else
static const char* kNewline = "\n";
#endif
static SkTHashSet<SkString> gUninterestingHashes;
static void gather_uninteresting_hashes() {
if (!FLAGS_uninterestingHashesFile.isEmpty()) {
SkAutoTUnref<SkData> data(SkData::NewFromFileName(FLAGS_uninterestingHashesFile[0]));
if (!data) {
info("WARNING: unable to read uninteresting hashes from %s\n",
FLAGS_uninterestingHashesFile[0]);
return;
}
SkTArray<SkString> hashes;
SkStrSplit((const char*)data->data(), kNewline, &hashes);
for (const SkString& hash : hashes) {
gUninterestingHashes.add(hash);
}
info("FYI: loaded %d distinct uninteresting hashes from %d lines\n",
gUninterestingHashes.count(), hashes.count());
}
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
struct TaggedSrc : public SkAutoTDelete<Src> {
SkString tag;
SkString options;
};
struct TaggedSink : public SkAutoTDelete<Sink> {
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
SkString tag;
};
static const bool kMemcpyOK = true;
static SkTArray<TaggedSrc, kMemcpyOK> gSrcs;
static SkTArray<TaggedSink, kMemcpyOK> gSinks;
static bool in_shard() {
static int N = 0;
return N++ % FLAGS_shards == FLAGS_shard;
}
static void push_src(const char* tag, ImplicitString options, Src* s) {
SkAutoTDelete<Src> src(s);
if (in_shard() &&
FLAGS_src.contains(tag) &&
!SkCommandLineFlags::ShouldSkip(FLAGS_match, src->name().c_str())) {
TaggedSrc& s = gSrcs.push_back();
s.reset(src.release());
s.tag = tag;
s.options = options;
}
}
static void push_codec_src(Path path, CodecSrc::Mode mode, CodecSrc::DstColorType dstColorType,
SkAlphaType dstAlphaType, float scale) {
if (FLAGS_simpleCodec) {
if (mode != CodecSrc::kCodec_Mode || dstColorType != CodecSrc::kGetFromCanvas_DstColorType
|| scale != 1.0f)
// Only decode in the simple case.
return;
}
SkString folder;
switch (mode) {
case CodecSrc::kCodec_Mode:
folder.append("codec");
break;
case CodecSrc::kCodecZeroInit_Mode:
folder.append("codec_zero_init");
break;
case CodecSrc::kScanline_Mode:
folder.append("scanline");
break;
case CodecSrc::kStripe_Mode:
folder.append("stripe");
break;
case CodecSrc::kCroppedScanline_Mode:
folder.append("crop");
break;
case CodecSrc::kSubset_Mode:
folder.append("codec_subset");
break;
}
switch (dstColorType) {
case CodecSrc::kGrayscale_Always_DstColorType:
folder.append("_kGray8");
break;
case CodecSrc::kIndex8_Always_DstColorType:
folder.append("_kIndex8");
break;
case CodecSrc::kNonNative8888_Always_DstColorType:
folder.append("_kNonNative");
break;
default:
break;
}
switch (dstAlphaType) {
case kOpaque_SkAlphaType:
folder.append("_opaque");
break;
case kPremul_SkAlphaType:
folder.append("_premul");
break;
case kUnpremul_SkAlphaType:
folder.append("_unpremul");
break;
default:
break;
}
if (1.0f != scale) {
folder.appendf("_%.3f", scale);
}
CodecSrc* src = new CodecSrc(path, mode, dstColorType, dstAlphaType, scale);
push_src("image", folder, src);
}
static void push_android_codec_src(Path path, CodecSrc::DstColorType dstColorType,
SkAlphaType dstAlphaType, int sampleSize) {
SkString folder;
folder.append("scaled_codec");
switch (dstColorType) {
case CodecSrc::kGrayscale_Always_DstColorType:
folder.append("_kGray8");
break;
case CodecSrc::kIndex8_Always_DstColorType:
folder.append("_kIndex8");
break;
case CodecSrc::kNonNative8888_Always_DstColorType:
folder.append("_kNonNative");
break;
default:
break;
}
switch (dstAlphaType) {
case kOpaque_SkAlphaType:
folder.append("_opaque");
break;
case kPremul_SkAlphaType:
folder.append("_premul");
break;
case kUnpremul_SkAlphaType:
folder.append("_unpremul");
break;
default:
break;
}
if (1 != sampleSize) {
folder.appendf("_%.3f", 1.0f / (float) sampleSize);
}
AndroidCodecSrc* src = new AndroidCodecSrc(path, dstColorType, dstAlphaType, sampleSize);
push_src("image", folder, src);
}
static void push_image_gen_src(Path path, ImageGenSrc::Mode mode, SkAlphaType alphaType, bool isGpu)
{
SkString folder;
switch (mode) {
case ImageGenSrc::kCodec_Mode:
folder.append("gen_codec");
break;
case ImageGenSrc::kPlatform_Mode:
folder.append("gen_platform");
break;
}
if (isGpu) {
folder.append("_gpu");
} else {
switch (alphaType) {
case kOpaque_SkAlphaType:
folder.append("_opaque");
break;
case kPremul_SkAlphaType:
folder.append("_premul");
break;
case kUnpremul_SkAlphaType:
folder.append("_unpremul");
break;
default:
break;
}
}
ImageGenSrc* src = new ImageGenSrc(path, mode, alphaType, isGpu);
push_src("image", folder, src);
}
static void push_codec_srcs(Path path) {
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str()));
if (!encoded) {
info("Couldn't read %s.", path.c_str());
return;
}
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded));
if (nullptr == codec.get()) {
info("Couldn't create codec for %s.", path.c_str());
return;
}
// Native Scales
// SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875
const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f, 0.875f, 1.0f };
SkTArray<CodecSrc::Mode> nativeModes;
nativeModes.push_back(CodecSrc::kCodec_Mode);
nativeModes.push_back(CodecSrc::kCodecZeroInit_Mode);
switch (codec->getEncodedFormat()) {
case SkEncodedFormat::kJPEG_SkEncodedFormat:
nativeModes.push_back(CodecSrc::kScanline_Mode);
nativeModes.push_back(CodecSrc::kStripe_Mode);
nativeModes.push_back(CodecSrc::kCroppedScanline_Mode);
break;
case SkEncodedFormat::kWEBP_SkEncodedFormat:
nativeModes.push_back(CodecSrc::kSubset_Mode);
break;
case SkEncodedFormat::kDNG_SkEncodedFormat:
break;
default:
nativeModes.push_back(CodecSrc::kScanline_Mode);
nativeModes.push_back(CodecSrc::kStripe_Mode);
break;
}
SkTArray<CodecSrc::DstColorType> colorTypes;
colorTypes.push_back(CodecSrc::kGetFromCanvas_DstColorType);
colorTypes.push_back(CodecSrc::kNonNative8888_Always_DstColorType);
switch (codec->getInfo().colorType()) {
case kGray_8_SkColorType:
colorTypes.push_back(CodecSrc::kGrayscale_Always_DstColorType);
if (kWBMP_SkEncodedFormat == codec->getEncodedFormat()) {
colorTypes.push_back(CodecSrc::kIndex8_Always_DstColorType);
}
break;
case kIndex_8_SkColorType:
colorTypes.push_back(CodecSrc::kIndex8_Always_DstColorType);
break;
default:
break;
}
SkTArray<SkAlphaType> alphaModes;
alphaModes.push_back(kPremul_SkAlphaType);
alphaModes.push_back(kUnpremul_SkAlphaType);
if (codec->getInfo().alphaType() == kOpaque_SkAlphaType) {
alphaModes.push_back(kOpaque_SkAlphaType);
}
for (CodecSrc::Mode mode : nativeModes) {
for (float scale : nativeScales) {
for (CodecSrc::DstColorType colorType : colorTypes) {
for (SkAlphaType alphaType : alphaModes) {
// Only test kCroppedScanline_Mode when the alpha type is opaque. The test is
// slow and won't be interestingly different with different alpha types.
if (CodecSrc::kCroppedScanline_Mode == mode &&
kOpaque_SkAlphaType != alphaType) {
continue;
}
// Skip kNonNative on different native scales. It won't be interestingly
// different.
if (CodecSrc::kNonNative8888_Always_DstColorType == colorType && 1.0f != scale)
{
continue;
}
push_codec_src(path, mode, colorType, alphaType, scale);
}
}
}
}
if (FLAGS_simpleCodec) {
return;
}
const int sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
for (int sampleSize : sampleSizes) {
for (CodecSrc::DstColorType colorType : colorTypes) {
for (SkAlphaType alphaType : alphaModes) {
// We can exercise all of the kNonNative support code in the swizzler with just a
// few sample sizes. Skip the rest.
if (CodecSrc::kNonNative8888_Always_DstColorType == colorType && sampleSize > 3) {
continue;
}
push_android_codec_src(path, colorType, alphaType, sampleSize);
}
}
}
static const char* const rawExts[] = {
"arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw",
"ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW",
};
// There is not currently a reason to test RAW images on image generator.
// If we want to enable these tests, we will need to fix skbug.com/5079.
for (const char* ext : rawExts) {
if (path.endsWith(ext)) {
return;
}
}
// Push image generator GPU test.
push_image_gen_src(path, ImageGenSrc::kCodec_Mode, codec->getInfo().alphaType(), true);
// Push image generator CPU tests.
for (SkAlphaType alphaType : alphaModes) {
push_image_gen_src(path, ImageGenSrc::kCodec_Mode, alphaType, false);
#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
if (kWEBP_SkEncodedFormat != codec->getEncodedFormat() &&
kWBMP_SkEncodedFormat != codec->getEncodedFormat() &&
kUnpremul_SkAlphaType != alphaType)
{
push_image_gen_src(path, ImageGenSrc::kPlatform_Mode, alphaType, false);
}
#elif defined(SK_BUILD_FOR_WIN)
if (kWEBP_SkEncodedFormat != codec->getEncodedFormat() &&
kWBMP_SkEncodedFormat != codec->getEncodedFormat())
{
push_image_gen_src(path, ImageGenSrc::kPlatform_Mode, alphaType, false);
}
#endif
}
}
static bool brd_color_type_supported(SkBitmapRegionDecoder::Strategy strategy,
CodecSrc::DstColorType dstColorType) {
switch (strategy) {
case SkBitmapRegionDecoder::kCanvas_Strategy:
if (CodecSrc::kGetFromCanvas_DstColorType == dstColorType) {
return true;
}
return false;
case SkBitmapRegionDecoder::kAndroidCodec_Strategy:
switch (dstColorType) {
case CodecSrc::kGetFromCanvas_DstColorType:
case CodecSrc::kIndex8_Always_DstColorType:
case CodecSrc::kGrayscale_Always_DstColorType:
return true;
default:
return false;
}
default:
SkASSERT(false);
return false;
}
}
static void push_brd_src(Path path, SkBitmapRegionDecoder::Strategy strategy,
CodecSrc::DstColorType dstColorType, BRDSrc::Mode mode, uint32_t sampleSize) {
SkString folder;
switch (strategy) {
case SkBitmapRegionDecoder::kCanvas_Strategy:
folder.append("brd_canvas");
break;
case SkBitmapRegionDecoder::kAndroidCodec_Strategy:
folder.append("brd_android_codec");
break;
default:
SkASSERT(false);
return;
}
switch (mode) {
case BRDSrc::kFullImage_Mode:
break;
case BRDSrc::kDivisor_Mode:
folder.append("_divisor");
break;
default:
SkASSERT(false);
return;
}
switch (dstColorType) {
case CodecSrc::kGetFromCanvas_DstColorType:
break;
case CodecSrc::kIndex8_Always_DstColorType:
folder.append("_kIndex");
break;
case CodecSrc::kGrayscale_Always_DstColorType:
folder.append("_kGray");
break;
default:
SkASSERT(false);
return;
}
if (1 != sampleSize) {
folder.appendf("_%.3f", 1.0f / (float) sampleSize);
}
BRDSrc* src = new BRDSrc(path, strategy, mode, dstColorType, sampleSize);
push_src("image", folder, src);
}
static void push_brd_srcs(Path path) {
const SkBitmapRegionDecoder::Strategy strategies[] = {
SkBitmapRegionDecoder::kCanvas_Strategy,
SkBitmapRegionDecoder::kAndroidCodec_Strategy,
};
// Test on a variety of sampleSizes, making sure to include:
// - 2, 4, and 8, which are natively supported by jpeg
// - multiples of 2 which are not divisible by 4 (analogous for 4)
// - larger powers of two, since BRD clients generally use powers of 2
// We will only produce output for the larger sizes on large images.
const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32, 64 };
// We will only test to one backend (8888), but we will test all of the
// color types that we need to decode to on this backend.
const CodecSrc::DstColorType dstColorTypes[] = {
CodecSrc::kGetFromCanvas_DstColorType,
CodecSrc::kIndex8_Always_DstColorType,
CodecSrc::kGrayscale_Always_DstColorType,
};
const BRDSrc::Mode modes[] = {
BRDSrc::kFullImage_Mode,
BRDSrc::kDivisor_Mode,
};
for (SkBitmapRegionDecoder::Strategy strategy : strategies) {
for (uint32_t sampleSize : sampleSizes) {
for (CodecSrc::DstColorType dstColorType : dstColorTypes) {
if (brd_color_type_supported(strategy, dstColorType)) {
for (BRDSrc::Mode mode : modes) {
push_brd_src(path, strategy, dstColorType, mode, sampleSize);
}
}
}
}
}
}
static bool brd_supported(const char* ext) {
static const char* const exts[] = {
"jpg", "jpeg", "png", "webp",
"JPG", "JPEG", "PNG", "WEBP",
};
for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) {
if (0 == strcmp(exts[i], ext)) {
return true;
}
}
return false;
}
static bool gather_srcs() {
for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->next()) {
push_src("gm", "", new GMSrc(r->factory()));
}
for (int i = 0; i < FLAGS_skps.count(); i++) {
const char* path = FLAGS_skps[i];
if (sk_isdir(path)) {
SkOSFile::Iter it(path, "skp");
for (SkString file; it.next(&file); ) {
push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str())));
}
} else {
push_src("skp", "", new SKPSrc(path));
}
}
SkTArray<SkString> images;
if (!CollectImages(FLAGS_images, &images)) {
return false;
}
for (auto image : images) {
push_codec_srcs(image);
if (FLAGS_simpleCodec) {
continue;
}
const char* ext = strrchr(image.c_str(), '.');
if (ext && brd_supported(ext+1)) {
push_brd_srcs(image);
}
}
SkTArray<SkString> colorImages;
if (!CollectImages(FLAGS_colorImages, &colorImages)) {
return false;
}
for (auto colorImage : colorImages) {
ColorCodecSrc* src = new ColorCodecSrc(colorImage, ColorCodecSrc::kBaseline_Mode);
push_src("image", "color_codec_baseline", src);
}
return true;
}
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
static void push_sink(const SkCommandLineConfig& config, Sink* s) {
Revert of Add config options to run different GPU APIs to dm and nanobench (patchset #21 id:400001 of https://codereview.chromium.org/1490113005/ ) Reason for revert: The Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug builder fails after this CL. Links to specific builds: http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1689 http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1690 http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1691 Original issue's description: > Add config options to run different GPU APIs to dm and nanobench > > Add extended config specification form that can be used to run different > gpu backend with different APIs. > > The configs can be specified with the form: > gpu(api=string,dit=bool,nvpr=bool,samples=int) > > This replaces and removes the --gpuAPI flag. > > All existing configs should still work. > > Adds following documentation: > > out/Debug/dm --help config > > Flags: > --config: type: string default: 565 8888 gpu nonrendering > Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 > nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg > xps or use extended form 'backend(option=value,...)'. > > Extended form: 'backend(option=value,...)' > > Possible backends and options: > > gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend > api type: string default: native. > Select graphics API to use with gpu backend. > Options: > native Use platform default OpenGL or OpenGL ES backend. > gl Use OpenGL. > gles Use OpenGL ES. > debug Use debug OpenGL. > null Use null OpenGL. > dit type: bool default: false. > Use device independent text. > nvpr type: bool default: false. > Use NV_path_rendering OpenGL and OpenGL ES extension. > samples type: int default: 0. > Use multisampling with N samples. > > Predefined configs: > > gpu = gpu() > msaa4 = gpu(samples=4) > msaa16 = gpu(samples=16) > nvprmsaa4 = gpu(nvpr=true,samples=4) > nvprmsaa16 = gpu(nvpr=true,samples=16) > gpudft = gpu(dit=true) > gpudebug = gpu(api=debug) > gpunull = gpu(api=null) > debug = gpu(api=debug) > nullgpu = gpu(api=null) > > BUG=skia:2992 > > Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 > > Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b > > Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd TBR=mtklein@google.com,bsalomon@google.com,joshualitt@google.com,scroggo@google.com,kkinnunen@nvidia.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:2992 Review URL: https://codereview.chromium.org/1548683002
2015-12-22 18:22:26 +00:00
SkAutoTDelete<Sink> sink(s);
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
// Try a simple Src as a canary. If it fails, skip this sink.
struct : public Src {
Error draw(SkCanvas* c) const override {
c->drawRect(SkRect::MakeWH(1,1), SkPaint());
return "";
}
SkISize size() const override { return SkISize::Make(16, 16); }
Name name() const override { return "justOneRect"; }
} justOneRect;
SkBitmap bitmap;
SkDynamicMemoryWStream stream;
SkString log;
Error err = sink->draw(justOneRect, &bitmap, &stream, &log);
if (err.isFatal()) {
info("Could not run %s: %s\n", config.getTag().c_str(), err.c_str());
exit(1);
}
TaggedSink& ts = gSinks.push_back();
ts.reset(sink.release());
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
ts.tag = config.getTag();
}
static bool gpu_supported() {
#if SK_SUPPORT_GPU
return FLAGS_gpu;
#else
return false;
#endif
}
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
static Sink* create_sink(const SkCommandLineConfig* config) {
#if SK_SUPPORT_GPU
Revert of Add config options to run different GPU APIs to dm and nanobench (patchset #21 id:400001 of https://codereview.chromium.org/1490113005/ ) Reason for revert: The Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug builder fails after this CL. Links to specific builds: http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1689 http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1690 http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1691 Original issue's description: > Add config options to run different GPU APIs to dm and nanobench > > Add extended config specification form that can be used to run different > gpu backend with different APIs. > > The configs can be specified with the form: > gpu(api=string,dit=bool,nvpr=bool,samples=int) > > This replaces and removes the --gpuAPI flag. > > All existing configs should still work. > > Adds following documentation: > > out/Debug/dm --help config > > Flags: > --config: type: string default: 565 8888 gpu nonrendering > Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 > nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg > xps or use extended form 'backend(option=value,...)'. > > Extended form: 'backend(option=value,...)' > > Possible backends and options: > > gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend > api type: string default: native. > Select graphics API to use with gpu backend. > Options: > native Use platform default OpenGL or OpenGL ES backend. > gl Use OpenGL. > gles Use OpenGL ES. > debug Use debug OpenGL. > null Use null OpenGL. > dit type: bool default: false. > Use device independent text. > nvpr type: bool default: false. > Use NV_path_rendering OpenGL and OpenGL ES extension. > samples type: int default: 0. > Use multisampling with N samples. > > Predefined configs: > > gpu = gpu() > msaa4 = gpu(samples=4) > msaa16 = gpu(samples=16) > nvprmsaa4 = gpu(nvpr=true,samples=4) > nvprmsaa16 = gpu(nvpr=true,samples=16) > gpudft = gpu(dit=true) > gpudebug = gpu(api=debug) > gpunull = gpu(api=null) > debug = gpu(api=debug) > nullgpu = gpu(api=null) > > BUG=skia:2992 > > Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 > > Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b > > Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd TBR=mtklein@google.com,bsalomon@google.com,joshualitt@google.com,scroggo@google.com,kkinnunen@nvidia.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:2992 Review URL: https://codereview.chromium.org/1548683002
2015-12-22 18:22:26 +00:00
if (gpu_supported()) {
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
if (const SkCommandLineConfigGpu* gpuConfig = config->asConfigGpu()) {
GrContextFactory::ContextType contextType = gpuConfig->getContextType();
GrContextFactory::ContextOptions contextOptions =
GrContextFactory::kNone_ContextOptions;
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
if (gpuConfig->getUseNVPR()) {
contextOptions = static_cast<GrContextFactory::ContextOptions>(
contextOptions | GrContextFactory::kEnableNVPR_ContextOptions);
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
}
if (SkColorAndProfileAreGammaCorrect(gpuConfig->getColorType(),
gpuConfig->getProfileType())) {
contextOptions = static_cast<GrContextFactory::ContextOptions>(
contextOptions | GrContextFactory::kRequireSRGBSupport_ContextOptions);
}
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
GrContextFactory testFactory;
if (!testFactory.get(contextType, contextOptions)) {
info("WARNING: can not create GPU context for config '%s'. "
"GM tests will be skipped.\n", gpuConfig->getTag().c_str());
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
return nullptr;
}
return new GPUSink(contextType, contextOptions, gpuConfig->getSamples(),
gpuConfig->getUseDIText(), gpuConfig->getColorType(),
gpuConfig->getProfileType(), FLAGS_gpu_threading);
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
}
Revert of Add config options to run different GPU APIs to dm and nanobench (patchset #21 id:400001 of https://codereview.chromium.org/1490113005/ ) Reason for revert: The Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug builder fails after this CL. Links to specific builds: http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1689 http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1690 http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1691 Original issue's description: > Add config options to run different GPU APIs to dm and nanobench > > Add extended config specification form that can be used to run different > gpu backend with different APIs. > > The configs can be specified with the form: > gpu(api=string,dit=bool,nvpr=bool,samples=int) > > This replaces and removes the --gpuAPI flag. > > All existing configs should still work. > > Adds following documentation: > > out/Debug/dm --help config > > Flags: > --config: type: string default: 565 8888 gpu nonrendering > Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 > nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg > xps or use extended form 'backend(option=value,...)'. > > Extended form: 'backend(option=value,...)' > > Possible backends and options: > > gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend > api type: string default: native. > Select graphics API to use with gpu backend. > Options: > native Use platform default OpenGL or OpenGL ES backend. > gl Use OpenGL. > gles Use OpenGL ES. > debug Use debug OpenGL. > null Use null OpenGL. > dit type: bool default: false. > Use device independent text. > nvpr type: bool default: false. > Use NV_path_rendering OpenGL and OpenGL ES extension. > samples type: int default: 0. > Use multisampling with N samples. > > Predefined configs: > > gpu = gpu() > msaa4 = gpu(samples=4) > msaa16 = gpu(samples=16) > nvprmsaa4 = gpu(nvpr=true,samples=4) > nvprmsaa16 = gpu(nvpr=true,samples=16) > gpudft = gpu(dit=true) > gpudebug = gpu(api=debug) > gpunull = gpu(api=null) > debug = gpu(api=debug) > nullgpu = gpu(api=null) > > BUG=skia:2992 > > Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 > > Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b > > Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd TBR=mtklein@google.com,bsalomon@google.com,joshualitt@google.com,scroggo@google.com,kkinnunen@nvidia.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:2992 Review URL: https://codereview.chromium.org/1548683002
2015-12-22 18:22:26 +00:00
}
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
#endif
#define SINK(t, sink, ...) if (config->getBackend().equals(t)) { return new sink(__VA_ARGS__); }
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Review URL: https://codereview.chromium.org/1490113005
2015-12-22 07:48:13 +00:00
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
SINK("hwui", HWUISink);
#endif
if (FLAGS_cpu) {
SINK("565", RasterSink, kRGB_565_SkColorType);
SINK("8888", RasterSink, kN32_SkColorType);
SINK("srgb", RasterSink, kN32_SkColorType, kSRGB_SkColorProfileType);
SINK("f16", RasterSink, kRGBA_F16_SkColorType);
SINK("pdf", PDFSink);
SINK("skp", SKPSink);
SINK("svg", SVGSink);
SINK("null", NullSink);
SINK("xps", XPSSink);
SINK("pdfa", PDFSink, true);
}
#undef SINK
return nullptr;
}
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
static Sink* create_via(const SkString& tag, Sink* wrapped) {
#define VIA(t, via, ...) if (tag.equals(t)) { return new via(__VA_ARGS__); }
VIA("twice", ViaTwice, wrapped);
VIA("serialize", ViaSerialization, wrapped);
VIA("pic", ViaPicture, wrapped);
VIA("2ndpic", ViaSecondPicture, wrapped);
VIA("sp", ViaSingletonPictures, wrapped);
VIA("tiles", ViaTiles, 256, 256, nullptr, wrapped);
VIA("tiles_rt", ViaTiles, 256, 256, new SkRTreeFactory, wrapped);
if (FLAGS_matrix.count() == 4) {
SkMatrix m;
m.reset();
m.setScaleX((SkScalar)atof(FLAGS_matrix[0]));
m.setSkewX ((SkScalar)atof(FLAGS_matrix[1]));
m.setSkewY ((SkScalar)atof(FLAGS_matrix[2]));
m.setScaleY((SkScalar)atof(FLAGS_matrix[3]));
VIA("matrix", ViaMatrix, m, wrapped);
VIA("upright", ViaUpright, m, wrapped);
}
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
VIA("androidsdk", ViaAndroidSDK, wrapped);
#endif
#undef VIA
return nullptr;
}
static bool gather_sinks() {
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
SkCommandLineConfigArray configs;
ParseConfigs(FLAGS_config, &configs);
for (int i = 0; i < configs.count(); i++) {
const SkCommandLineConfig& config = *configs[i];
Sink* sink = create_sink(&config);
if (sink == nullptr) {
info("Skipping config %s: Don't understand '%s'.\n", config.getTag().c_str(),
config.getTag().c_str());
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
continue;
}
const SkTArray<SkString>& parts = config.getViaParts();
for (int j = parts.count(); j-- > 0;) {
const SkString& part = parts[j];
Sink* next = create_via(part, sink);
if (next == nullptr) {
info("Skipping config %s: Don't understand '%s'.\n", config.getTag().c_str(),
part.c_str());
delete sink;
sink = nullptr;
break;
}
sink = next;
}
if (sink) {
push_sink(config, sink);
}
}
// If no configs were requested (just running tests, perhaps?), then we're okay.
// Otherwise, make sure that at least one sink was constructed correctly. This catches
// the case of bots without a GPU being assigned GPU configs.
return (configs.count() == 0) || (gSinks.count() > 0);
}
static bool dump_png(SkBitmap bitmap, const char* path, const char* md5) {
const int w = bitmap.width(),
h = bitmap.height();
sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(bitmap);
if (encodedBitmap.get() == nullptr) {
return false;
}
uint32_t* rgba = static_cast<uint32_t*>(encodedBitmap.get()->writable_data());
// We don't need bitmap anymore. Might as well drop our ref.
bitmap.reset();
FILE* f = fopen(path, "wb");
if (!f) { return false; }
png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
if (!png) {
fclose(f);
return false;
}
png_infop info = png_create_info_struct(png);
if (!info) {
png_destroy_write_struct(&png, &info);
fclose(f);
return false;
}
SkString description;
description.append("Key: ");
for (int i = 0; i < FLAGS_key.count(); i++) {
description.appendf("%s ", FLAGS_key[i]);
}
description.append("Properties: ");
for (int i = 0; i < FLAGS_properties.count(); i++) {
description.appendf("%s ", FLAGS_properties[i]);
}
description.appendf("MD5: %s", md5);
png_text text[2];
text[0].key = (png_charp)"Author";
text[0].text = (png_charp)"DM dump_png()";
text[0].compression = PNG_TEXT_COMPRESSION_NONE;
text[1].key = (png_charp)"Description";
text[1].text = (png_charp)description.c_str();
text[1].compression = PNG_TEXT_COMPRESSION_NONE;
png_set_text(png, info, text, 2);
png_init_io(png, f);
png_set_IHDR(png, info, (png_uint_32)w, (png_uint_32)h, 8,
PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
png_write_info(png, info);
for (int j = 0; j < h; j++) {
png_bytep row = (png_bytep)(rgba + w*j);
png_write_rows(png, &row, 1);
}
png_write_end(png, info);
png_destroy_write_struct(&png, &info);
fclose(f);
return true;
}
static bool match(const char* needle, const char* haystack) {
return 0 == strcmp("_", needle) || nullptr != strstr(haystack, needle);
}
static bool is_blacklisted(const char* sink, const char* src,
const char* srcOptions, const char* name) {
for (int i = 0; i < FLAGS_blacklist.count() - 3; i += 4) {
if (match(FLAGS_blacklist[i+0], sink) &&
match(FLAGS_blacklist[i+1], src) &&
match(FLAGS_blacklist[i+2], srcOptions) &&
match(FLAGS_blacklist[i+3], name)) {
return true;
}
}
return false;
}
// Even when a Task Sink reports to be non-threadsafe (e.g. GPU), we know things like
// .png encoding are definitely thread safe. This lets us offload that work to CPU threads.
static SkTaskGroup gDefinitelyThreadSafeWork;
// The finest-grained unit of work we can run: draw a single Src into a single Sink,
// report any errors, and perhaps write out the output: a .png of the bitmap, or a raw stream.
struct Task {
Task(const TaggedSrc& src, const TaggedSink& sink) : src(src), sink(sink) {}
const TaggedSrc& src;
const TaggedSink& sink;
static void Run(const Task& task) {
SkString name = task.src->name();
SkString log;
if (!FLAGS_dryRun) {
SkBitmap bitmap;
SkDynamicMemoryWStream stream;
start(task.sink.tag.c_str(), task.src.tag.c_str(),
task.src.options.c_str(), name.c_str());
Error err = task.sink->draw(*task.src, &bitmap, &stream, &log);
if (!log.isEmpty()) {
info("%s %s %s %s:\n%s\n", task.sink.tag.c_str()
, task.src.tag.c_str()
, task.src.options.c_str()
, name.c_str()
, log.c_str());
}
if (!err.isEmpty()) {
if (err.isFatal()) {
fail(SkStringPrintf("%s %s %s %s: %s",
task.sink.tag.c_str(),
task.src.tag.c_str(),
task.src.options.c_str(),
name.c_str(),
err.c_str()));
} else {
done(task.sink.tag.c_str(), task.src.tag.c_str(),
task.src.options.c_str(), name.c_str());
return;
}
}
// We're likely switching threads here, so we must capture by value, [=] or [foo,bar].
SkStreamAsset* data = stream.detachAsStream();
gDefinitelyThreadSafeWork.add([task,name,bitmap,data]{
SkAutoTDelete<SkStreamAsset> ownedData(data);
// Why doesn't the copy constructor do this when we have pre-locked pixels?
bitmap.lockPixels();
SkString md5;
if (!FLAGS_writePath.isEmpty() || !FLAGS_readPath.isEmpty()) {
SkMD5 hash;
if (data->getLength()) {
hash.writeStream(data, data->getLength());
data->rewind();
} else {
// If we're BGRA (Linux, Windows), swizzle over to RGBA (Mac, Android).
// This helps eliminate multiple 0-pixel-diff hashes on gold.skia.org.
// (Android's general slow speed breaks the tie arbitrarily in RGBA's favor.)
// We might consider promoting 565 to RGBA too.
if (bitmap.colorType() == kBGRA_8888_SkColorType) {
SkBitmap swizzle;
SkAssertResult(bitmap.copyTo(&swizzle, kRGBA_8888_SkColorType));
hash.write(swizzle.getPixels(), swizzle.getSize());
} else {
hash.write(bitmap.getPixels(), bitmap.getSize());
}
}
SkMD5::Digest digest;
hash.finish(digest);
for (int i = 0; i < 16; i++) {
md5.appendf("%02x", digest.data[i]);
}
}
if (!FLAGS_readPath.isEmpty() &&
!gGold.contains(Gold(task.sink.tag, task.src.tag,
task.src.options, name, md5))) {
fail(SkStringPrintf("%s not found for %s %s %s %s in %s",
md5.c_str(),
task.sink.tag.c_str(),
task.src.tag.c_str(),
task.src.options.c_str(),
name.c_str(),
FLAGS_readPath[0]));
}
if (!FLAGS_writePath.isEmpty()) {
const char* ext = task.sink->fileExtension();
if (data->getLength()) {
WriteToDisk(task, md5, ext, data, data->getLength(), nullptr);
SkASSERT(bitmap.drawsNothing());
} else if (!bitmap.drawsNothing()) {
WriteToDisk(task, md5, ext, nullptr, 0, &bitmap);
}
}
});
}
done(task.sink.tag.c_str(), task.src.tag.c_str(), task.src.options.c_str(), name.c_str());
}
static void WriteToDisk(const Task& task,
SkString md5,
const char* ext,
SkStream* data, size_t len,
const SkBitmap* bitmap) {
bool gammaCorrect = false;
if (bitmap) {
gammaCorrect = SkImageInfoIsGammaCorrect(bitmap->info());
}
JsonWriter::BitmapResult result;
result.name = task.src->name();
result.config = task.sink.tag;
result.sourceType = task.src.tag;
result.sourceOptions = task.src.options;
result.ext = ext;
result.gammaCorrect = gammaCorrect;
result.md5 = md5;
JsonWriter::AddBitmapResult(result);
// If an MD5 is uninteresting, we want it noted in the JSON file,
// but don't want to dump it out as a .png (or whatever ext is).
if (gUninterestingHashes.contains(md5)) {
return;
}
const char* dir = FLAGS_writePath[0];
if (0 == strcmp(dir, "@")) { // Needed for iOS.
dir = FLAGS_resourcePath[0];
}
sk_mkdir(dir);
SkString path;
if (FLAGS_nameByHash) {
path = SkOSPath::Join(dir, result.md5.c_str());
path.append(".");
path.append(ext);
if (sk_exists(path.c_str())) {
return; // Content-addressed. If it exists already, we're done.
}
} else {
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
path = SkOSPath::Join(dir, task.sink.tag.c_str());
sk_mkdir(path.c_str());
path = SkOSPath::Join(path.c_str(), task.src.tag.c_str());
sk_mkdir(path.c_str());
if (strcmp(task.src.options.c_str(), "") != 0) {
path = SkOSPath::Join(path.c_str(), task.src.options.c_str());
sk_mkdir(path.c_str());
}
path = SkOSPath::Join(path.c_str(), task.src->name().c_str());
path.append(".");
path.append(ext);
}
if (bitmap) {
if (!dump_png(*bitmap, path.c_str(), result.md5.c_str())) {
fail(SkStringPrintf("Can't encode PNG to %s.\n", path.c_str()));
return;
}
} else {
SkFILEWStream file(path.c_str());
if (!file.isValid()) {
fail(SkStringPrintf("Can't open %s for writing.\n", path.c_str()));
return;
}
if (!file.writeStream(data, len)) {
fail(SkStringPrintf("Can't write to %s.\n", path.c_str()));
return;
}
}
}
};
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Unit tests don't fit so well into the Src/Sink model, so we give them special treatment.
static SkTDArray<skiatest::Test> gParallelTests, gSerialTests;
static void gather_tests() {
if (!FLAGS_src.contains("tests")) {
return;
}
for (const skiatest::TestRegistry* r = skiatest::TestRegistry::Head(); r; r = r->next()) {
if (!in_shard()) {
continue;
}
// Despite its name, factory() is returning a reference to
// link-time static const POD data.
const skiatest::Test& test = r->factory();
if (SkCommandLineFlags::ShouldSkip(FLAGS_match, test.name)) {
continue;
}
if (test.needsGpu && gpu_supported()) {
(FLAGS_gpu_threading ? gParallelTests : gSerialTests).push(test);
} else if (!test.needsGpu && FLAGS_cpu) {
gParallelTests.push(test);
}
}
}
static void run_test(skiatest::Test test) {
struct : public skiatest::Reporter {
void reportFailed(const skiatest::Failure& failure) override {
fail(failure.toString());
JsonWriter::AddTestFailure(failure);
}
bool allowExtendedTest() const override {
return FLAGS_pathOpsExtended;
}
bool verbose() const override { return FLAGS_veryVerbose; }
} reporter;
if (!FLAGS_dryRun && !is_blacklisted("_", "tests", "_", test.name)) {
start("unit", "test", "", test.name);
GrContextFactory factory;
test.proc(&reporter, &factory);
}
done("unit", "test", "", test.name);
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
DEFINE_int32(status_sec, 15, "Print status this often (and if we crash).");
SkThread* start_status_thread() {
auto thread = new SkThread([] (void*) {
for (;;) {
print_status();
#if defined(SK_BUILD_FOR_WIN)
Sleep(FLAGS_status_sec * 1000);
#else
sleep(FLAGS_status_sec);
#endif
}
});
thread->start();
return thread;
}
#define PORTABLE_FONT_PREFIX "Toy Liberation "
static sk_sp<SkTypeface> create_from_name(const char familyName[], SkTypeface::Style style) {
if (familyName && strlen(familyName) > sizeof(PORTABLE_FONT_PREFIX)
&& !strncmp(familyName, PORTABLE_FONT_PREFIX, sizeof(PORTABLE_FONT_PREFIX) - 1)) {
return sk_tool_utils::create_portable_typeface(familyName, style);
}
return nullptr;
}
#undef PORTABLE_FONT_PREFIX
extern sk_sp<SkTypeface> (*gCreateTypefaceDelegate)(const char [], SkTypeface::Style );
int dm_main();
int dm_main() {
setbuf(stdout, nullptr);
setup_crash_handler();
if (FLAGS_verbose) {
gVLog = stderr;
} else if (!FLAGS_writePath.isEmpty()) {
sk_mkdir(FLAGS_writePath[0]);
gVLog = freopen(SkOSPath::Join(FLAGS_writePath[0], "verbose.log").c_str(), "w", stderr);
}
JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing.
SkAutoGraphics ag;
SkTaskGroup::Enabler enabled(FLAGS_threads);
gCreateTypefaceDelegate = &create_from_name;
{
SkString testResourcePath = GetResourcePath("color_wheel.png");
SkFILEStream testResource(testResourcePath.c_str());
if (!testResource.isValid()) {
info("Some resources are missing. Do you need to set --resourcePath?\n");
}
}
gather_gold();
gather_uninteresting_hashes();
if (!gather_srcs()) {
return 1;
}
if (!gather_sinks()) {
return 1;
}
gather_tests();
gPending = gSrcs.count() * gSinks.count() + gParallelTests.count() + gSerialTests.count();
info("%d srcs * %d sinks + %d tests == %d tasks",
gSrcs.count(), gSinks.count(), gParallelTests.count() + gSerialTests.count(), gPending);
SkAutoTDelete<SkThread> statusThread(start_status_thread());
// Kick off as much parallel work as we can, making note of any serial work we'll need to do.
SkTaskGroup parallel;
SkTArray<Task> serial;
for (auto& sink : gSinks)
for (auto& src : gSrcs) {
if (src->veto(sink->flags()) ||
is_blacklisted(sink.tag.c_str(), src.tag.c_str(),
src.options.c_str(), src->name().c_str())) {
SkAutoTAcquire<SkSpinlock> lock(gMutex);
gPending--;
continue;
}
Task task(src, sink);
if (src->serial() || sink->serial()) {
serial.push_back(task);
} else {
parallel.add([task] { Task::Run(task); });
}
}
for (auto test : gParallelTests) {
parallel.add([test] { run_test(test); });
}
// With the parallel work running, run serial tasks and tests here on main thread.
for (auto task : serial) { Task::Run(task); }
for (auto test : gSerialTests) { run_test(test); }
// Wait for any remaining parallel work to complete (including any spun off of serial tasks).
parallel.wait();
gDefinitelyThreadSafeWork.wait();
// We'd better have run everything.
SkASSERT(gPending == 0);
// Make sure we've flushed all our results to disk.
JsonWriter::DumpJson();
// At this point we're back in single-threaded land.
sk_tool_utils::release_portable_typefaces();
if (gFailures.count() > 0) {
info("Failures:\n");
for (int i = 0; i < gFailures.count(); i++) {
info("\t%s\n", gFailures[i].c_str());
}
info("%d failures\n", gFailures.count());
return 1;
}
#ifdef SK_PDF_IMAGE_STATS
SkPDFImageDumpStats();
#endif // SK_PDF_IMAGE_STATS
print_status();
info("Finished!\n");
return 0;
}
Generate list of GPU contexts outside SurfaceTest tests Add support for feeding the tests with contexts directly to the unit test framework. This fixes the problem where tests are more complex than needed just in order to run the test code with multiple backends. Also makes it possible to change the logic how contexts are created. Instead of direct numbering, the different testable contexts may be generated from filtered cross-product of context options. For example: currently NVPR is a type of context. However, it could be also an on/off feature of any context. In order to test this kind of context, the enumeration can not be just of context type. It's simpler to move the enumeration out of the tests. A test targeting both normal and GPU backends would look like: static void test_obj_behavior(skiatest::Reporter* reporter, SkObj* obj, [other params] ) { ... test with obj and param .. } DEF_TEST(ObjBehavior, reporter) { for (auto& object : generate_object) { for (auto& other_param : generate_other_variant) { test_obj_behavior(reporter, object, other_param); } } } #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_ALL_CONTEXTS(ObjBehavior_Gpu, reporter, context) { for (auto& object : generate_gpu_object) { for (auto& other_param : generate_other_variant) { test_obj_behavior(reporter, object, other_param); } } } #endif Uses the feature in SurfaceTests as an example. Moves SkSurface -related tests from ImageTest to SurfaceTest. BUG=skia:2992 Review URL: https://codereview.chromium.org/1446453003
2015-11-20 21:32:24 +00:00
// TODO: currently many GPU tests are declared outside SK_SUPPORT_GPU guards.
// Thus we export the empty RunWithGPUTestContexts when SK_SUPPORT_GPU=0.
namespace skiatest {
Generate list of GPU contexts outside SurfaceTest tests Add support for feeding the tests with contexts directly to the unit test framework. This fixes the problem where tests are more complex than needed just in order to run the test code with multiple backends. Also makes it possible to change the logic how contexts are created. Instead of direct numbering, the different testable contexts may be generated from filtered cross-product of context options. For example: currently NVPR is a type of context. However, it could be also an on/off feature of any context. In order to test this kind of context, the enumeration can not be just of context type. It's simpler to move the enumeration out of the tests. A test targeting both normal and GPU backends would look like: static void test_obj_behavior(skiatest::Reporter* reporter, SkObj* obj, [other params] ) { ... test with obj and param .. } DEF_TEST(ObjBehavior, reporter) { for (auto& object : generate_object) { for (auto& other_param : generate_other_variant) { test_obj_behavior(reporter, object, other_param); } } } #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_ALL_CONTEXTS(ObjBehavior_Gpu, reporter, context) { for (auto& object : generate_gpu_object) { for (auto& other_param : generate_other_variant) { test_obj_behavior(reporter, object, other_param); } } } #endif Uses the feature in SurfaceTests as an example. Moves SkSurface -related tests from ImageTest to SurfaceTest. BUG=skia:2992 Review URL: https://codereview.chromium.org/1446453003
2015-11-20 21:32:24 +00:00
#if SK_SUPPORT_GPU
bool IsGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
return kOpenGL_GrBackend == GrContextFactory::ContextTypeBackend(type);
}
bool IsVulkanContextType(sk_gpu_test::GrContextFactory::ContextType type) {
return kVulkan_GrBackend == GrContextFactory::ContextTypeBackend(type);
}
bool IsRenderingGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
return IsGLContextType(type) && GrContextFactory::IsRenderingContext(type);
}
bool IsNullGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
return type == GrContextFactory::kNullGL_ContextType;
}
#else
bool IsGLContextType(int) { return false; }
bool IsVulkanContextType(int) { return false; }
bool IsRenderingGLContextType(int) { return false; }
bool IsNullGLContextType(int) { return false; }
Add config options to run different GPU APIs to dm and nanobench Add extended config specification form that can be used to run different gpu backend with different APIs. The configs can be specified with the form: gpu(api=string,dit=bool,nvpr=bool,samples=int) This replaces and removes the --gpuAPI flag. All existing configs should still work. Adds following documentation: out/Debug/dm --help config Flags: --config: type: string default: 565 8888 gpu nonrendering Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4 nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg xps or use extended form 'backend(option=value,...)'. Extended form: 'backend(option=value,...)' Possible backends and options: gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend api type: string default: native. Select graphics API to use with gpu backend. Options: native Use platform default OpenGL or OpenGL ES backend. gl Use OpenGL. gles Use OpenGL ES. debug Use debug OpenGL. null Use null OpenGL. dit type: bool default: false. Use device independent text. nvpr type: bool default: false. Use NV_path_rendering OpenGL and OpenGL ES extension. samples type: int default: 0. Use multisampling with N samples. Predefined configs: gpu = gpu() msaa4 = gpu(samples=4) msaa16 = gpu(samples=16) nvprmsaa4 = gpu(nvpr=true,samples=4) nvprmsaa16 = gpu(nvpr=true,samples=16) gpudft = gpu(dit=true) gpudebug = gpu(api=debug) gpunull = gpu(api=null) debug = gpu(api=debug) nullgpu = gpu(api=null) BUG=skia:2992 Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005 Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
#endif
void RunWithGPUTestContexts(GrContextTestFn* test, GrContextTypeFilterFn* contextTypeFilter,
Reporter* reporter, GrContextFactory* factory) {
#if SK_SUPPORT_GPU
for (int typeInt = 0; typeInt < GrContextFactory::kContextTypeCnt; ++typeInt) {
GrContextFactory::ContextType contextType = (GrContextFactory::ContextType) typeInt;
ContextInfo ctxInfo = factory->getContextInfo(contextType);
if (contextTypeFilter && !(*contextTypeFilter)(contextType)) {
Generate list of GPU contexts outside SurfaceTest tests Add support for feeding the tests with contexts directly to the unit test framework. This fixes the problem where tests are more complex than needed just in order to run the test code with multiple backends. Also makes it possible to change the logic how contexts are created. Instead of direct numbering, the different testable contexts may be generated from filtered cross-product of context options. For example: currently NVPR is a type of context. However, it could be also an on/off feature of any context. In order to test this kind of context, the enumeration can not be just of context type. It's simpler to move the enumeration out of the tests. A test targeting both normal and GPU backends would look like: static void test_obj_behavior(skiatest::Reporter* reporter, SkObj* obj, [other params] ) { ... test with obj and param .. } DEF_TEST(ObjBehavior, reporter) { for (auto& object : generate_object) { for (auto& other_param : generate_other_variant) { test_obj_behavior(reporter, object, other_param); } } } #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_ALL_CONTEXTS(ObjBehavior_Gpu, reporter, context) { for (auto& object : generate_gpu_object) { for (auto& other_param : generate_other_variant) { test_obj_behavior(reporter, object, other_param); } } } #endif Uses the feature in SurfaceTests as an example. Moves SkSurface -related tests from ImageTest to SurfaceTest. BUG=skia:2992 Review URL: https://codereview.chromium.org/1446453003
2015-11-20 21:32:24 +00:00
continue;
}
// Use "native" instead of explicitly trying OpenGL and OpenGL ES. Do not use GLES on,
// desktop since tests do not account for not fixing http://skbug.com/2809
if (contextType == GrContextFactory::kGL_ContextType ||
contextType == GrContextFactory::kGLES_ContextType) {
if (contextType != GrContextFactory::kNativeGL_ContextType) {
continue;
}
}
if (ctxInfo.grContext()) {
(*test)(reporter, ctxInfo);
}
ctxInfo = factory->getContextInfo(contextType,
GrContextFactory::kEnableNVPR_ContextOptions);
if (ctxInfo.grContext()) {
(*test)(reporter, ctxInfo);
Generate list of GPU contexts outside SurfaceTest tests Add support for feeding the tests with contexts directly to the unit test framework. This fixes the problem where tests are more complex than needed just in order to run the test code with multiple backends. Also makes it possible to change the logic how contexts are created. Instead of direct numbering, the different testable contexts may be generated from filtered cross-product of context options. For example: currently NVPR is a type of context. However, it could be also an on/off feature of any context. In order to test this kind of context, the enumeration can not be just of context type. It's simpler to move the enumeration out of the tests. A test targeting both normal and GPU backends would look like: static void test_obj_behavior(skiatest::Reporter* reporter, SkObj* obj, [other params] ) { ... test with obj and param .. } DEF_TEST(ObjBehavior, reporter) { for (auto& object : generate_object) { for (auto& other_param : generate_other_variant) { test_obj_behavior(reporter, object, other_param); } } } #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_ALL_CONTEXTS(ObjBehavior_Gpu, reporter, context) { for (auto& object : generate_gpu_object) { for (auto& other_param : generate_other_variant) { test_obj_behavior(reporter, object, other_param); } } } #endif Uses the feature in SurfaceTests as an example. Moves SkSurface -related tests from ImageTest to SurfaceTest. BUG=skia:2992 Review URL: https://codereview.chromium.org/1446453003
2015-11-20 21:32:24 +00:00
}
}
#endif
}
} // namespace skiatest
#if !defined(SK_BUILD_FOR_IOS)
int main(int argc, char** argv) {
SkCommandLineFlags::Parse(argc, argv);
return dm_main();
}
#endif