aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneonloop2022-03-25 21:34:32 +0000
committerneonloop2022-03-25 21:34:32 +0000
commitcaa956d120b34e4c0deadb9e61af509a88debd09 (patch)
tree4024e22427ecca2981e18fb557f2fa48a8656bf0
parentf6c4dec60e6e2c39c4c696ccff6eeda075378d31 (diff)
downloadpicoarch-caa956d120b34e4c0deadb9e61af509a88debd09.tar.gz
picoarch-caa956d120b34e4c0deadb9e61af509a88debd09.tar.bz2
picoarch-caa956d120b34e4c0deadb9e61af509a88debd09.zip
Skips main loop fb flip when screen is skipped
If core hasn't updated screen, no need to flip. Can save vsync delay, makes ff faster
-rw-r--r--plat_sdl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/plat_sdl.c b/plat_sdl.c
index 5d996b3..0beb924 100644
--- a/plat_sdl.c
+++ b/plat_sdl.c
@@ -29,6 +29,8 @@ static char msg[HUD_LEN];
static unsigned msg_priority = 0;
static unsigned msg_expire = 0;
+static bool frame_dirty = false;
+
static void video_expire_msg(void)
{
msg[0] = '\0';
@@ -209,6 +211,7 @@ void plat_video_set_msg(const char *new_msg, unsigned priority, unsigned msec)
void plat_video_process(const void *data, unsigned width, unsigned height, size_t pitch) {
static int had_msg = 0;
+ frame_dirty = true;
SDL_LockSurface(screen);
if (had_msg) {
@@ -230,7 +233,10 @@ void plat_video_process(const void *data, unsigned width, unsigned height, size_
void plat_video_flip(void)
{
- fb_flip();
+ if (frame_dirty)
+ fb_flip();
+
+ frame_dirty = false;
}
void plat_video_close(void)