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 10 matching lines...) Expand all Loading... |
21 #include "RecordingBench.h" | 21 #include "RecordingBench.h" |
22 #include "SKPAnimationBench.h" | 22 #include "SKPAnimationBench.h" |
23 #include "SKPBench.h" | 23 #include "SKPBench.h" |
24 #include "Stats.h" | 24 #include "Stats.h" |
25 | 25 |
26 #include "SkBitmapRegionDecoder.h" | 26 #include "SkBitmapRegionDecoder.h" |
27 #include "SkBBoxHierarchy.h" | 27 #include "SkBBoxHierarchy.h" |
28 #include "SkCanvas.h" | 28 #include "SkCanvas.h" |
29 #include "SkCodec.h" | 29 #include "SkCodec.h" |
30 #include "SkCommonFlags.h" | 30 #include "SkCommonFlags.h" |
31 #include "SkCommonFlagsConfig.h" | |
32 #include "SkData.h" | 31 #include "SkData.h" |
33 #include "SkForceLinking.h" | 32 #include "SkForceLinking.h" |
34 #include "SkGraphics.h" | 33 #include "SkGraphics.h" |
35 #include "SkOSFile.h" | 34 #include "SkOSFile.h" |
36 #include "SkPictureRecorder.h" | 35 #include "SkPictureRecorder.h" |
37 #include "SkPictureUtils.h" | 36 #include "SkPictureUtils.h" |
38 #include "SkString.h" | 37 #include "SkString.h" |
39 #include "SkSurface.h" | 38 #include "SkSurface.h" |
40 #include "SkTaskGroup.h" | 39 #include "SkTaskGroup.h" |
41 | 40 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // Frame lag is unknown. | 161 // Frame lag is unknown. |
163 *maxFrameLag = FLAGS_gpuFrameLag; | 162 *maxFrameLag = FLAGS_gpuFrameLag; |
164 } | 163 } |
165 return true; | 164 return true; |
166 } | 165 } |
167 bool init(SkImageInfo info, Benchmark* bench) override { | 166 bool init(SkImageInfo info, Benchmark* bench) override { |
168 uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceInde
pendentFonts_Flag : | 167 uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceInde
pendentFonts_Flag : |
169 0; | 168 0; |
170 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); | 169 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); |
171 this->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(this->con
fig.ctxType, | 170 this->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(this->con
fig.ctxType, |
| 171 kNone_GrG
LStandard, |
172 this->con
fig.ctxOptions), | 172 this->con
fig.ctxOptions), |
173 SkSurface::kNo_Budgeted
, info, | 173 SkSurface::kNo_Budgeted
, info, |
174 this->config.samples, &
props)); | 174 this->config.samples, &
props)); |
175 this->gl = gGrFactory->getContextInfo(this->config.ctxType, | 175 this->gl = gGrFactory->getContextInfo(this->config.ctxType, kNone_GrGLSt
andard, |
176 this->config.ctxOptions)->fGLConte
xt; | 176 this->config.ctxOptions)->fGLConte
xt; |
177 if (!this->surface.get()) { | 177 if (!this->surface.get()) { |
178 return false; | 178 return false; |
179 } | 179 } |
180 if (!this->gl->fenceSyncSupport()) { | 180 if (!this->gl->fenceSyncSupport()) { |
181 SkDebugf("WARNING: GL context for config \"%s\" does not support fen
ce sync. " | 181 SkDebugf("WARNING: GL context for config \"%s\" does not support fen
ce sync. " |
182 "Timings might not be accurate.\n", this->config.name); | 182 "Timings might not be accurate.\n", this->config.name); |
183 } | 183 } |
184 return true; | 184 return true; |
185 } | 185 } |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 return false; | 383 return false; |
384 } | 384 } |
385 | 385 |
386 #if SK_SUPPORT_GPU | 386 #if SK_SUPPORT_GPU |
387 static bool is_gpu_config_allowed(const char* name, GrContextFactory::GLContextT
ype ctxType, | 387 static bool is_gpu_config_allowed(const char* name, GrContextFactory::GLContextT
ype ctxType, |
388 GrContextFactory::GLContextOptions ctxOptions, | 388 GrContextFactory::GLContextOptions ctxOptions, |
389 int sampleCnt) { | 389 int sampleCnt) { |
390 if (!is_cpu_config_allowed(name)) { | 390 if (!is_cpu_config_allowed(name)) { |
391 return false; | 391 return false; |
392 } | 392 } |
393 if (const GrContext* ctx = gGrFactory->get(ctxType, ctxOptions)) { | 393 if (const GrContext* ctx = gGrFactory->get(ctxType, kNone_GrGLStandard, ctxO
ptions)) { |
394 return sampleCnt <= ctx->caps()->maxSampleCount(); | 394 return sampleCnt <= ctx->caps()->maxSampleCount(); |
395 } | 395 } |
396 return false; | 396 return false; |
397 } | 397 } |
398 #endif | 398 #endif |
399 | 399 |
400 #if SK_SUPPORT_GPU | 400 #if SK_SUPPORT_GPU |
401 #define kBogusGLContextType GrContextFactory::kNative_GLContextType | 401 #define kBogusGLContextType GrContextFactory::kNative_GLContextType |
402 #define kBogusGLContextOptions GrContextFactory::kNone_GLContextOptions | 402 #define kBogusGLContextOptions GrContextFactory::kNone_GLContextOptions |
403 #else | 403 #else |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 | 439 |
440 if (FLAGS_gpu) { | 440 if (FLAGS_gpu) { |
441 GPU_CONFIG(gpu, kNative_GLContextType, kNone_GLContextOptions, 0, false) | 441 GPU_CONFIG(gpu, kNative_GLContextType, kNone_GLContextOptions, 0, false) |
442 GPU_CONFIG(msaa4, kNative_GLContextType, kNone_GLContextOptions, 4, fals
e) | 442 GPU_CONFIG(msaa4, kNative_GLContextType, kNone_GLContextOptions, 4, fals
e) |
443 GPU_CONFIG(msaa16, kNative_GLContextType, kNone_GLContextOptions, 16, fa
lse) | 443 GPU_CONFIG(msaa16, kNative_GLContextType, kNone_GLContextOptions, 16, fa
lse) |
444 GPU_CONFIG(nvprmsaa4, kNative_GLContextType, kEnableNVPR_GLContextOption
s, 4, false) | 444 GPU_CONFIG(nvprmsaa4, kNative_GLContextType, kEnableNVPR_GLContextOption
s, 4, false) |
445 GPU_CONFIG(nvprmsaa16, kNative_GLContextType, kEnableNVPR_GLContextOptio
ns, 16, false) | 445 GPU_CONFIG(nvprmsaa16, kNative_GLContextType, kEnableNVPR_GLContextOptio
ns, 16, false) |
446 GPU_CONFIG(gpudft, kNative_GLContextType, kNone_GLContextOptions, 0, tru
e) | 446 GPU_CONFIG(gpudft, kNative_GLContextType, kNone_GLContextOptions, 0, tru
e) |
447 GPU_CONFIG(debug, kDebug_GLContextType, kNone_GLContextOptions, 0, false
) | 447 GPU_CONFIG(debug, kDebug_GLContextType, kNone_GLContextOptions, 0, false
) |
448 GPU_CONFIG(nullgpu, kNull_GLContextType, kNone_GLContextOptions, 0, fals
e) | 448 GPU_CONFIG(nullgpu, kNull_GLContextType, kNone_GLContextOptions, 0, fals
e) |
449 #if SK_ANGLE | 449 #ifdef SK_ANGLE |
450 #ifdef SK_BUILD_FOR_WIN | |
451 GPU_CONFIG(angle, kANGLE_GLContextType, kNone_GLContextOptions, 0, false
) | 450 GPU_CONFIG(angle, kANGLE_GLContextType, kNone_GLContextOptions, 0, false
) |
452 #endif | |
453 GPU_CONFIG(angle-gl, kANGLE_GL_GLContextType, kNone_GLContextOptions, 0,
false) | 451 GPU_CONFIG(angle-gl, kANGLE_GL_GLContextType, kNone_GLContextOptions, 0,
false) |
454 #endif | 452 #endif |
455 #if SK_COMMAND_BUFFER | 453 #ifdef SK_COMMAND_BUFFER |
456 GPU_CONFIG(commandbuffer, kCommandBuffer_GLContextType, kNone_GLContextO
ptions, 0, false) | 454 GPU_CONFIG(commandbuffer, kCommandBuffer_GLContextType, kNone_GLContextO
ptions, 0, false) |
457 #endif | 455 #endif |
458 #if SK_MESA | 456 #if SK_MESA |
459 GPU_CONFIG(mesa, kMESA_GLContextType, kNone_GLContextOptions, 0, false) | 457 GPU_CONFIG(mesa, kMESA_GLContextType, kNone_GLContextOptions, 0, false) |
460 #endif | 458 #endif |
461 } | 459 } |
462 #endif | 460 #endif |
463 | 461 |
464 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 462 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
465 if (is_cpu_config_allowed("hwui")) { | 463 if (is_cpu_config_allowed("hwui")) { |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 , stddev_percent | 1159 , stddev_percent |
1162 , FLAGS_ms ? to_string(samples.count()).c_str() : stats.
plot.c_str() | 1160 , FLAGS_ms ? to_string(samples.count()).c_str() : stats.
plot.c_str() |
1163 , config | 1161 , config |
1164 , bench->getUniqueName() | 1162 , bench->getUniqueName() |
1165 ); | 1163 ); |
1166 } | 1164 } |
1167 | 1165 |
1168 #if SK_SUPPORT_GPU | 1166 #if SK_SUPPORT_GPU |
1169 if (FLAGS_gpuStats && Benchmark::kGPU_Backend == configs[i].backend)
{ | 1167 if (FLAGS_gpuStats && Benchmark::kGPU_Backend == configs[i].backend)
{ |
1170 GrContext* context = gGrFactory->get(configs[i].ctxType, | 1168 GrContext* context = gGrFactory->get(configs[i].ctxType, |
1171 configs[i].ctxOptions); | 1169 kNone_GrGLStandard, configs
[i].ctxOptions); |
1172 context->printCacheStats(); | 1170 context->printCacheStats(); |
1173 context->printGpuStats(); | 1171 context->printGpuStats(); |
1174 } | 1172 } |
1175 #endif | 1173 #endif |
1176 | 1174 |
1177 if (FLAGS_verbose) { | 1175 if (FLAGS_verbose) { |
1178 SkDebugf("Samples: "); | 1176 SkDebugf("Samples: "); |
1179 for (int i = 0; i < samples.count(); i++) { | 1177 for (int i = 0; i < samples.count(); i++) { |
1180 SkDebugf("%s ", HUMANIZE(samples[i])); | 1178 SkDebugf("%s ", HUMANIZE(samples[i])); |
1181 } | 1179 } |
(...skipping 15 matching lines...) Expand all Loading... |
1197 | 1195 |
1198 return 0; | 1196 return 0; |
1199 } | 1197 } |
1200 | 1198 |
1201 #if !defined SK_BUILD_FOR_IOS | 1199 #if !defined SK_BUILD_FOR_IOS |
1202 int main(int argc, char** argv) { | 1200 int main(int argc, char** argv) { |
1203 SkCommandLineFlags::Parse(argc, argv); | 1201 SkCommandLineFlags::Parse(argc, argv); |
1204 return nanobench_main(); | 1202 return nanobench_main(); |
1205 } | 1203 } |
1206 #endif | 1204 #endif |
OLD | NEW |