[client] tighten timings

This commit is contained in:
Geoffrey McRae 2018-10-04 00:09:00 +10:00
parent 8f0a6cd810
commit 1d6dfa048e

View file

@ -234,7 +234,7 @@ int cursorThread(void * unused)
if (!state.running) if (!state.running)
return 0; return 0;
usleep(1000); usleep(1);
continue; continue;
} }
@ -323,9 +323,7 @@ int frameThread(void * unused)
if (!state.running) if (!state.running)
break; break;
// allow for a maximum refresh of 400fps (1000/400 = 2.5ms), this should usleep(1);
// befreqent enough without chewing up too much CPU time
usleep(2500);
continue; continue;
} }
@ -404,6 +402,13 @@ int frameThread(void * unused)
updatePositionInfo(); updatePositionInfo();
} }
/*
uint64_t now = microtime();
static uint64_t last;
DEBUG_INFO("D: %f", (now - last) / 1000.0f);
last = microtime();
*/
const uint8_t * data = (const uint8_t *)state.shm + header.dataPos; const uint8_t * data = (const uint8_t *)state.shm + header.dataPos;
if (!state.lgr->on_frame_event(state.lgrData, lgrFormat, data)) if (!state.lgr->on_frame_event(state.lgrData, lgrFormat, data))
{ {
@ -865,6 +870,9 @@ int run()
if (params.allowScreensaver) if (params.allowScreensaver)
SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1"); SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1");
if (!params.center)
SDL_SetWindowPosition(state.window, params.x, params.y);
// set the compositor hint to bypass for low latency // set the compositor hint to bypass for low latency
SDL_SysWMinfo wminfo; SDL_SysWMinfo wminfo;
SDL_VERSION(&wminfo.version); SDL_VERSION(&wminfo.version);