[client] app: allow selective full invalidation

Overlays only need to trigger a new frame if they have changed and not
full window invalidation, this change allows for this.
This commit is contained in:
Geoffrey McRae 2021-08-05 06:47:36 +10:00
parent 6c84c0eca6
commit 6e7f39edee
8 changed files with 13 additions and 12 deletions

View file

@ -123,7 +123,7 @@ void waylandEGLSwapBuffers(EGLDisplay display, EGLSurface surface, const struct
app_handleResizeEvent(wlWm.width, wlWm.height, wl_fixed_to_double(wlWm.scale), app_handleResizeEvent(wlWm.width, wlWm.height, wl_fixed_to_double(wlWm.scale),
(struct Border) {0, 0, 0, 0}); (struct Border) {0, 0, 0, 0});
app_invalidateWindow(); app_invalidateWindow(true);
waylandStopWaitFrame(); waylandStopWaitFrame();
wlWm.needsResize = false; wlWm.needsResize = false;
} }

View file

@ -46,7 +46,7 @@ static void xdgSurfaceConfigure(void * data, struct xdg_surface * xdgSurface,
{ {
wlWm.needsResize = true; wlWm.needsResize = true;
wlWm.resizeSerial = serial; wlWm.resizeSerial = serial;
app_invalidateWindow(); app_invalidateWindow(true);
waylandStopWaitFrame(); waylandStopWaitFrame();
} }
else else

View file

@ -48,7 +48,7 @@ void waylandWindowUpdateScale(void)
wlWm.scale = maxScale; wlWm.scale = maxScale;
wlWm.fractionalScale = wl_fixed_from_int(wl_fixed_to_int(maxScale)) != maxScale; wlWm.fractionalScale = wl_fixed_from_int(wl_fixed_to_int(maxScale)) != maxScale;
wlWm.needsResize = true; wlWm.needsResize = true;
app_invalidateWindow(); app_invalidateWindow(true);
waylandStopWaitFrame(); waylandStopWaitFrame();
} }
} }

View file

@ -708,7 +708,7 @@ static int x11EventThread(void * unused)
case Expose: case Expose:
{ {
app_invalidateWindow(); app_invalidateWindow(true);
break; break;
} }

View file

@ -46,7 +46,7 @@ bool app_isFormatValid(void);
void app_updateCursorPos(double x, double y); void app_updateCursorPos(double x, double y);
void app_updateWindowPos(int x, int y); void app_updateWindowPos(int x, int y);
void app_handleResizeEvent(int w, int h, double scale, const struct Border border); void app_handleResizeEvent(int w, int h, double scale, const struct Border border);
void app_invalidateWindow(void); void app_invalidateWindow(bool full);
void app_handleMouseRelative(double normx, double normy, void app_handleMouseRelative(double normx, double normy,
double rawx, double rawy); double rawx, double rawy);

View file

@ -495,8 +495,9 @@ void app_handleResizeEvent(int w, int h, double scale, const struct Border borde
} }
} }
void app_invalidateWindow(void) void app_invalidateWindow(bool full)
{ {
if (full)
atomic_store(&g_state.invalidateWindow, true); atomic_store(&g_state.invalidateWindow, true);
lgSignalEvent(g_state.frameEvent); lgSignalEvent(g_state.frameEvent);
} }
@ -537,7 +538,7 @@ void app_handleRenderEvent(const uint64_t timeUs)
} }
if (invalidate) if (invalidate)
app_invalidateWindow(); app_invalidateWindow(false);
} }
void app_setFullscreen(bool fs) void app_setFullscreen(bool fs)
@ -616,7 +617,7 @@ void app_alert(LG_MsgAlert type, const char * fmt, ...)
g_state.alertTimeout = microtime() + ALERT_TIMEOUT; g_state.alertTimeout = microtime() + ALERT_TIMEOUT;
g_state.alertType = type; g_state.alertType = type;
g_state.alertShow = true; g_state.alertShow = true;
app_invalidateWindow(); app_invalidateWindow(false);
} }
KeybindHandle app_registerKeybind(int sc, KeybindFn callback, void * opaque, const char * description) KeybindHandle app_registerKeybind(int sc, KeybindFn callback, void * opaque, const char * description)
@ -875,7 +876,7 @@ void app_setOverlay(bool enable)
g_state.io->ConfigFlags |= ImGuiConfigFlags_NoMouse; g_state.io->ConfigFlags |= ImGuiConfigFlags_NoMouse;
core_resetOverlayInputState(); core_resetOverlayInputState();
core_setGrabQuiet(wasGrabbed); core_setGrabQuiet(wasGrabbed);
app_invalidateWindow(); app_invalidateWindow(false);
} }
} }

View file

@ -31,7 +31,7 @@ static bool showFPS;
static void showFPSKeybind(int sc, void * opaque) static void showFPSKeybind(int sc, void * opaque)
{ {
showFPS ^= true; showFPS ^= true;
app_invalidateWindow(); app_invalidateWindow(false);
} }
static void fps_earlyInit(void) static void fps_earlyInit(void)

View file

@ -65,7 +65,7 @@ static void configCallback(void * udata)
static void showTimingKeybind(int sc, void * opaque) static void showTimingKeybind(int sc, void * opaque)
{ {
gs.show ^= true; gs.show ^= true;
app_invalidateWindow(); app_invalidateWindow(false);
} }
static bool graphs_init(void ** udata, const void * params) static bool graphs_init(void ** udata, const void * params)