[client] main: only render if there is actually something to render

This commit is contained in:
Geoffrey McRae 2021-08-01 17:38:09 +10:00
parent 77b3d45e0e
commit 17687fdea3
2 changed files with 6 additions and 20 deletions

View file

@ -167,8 +167,12 @@ static int renderThread(void * unused)
while(g_state.state != APP_STATE_SHUTDOWN)
{
if (g_state.jitRender || (g_state.ds->waitFrame && g_state.overlayInput))
if (g_state.jitRender)
{
g_state.ds->waitFrame();
if (!lgResetEvent(g_state.frameEvent) && !g_state.overlayInput)
continue;
}
else if (g_params.fpsMin != 0)
{
float ups = atomic_load_explicit(&g_state.ups, memory_order_relaxed);
@ -973,23 +977,14 @@ static int lg_run(void)
}
// setup the new frame event
if (!(g_state.frameEvent = lgCreateEvent(true, 0)))
if (!(g_state.frameEvent = lgCreateEvent(!g_state.jitRender, 0)))
{
DEBUG_ERROR("failed to create the frame event");
return -1;
}
if (!(g_state.jitEvent = lgCreateEvent(true, 0)))
{
DEBUG_ERROR("failed to create the overlay render event");
return -1;
}
if (g_state.jitRender)
{
DEBUG_INFO("Using JIT render mode");
lgSignalEvent(g_state.jitEvent);
}
lgInit();
@ -1142,8 +1137,6 @@ restart:
goto restart;
}
lgSignalEvent(g_state.jitEvent);
return 0;
}
@ -1172,12 +1165,6 @@ static void lg_shutdown(void)
g_state.frameEvent = NULL;
}
if (g_state.jitEvent)
{
lgFreeEvent(g_state.jitEvent);
g_state.jitEvent = NULL;
}
if (e_startup)
{
lgFreeEvent(e_startup);

View file

@ -65,7 +65,6 @@ struct AppState
struct LG_DisplayServerOps * ds;
bool dsInitialized;
bool jitRender;
LGEvent * jitEvent;
bool stopVideo;
bool ignoreInput;