| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include <ctype.h> | 8 #include <ctype.h> |
| 9 | 9 |
| 10 #include "nanobench.h" | 10 #include "nanobench.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "SubsetSingleBench.h" | 24 #include "SubsetSingleBench.h" |
| 25 #include "SubsetTranslateBench.h" | 25 #include "SubsetTranslateBench.h" |
| 26 #include "SubsetZoomBench.h" | 26 #include "SubsetZoomBench.h" |
| 27 #include "Stats.h" | 27 #include "Stats.h" |
| 28 | 28 |
| 29 #include "SkBitmapRegionDecoder.h" | 29 #include "SkBitmapRegionDecoder.h" |
| 30 #include "SkBBoxHierarchy.h" | 30 #include "SkBBoxHierarchy.h" |
| 31 #include "SkCanvas.h" | 31 #include "SkCanvas.h" |
| 32 #include "SkCodec.h" | 32 #include "SkCodec.h" |
| 33 #include "SkCommonFlags.h" | 33 #include "SkCommonFlags.h" |
| 34 #include "SkCommonFlagsConfig.h" |
| 34 #include "SkData.h" | 35 #include "SkData.h" |
| 35 #include "SkForceLinking.h" | 36 #include "SkForceLinking.h" |
| 36 #include "SkGraphics.h" | 37 #include "SkGraphics.h" |
| 37 #include "SkOSFile.h" | 38 #include "SkOSFile.h" |
| 38 #include "SkPictureRecorder.h" | 39 #include "SkPictureRecorder.h" |
| 39 #include "SkPictureUtils.h" | 40 #include "SkPictureUtils.h" |
| 40 #include "SkString.h" | 41 #include "SkString.h" |
| 41 #include "SkSurface.h" | 42 #include "SkSurface.h" |
| 42 #include "SkTaskGroup.h" | 43 #include "SkTaskGroup.h" |
| 43 | 44 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // Frame lag is unknown. | 165 // Frame lag is unknown. |
| 165 *maxFrameLag = FLAGS_gpuFrameLag; | 166 *maxFrameLag = FLAGS_gpuFrameLag; |
| 166 } | 167 } |
| 167 return true; | 168 return true; |
| 168 } | 169 } |
| 169 bool init(SkImageInfo info, Benchmark* bench) override { | 170 bool init(SkImageInfo info, Benchmark* bench) override { |
| 170 uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceInde
pendentFonts_Flag : | 171 uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceInde
pendentFonts_Flag : |
| 171 0; | 172 0; |
| 172 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); | 173 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); |
| 173 this->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(this->con
fig.ctxType, | 174 this->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(this->con
fig.ctxType, |
| 174 kNone_GrG
LStandard, | |
| 175 this->con
fig.ctxOptions), | 175 this->con
fig.ctxOptions), |
| 176 SkSurface::kNo_Budgeted
, info, | 176 SkSurface::kNo_Budgeted
, info, |
| 177 this->config.samples, &
props)); | 177 this->config.samples, &
props)); |
| 178 this->gl = gGrFactory->getContextInfo(this->config.ctxType, kNone_GrGLSt
andard, | 178 this->gl = gGrFactory->getContextInfo(this->config.ctxType, |
| 179 this->config.ctxOptions)->fGLConte
xt; | 179 this->config.ctxOptions)->fGLConte
xt; |
| 180 if (!this->surface.get()) { | 180 if (!this->surface.get()) { |
| 181 return false; | 181 return false; |
| 182 } | 182 } |
| 183 if (!this->gl->fenceSyncSupport()) { | 183 if (!this->gl->fenceSyncSupport()) { |
| 184 SkDebugf("WARNING: GL context for config \"%s\" does not support fen
ce sync. " | 184 SkDebugf("WARNING: GL context for config \"%s\" does not support fen
ce sync. " |
| 185 "Timings might not be accurate.\n", this->config.name); | 185 "Timings might not be accurate.\n", this->config.name); |
| 186 } | 186 } |
| 187 return true; | 187 return true; |
| 188 } | 188 } |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 return false; | 386 return false; |
| 387 } | 387 } |
| 388 | 388 |
| 389 #if SK_SUPPORT_GPU | 389 #if SK_SUPPORT_GPU |
| 390 static bool is_gpu_config_allowed(const char* name, GrContextFactory::GLContextT
ype ctxType, | 390 static bool is_gpu_config_allowed(const char* name, GrContextFactory::GLContextT
ype ctxType, |
| 391 GrContextFactory::GLContextOptions ctxOptions, | 391 GrContextFactory::GLContextOptions ctxOptions, |
| 392 int sampleCnt) { | 392 int sampleCnt) { |
| 393 if (!is_cpu_config_allowed(name)) { | 393 if (!is_cpu_config_allowed(name)) { |
| 394 return false; | 394 return false; |
| 395 } | 395 } |
| 396 if (const GrContext* ctx = gGrFactory->get(ctxType, kNone_GrGLStandard, ctxO
ptions)) { | 396 if (const GrContext* ctx = gGrFactory->get(ctxType, ctxOptions)) { |
| 397 return sampleCnt <= ctx->caps()->maxSampleCount(); | 397 return sampleCnt <= ctx->caps()->maxSampleCount(); |
| 398 } | 398 } |
| 399 return false; | 399 return false; |
| 400 } | 400 } |
| 401 #endif | 401 #endif |
| 402 | 402 |
| 403 #if SK_SUPPORT_GPU | 403 #if SK_SUPPORT_GPU |
| 404 #define kBogusGLContextType GrContextFactory::kNative_GLContextType | 404 #define kBogusGLContextType GrContextFactory::kNative_GLContextType |
| 405 #define kBogusGLContextOptions GrContextFactory::kNone_GLContextOptions | 405 #define kBogusGLContextOptions GrContextFactory::kNone_GLContextOptions |
| 406 #else | 406 #else |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 | 442 |
| 443 if (FLAGS_gpu) { | 443 if (FLAGS_gpu) { |
| 444 GPU_CONFIG(gpu, kNative_GLContextType, kNone_GLContextOptions, 0, false) | 444 GPU_CONFIG(gpu, kNative_GLContextType, kNone_GLContextOptions, 0, false) |
| 445 GPU_CONFIG(msaa4, kNative_GLContextType, kNone_GLContextOptions, 4, fals
e) | 445 GPU_CONFIG(msaa4, kNative_GLContextType, kNone_GLContextOptions, 4, fals
e) |
| 446 GPU_CONFIG(msaa16, kNative_GLContextType, kNone_GLContextOptions, 16, fa
lse) | 446 GPU_CONFIG(msaa16, kNative_GLContextType, kNone_GLContextOptions, 16, fa
lse) |
| 447 GPU_CONFIG(nvprmsaa4, kNative_GLContextType, kEnableNVPR_GLContextOption
s, 4, false) | 447 GPU_CONFIG(nvprmsaa4, kNative_GLContextType, kEnableNVPR_GLContextOption
s, 4, false) |
| 448 GPU_CONFIG(nvprmsaa16, kNative_GLContextType, kEnableNVPR_GLContextOptio
ns, 16, false) | 448 GPU_CONFIG(nvprmsaa16, kNative_GLContextType, kEnableNVPR_GLContextOptio
ns, 16, false) |
| 449 GPU_CONFIG(gpudft, kNative_GLContextType, kNone_GLContextOptions, 0, tru
e) | 449 GPU_CONFIG(gpudft, kNative_GLContextType, kNone_GLContextOptions, 0, tru
e) |
| 450 GPU_CONFIG(debug, kDebug_GLContextType, kNone_GLContextOptions, 0, false
) | 450 GPU_CONFIG(debug, kDebug_GLContextType, kNone_GLContextOptions, 0, false
) |
| 451 GPU_CONFIG(nullgpu, kNull_GLContextType, kNone_GLContextOptions, 0, fals
e) | 451 GPU_CONFIG(nullgpu, kNull_GLContextType, kNone_GLContextOptions, 0, fals
e) |
| 452 #ifdef SK_ANGLE | 452 #if SK_ANGLE |
| 453 #ifdef SK_BUILD_FOR_WIN |
| 453 GPU_CONFIG(angle, kANGLE_GLContextType, kNone_GLContextOptions, 0, false
) | 454 GPU_CONFIG(angle, kANGLE_GLContextType, kNone_GLContextOptions, 0, false
) |
| 455 #endif |
| 454 GPU_CONFIG(angle-gl, kANGLE_GL_GLContextType, kNone_GLContextOptions, 0,
false) | 456 GPU_CONFIG(angle-gl, kANGLE_GL_GLContextType, kNone_GLContextOptions, 0,
false) |
| 455 #endif | 457 #endif |
| 456 #ifdef SK_COMMAND_BUFFER | 458 #if SK_COMMAND_BUFFER |
| 457 GPU_CONFIG(commandbuffer, kCommandBuffer_GLContextType, kNone_GLContextO
ptions, 0, false) | 459 GPU_CONFIG(commandbuffer, kCommandBuffer_GLContextType, kNone_GLContextO
ptions, 0, false) |
| 458 #endif | 460 #endif |
| 459 #if SK_MESA | 461 #if SK_MESA |
| 460 GPU_CONFIG(mesa, kMESA_GLContextType, kNone_GLContextOptions, 0, false) | 462 GPU_CONFIG(mesa, kMESA_GLContextType, kNone_GLContextOptions, 0, false) |
| 461 #endif | 463 #endif |
| 462 } | 464 } |
| 463 #endif | 465 #endif |
| 464 | 466 |
| 465 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 467 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 466 if (is_cpu_config_allowed("hwui")) { | 468 if (is_cpu_config_allowed("hwui")) { |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 , stddev_percent | 1274 , stddev_percent |
| 1273 , FLAGS_ms ? to_string(samples.count()).c_str() : stats.
plot.c_str() | 1275 , FLAGS_ms ? to_string(samples.count()).c_str() : stats.
plot.c_str() |
| 1274 , config | 1276 , config |
| 1275 , bench->getUniqueName() | 1277 , bench->getUniqueName() |
| 1276 ); | 1278 ); |
| 1277 } | 1279 } |
| 1278 | 1280 |
| 1279 #if SK_SUPPORT_GPU | 1281 #if SK_SUPPORT_GPU |
| 1280 if (FLAGS_gpuStats && Benchmark::kGPU_Backend == configs[i].backend)
{ | 1282 if (FLAGS_gpuStats && Benchmark::kGPU_Backend == configs[i].backend)
{ |
| 1281 GrContext* context = gGrFactory->get(configs[i].ctxType, | 1283 GrContext* context = gGrFactory->get(configs[i].ctxType, |
| 1282 kNone_GrGLStandard, configs
[i].ctxOptions); | 1284 configs[i].ctxOptions); |
| 1283 context->printCacheStats(); | 1285 context->printCacheStats(); |
| 1284 context->printGpuStats(); | 1286 context->printGpuStats(); |
| 1285 } | 1287 } |
| 1286 #endif | 1288 #endif |
| 1287 | 1289 |
| 1288 if (FLAGS_verbose) { | 1290 if (FLAGS_verbose) { |
| 1289 SkDebugf("Samples: "); | 1291 SkDebugf("Samples: "); |
| 1290 for (int i = 0; i < samples.count(); i++) { | 1292 for (int i = 0; i < samples.count(); i++) { |
| 1291 SkDebugf("%s ", HUMANIZE(samples[i])); | 1293 SkDebugf("%s ", HUMANIZE(samples[i])); |
| 1292 } | 1294 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1308 | 1310 |
| 1309 return 0; | 1311 return 0; |
| 1310 } | 1312 } |
| 1311 | 1313 |
| 1312 #if !defined SK_BUILD_FOR_IOS | 1314 #if !defined SK_BUILD_FOR_IOS |
| 1313 int main(int argc, char** argv) { | 1315 int main(int argc, char** argv) { |
| 1314 SkCommandLineFlags::Parse(argc, argv); | 1316 SkCommandLineFlags::Parse(argc, argv); |
| 1315 return nanobench_main(); | 1317 return nanobench_main(); |
| 1316 } | 1318 } |
| 1317 #endif | 1319 #endif |
| OLD | NEW |