Test: Add threaded video option to mgba-perf
Vicki Pfau vi@endrift.com
Mon, 24 Sep 2018 09:49:25 -0700
1 files changed,
15 insertions(+),
2 deletions(-)
jump to
M
src/platform/test/perf-main.c
→
src/platform/test/perf-main.c
@@ -29,11 +29,12 @@ #include <signal.h>
#include <inttypes.h> #include <sys/time.h> -#define PERF_OPTIONS "DF:L:NPS:" +#define PERF_OPTIONS "DF:L:NPS:T" #define PERF_USAGE \ "\nBenchmark options:\n" \ " -F FRAMES Run for the specified number of FRAMES before exiting\n" \ " -N Disable video rendering entirely\n" \ + " -T Use threaded video rendering\n" \ " -P CSV output, useful for parsing\n" \ " -S SEC Run for SEC in-game seconds before exiting\n" \ " -L FILE Load a savestate when starting the test\n" \@@ -41,6 +42,7 @@ " -D Act as a server"
struct PerfOpts { bool noVideo; + bool threadedVideo; bool csv; unsigned duration; unsigned frames;@@ -89,7 +91,7 @@
struct mLogger logger = { .log = _log }; mLogSetDefaultLogger(&logger); - struct PerfOpts perfOpts = { false, false, 0, 0, 0, false }; + struct PerfOpts perfOpts = { false, false, false, 0, 0, 0, false }; struct mSubParser subparser = { .usage = PERF_USAGE, .parse = _parsePerfOpts,@@ -162,6 +164,12 @@ mCoreLoadFile(core, fname);
mCoreConfigInit(&core->config, "perf"); mCoreConfigLoad(&core->config); + if (perfOpts->threadedVideo) { + mCoreConfigSetOverrideIntValue(&core->config, "threadedVideo", 1); + } else { + mCoreConfigSetOverrideIntValue(&core->config, "threadedVideo", 0); + } + struct mCoreOptions opts = {}; mCoreConfigMap(&core->config, &opts); opts.audioSync = false;@@ -200,6 +208,8 @@ char buffer[256];
const char* rendererName; if (perfOpts->noVideo) { rendererName = "none"; + } else if (perfOpts->threadedVideo) { + rendererName = "threaded-software"; } else { rendererName = "software"; }@@ -313,6 +323,9 @@ return true;
case 'S': opts->duration = strtoul(arg, 0, 10); return !errno; + case 'T': + opts->threadedVideo = true; + return true; case 'L': opts->savestate = strdup(arg); return true;