Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: bench/nanobench.cpp

Issue 1490113005: Add config options to run different GPU APIs to dm and nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@commandbuffer-as-api-03-context-factory-glcontext-type
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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"
31 #include "SkData.h" 32 #include "SkData.h"
32 #include "SkForceLinking.h" 33 #include "SkForceLinking.h"
33 #include "SkGraphics.h" 34 #include "SkGraphics.h"
34 #include "SkOSFile.h" 35 #include "SkOSFile.h"
35 #include "SkPictureRecorder.h" 36 #include "SkPictureRecorder.h"
36 #include "SkPictureUtils.h" 37 #include "SkPictureUtils.h"
37 #include "SkString.h" 38 #include "SkString.h"
38 #include "SkSurface.h" 39 #include "SkSurface.h"
39 #include "SkTaskGroup.h" 40 #include "SkTaskGroup.h"
40 41
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Frame lag is unknown. 162 // Frame lag is unknown.
162 *maxFrameLag = FLAGS_gpuFrameLag; 163 *maxFrameLag = FLAGS_gpuFrameLag;
163 } 164 }
164 return true; 165 return true;
165 } 166 }
166 bool init(SkImageInfo info, Benchmark* bench) override { 167 bool init(SkImageInfo info, Benchmark* bench) override {
167 uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceInde pendentFonts_Flag : 168 uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceInde pendentFonts_Flag :
168 0; 169 0;
169 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); 170 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
170 this->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(this->con fig.ctxType, 171 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, kNone_GrGLSt andard, 175 this->gl = gGrFactory->getContextInfo(this->config.ctxType,
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
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, kNone_GrGLStandard, ctxO ptions)) { 393 if (const GrContext* ctx = gGrFactory->get(ctxType, ctxOptions)) {
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
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 #ifdef SK_ANGLE 449 #if SK_ANGLE
450 #ifdef SK_BUILD_FOR_WIN
450 GPU_CONFIG(angle, kANGLE_GLContextType, kNone_GLContextOptions, 0, false ) 451 GPU_CONFIG(angle, kANGLE_GLContextType, kNone_GLContextOptions, 0, false )
452 #endif
451 GPU_CONFIG(angle-gl, kANGLE_GL_GLContextType, kNone_GLContextOptions, 0, false) 453 GPU_CONFIG(angle-gl, kANGLE_GL_GLContextType, kNone_GLContextOptions, 0, false)
452 #endif 454 #endif
453 #ifdef SK_COMMAND_BUFFER 455 #if SK_COMMAND_BUFFER
454 GPU_CONFIG(commandbuffer, kCommandBuffer_GLContextType, kNone_GLContextO ptions, 0, false) 456 GPU_CONFIG(commandbuffer, kCommandBuffer_GLContextType, kNone_GLContextO ptions, 0, false)
455 #endif 457 #endif
456 #if SK_MESA 458 #if SK_MESA
457 GPU_CONFIG(mesa, kMESA_GLContextType, kNone_GLContextOptions, 0, false) 459 GPU_CONFIG(mesa, kMESA_GLContextType, kNone_GLContextOptions, 0, false)
458 #endif 460 #endif
459 } 461 }
460 #endif 462 #endif
461 463
462 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 464 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
463 if (is_cpu_config_allowed("hwui")) { 465 if (is_cpu_config_allowed("hwui")) {
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 , stddev_percent 1161 , stddev_percent
1160 , FLAGS_ms ? to_string(samples.count()).c_str() : stats. plot.c_str() 1162 , FLAGS_ms ? to_string(samples.count()).c_str() : stats. plot.c_str()
1161 , config 1163 , config
1162 , bench->getUniqueName() 1164 , bench->getUniqueName()
1163 ); 1165 );
1164 } 1166 }
1165 1167
1166 #if SK_SUPPORT_GPU 1168 #if SK_SUPPORT_GPU
1167 if (FLAGS_gpuStats && Benchmark::kGPU_Backend == configs[i].backend) { 1169 if (FLAGS_gpuStats && Benchmark::kGPU_Backend == configs[i].backend) {
1168 GrContext* context = gGrFactory->get(configs[i].ctxType, 1170 GrContext* context = gGrFactory->get(configs[i].ctxType,
1169 kNone_GrGLStandard, configs [i].ctxOptions); 1171 configs[i].ctxOptions);
1170 context->printCacheStats(); 1172 context->printCacheStats();
1171 context->printGpuStats(); 1173 context->printGpuStats();
1172 } 1174 }
1173 #endif 1175 #endif
1174 1176
1175 if (FLAGS_verbose) { 1177 if (FLAGS_verbose) {
1176 SkDebugf("Samples: "); 1178 SkDebugf("Samples: ");
1177 for (int i = 0; i < samples.count(); i++) { 1179 for (int i = 0; i < samples.count(); i++) {
1178 SkDebugf("%s ", HUMANIZE(samples[i])); 1180 SkDebugf("%s ", HUMANIZE(samples[i]));
1179 } 1181 }
(...skipping 15 matching lines...) Expand all
1195 1197
1196 return 0; 1198 return 0;
1197 } 1199 }
1198 1200
1199 #if !defined SK_BUILD_FOR_IOS 1201 #if !defined SK_BUILD_FOR_IOS
1200 int main(int argc, char** argv) { 1202 int main(int argc, char** argv) {
1201 SkCommandLineFlags::Parse(argc, argv); 1203 SkCommandLineFlags::Parse(argc, argv);
1202 return nanobench_main(); 1204 return nanobench_main();
1203 } 1205 }
1204 #endif 1206 #endif
OLDNEW
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698