[client] don't calculate FPS if we are not showing it

This commit is contained in:
Geoffrey McRae 2018-12-13 01:28:00 +11:00
parent 49bd091359
commit 692d48df87

View File

@ -67,7 +67,6 @@ struct AppState
int shmFD;
struct KVMFRHeader * shm;
unsigned int shmSize;
int64_t fpsSleep;
uint64_t lastFrameTime;
uint64_t renderTime;
@ -204,6 +203,8 @@ int renderThread(void * unused)
if (!state.lgr->render(state.lgrData, state.window))
break;
if (params.showFPS)
{
const uint64_t t = nanotime();
state.renderTime += t - state.lastFrameTime;
state.lastFrameTime = t;
@ -219,6 +220,7 @@ int renderThread(void * unused)
state.frameCount = 0;
state.renderCount = 0;
}
}
uint64_t nsec = time.tv_nsec + (1e9 / params.fpsLimit);
if (nsec > 1e9)
@ -758,7 +760,6 @@ int run()
state.running = true;
state.scaleX = 1.0f;
state.scaleY = 1.0f;
state.fpsSleep = 1000000 / params.fpsLimit;
char* XDG_SESSION_TYPE = getenv("XDG_SESSION_TYPE");