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

Side by Side Diff: bench/nanobench.cpp

Issue 1528473002: Revert of 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 13 matching lines...) Expand all
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"
35 #include "SkData.h" 34 #include "SkData.h"
36 #include "SkForceLinking.h" 35 #include "SkForceLinking.h"
37 #include "SkGraphics.h" 36 #include "SkGraphics.h"
38 #include "SkOSFile.h" 37 #include "SkOSFile.h"
39 #include "SkPictureRecorder.h" 38 #include "SkPictureRecorder.h"
40 #include "SkPictureUtils.h" 39 #include "SkPictureUtils.h"
41 #include "SkString.h" 40 #include "SkString.h"
42 #include "SkSurface.h" 41 #include "SkSurface.h"
43 #include "SkTaskGroup.h" 42 #include "SkTaskGroup.h"
44 43
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // Frame lag is unknown. 164 // Frame lag is unknown.
166 *maxFrameLag = FLAGS_gpuFrameLag; 165 *maxFrameLag = FLAGS_gpuFrameLag;
167 } 166 }
168 return true; 167 return true;
169 } 168 }
170 bool init(SkImageInfo info, Benchmark* bench) override { 169 bool init(SkImageInfo info, Benchmark* bench) override {
171 uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceInde pendentFonts_Flag : 170 uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceInde pendentFonts_Flag :
172 0; 171 0;
173 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); 172 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
174 this->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(this->con fig.ctxType, 173 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, 178 this->gl = gGrFactory->getContextInfo(this->config.ctxType, kNone_GrGLSt andard,
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
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, ctxOptions)) { 396 if (const GrContext* ctx = gGrFactory->get(ctxType, kNone_GrGLStandard, ctxO ptions)) {
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
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 #if SK_ANGLE 452 #ifdef SK_ANGLE
453 #ifdef SK_BUILD_FOR_WIN
454 GPU_CONFIG(angle, kANGLE_GLContextType, kNone_GLContextOptions, 0, false ) 453 GPU_CONFIG(angle, kANGLE_GLContextType, kNone_GLContextOptions, 0, false )
455 #endif
456 GPU_CONFIG(angle-gl, kANGLE_GL_GLContextType, kNone_GLContextOptions, 0, false) 454 GPU_CONFIG(angle-gl, kANGLE_GL_GLContextType, kNone_GLContextOptions, 0, false)
457 #endif 455 #endif
458 #if SK_COMMAND_BUFFER 456 #ifdef SK_COMMAND_BUFFER
459 GPU_CONFIG(commandbuffer, kCommandBuffer_GLContextType, kNone_GLContextO ptions, 0, false) 457 GPU_CONFIG(commandbuffer, kCommandBuffer_GLContextType, kNone_GLContextO ptions, 0, false)
460 #endif 458 #endif
461 #if SK_MESA 459 #if SK_MESA
462 GPU_CONFIG(mesa, kMESA_GLContextType, kNone_GLContextOptions, 0, false) 460 GPU_CONFIG(mesa, kMESA_GLContextType, kNone_GLContextOptions, 0, false)
463 #endif 461 #endif
464 } 462 }
465 #endif 463 #endif
466 464
467 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 465 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
468 if (is_cpu_config_allowed("hwui")) { 466 if (is_cpu_config_allowed("hwui")) {
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 , stddev_percent 1272 , stddev_percent
1275 , FLAGS_ms ? to_string(samples.count()).c_str() : stats. plot.c_str() 1273 , FLAGS_ms ? to_string(samples.count()).c_str() : stats. plot.c_str()
1276 , config 1274 , config
1277 , bench->getUniqueName() 1275 , bench->getUniqueName()
1278 ); 1276 );
1279 } 1277 }
1280 1278
1281 #if SK_SUPPORT_GPU 1279 #if SK_SUPPORT_GPU
1282 if (FLAGS_gpuStats && Benchmark::kGPU_Backend == configs[i].backend) { 1280 if (FLAGS_gpuStats && Benchmark::kGPU_Backend == configs[i].backend) {
1283 GrContext* context = gGrFactory->get(configs[i].ctxType, 1281 GrContext* context = gGrFactory->get(configs[i].ctxType,
1284 configs[i].ctxOptions); 1282 kNone_GrGLStandard, configs [i].ctxOptions);
1285 context->printCacheStats(); 1283 context->printCacheStats();
1286 context->printGpuStats(); 1284 context->printGpuStats();
1287 } 1285 }
1288 #endif 1286 #endif
1289 1287
1290 if (FLAGS_verbose) { 1288 if (FLAGS_verbose) {
1291 SkDebugf("Samples: "); 1289 SkDebugf("Samples: ");
1292 for (int i = 0; i < samples.count(); i++) { 1290 for (int i = 0; i < samples.count(); i++) {
1293 SkDebugf("%s ", HUMANIZE(samples[i])); 1291 SkDebugf("%s ", HUMANIZE(samples[i]));
1294 } 1292 }
(...skipping 15 matching lines...) Expand all
1310 1308
1311 return 0; 1309 return 0;
1312 } 1310 }
1313 1311
1314 #if !defined SK_BUILD_FOR_IOS 1312 #if !defined SK_BUILD_FOR_IOS
1315 int main(int argc, char** argv) { 1313 int main(int argc, char** argv) {
1316 SkCommandLineFlags::Parse(argc, argv); 1314 SkCommandLineFlags::Parse(argc, argv);
1317 return nanobench_main(); 1315 return nanobench_main();
1318 } 1316 }
1319 #endif 1317 #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