From 482a27bc00c043ada39983e23efdc067cfe39a93 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 30 Jan 2024 17:12:20 -0500 Subject: [PATCH] wayland: Throttle to 20hz if the frame callback never fires Matches SDL2, and should be enough to keep most games from desyncing/timing out. A proper fix for FIFO presentation without the frame callback mess is being worked on upstream, so this whole hack should be rendered obsolete in the near future. --- src/video/wayland/SDL_waylandopengles.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/wayland/SDL_waylandopengles.c b/src/video/wayland/SDL_waylandopengles.c index 2b83fc3bf8..c5a3f9dd0a 100644 --- a/src/video/wayland/SDL_waylandopengles.c +++ b/src/video/wayland/SDL_waylandopengles.c @@ -124,8 +124,8 @@ int Wayland_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window) if (swap_interval != 0 && data->surface_status == WAYLAND_SURFACE_STATUS_SHOWN) { SDL_VideoData *videodata = _this->driverdata; struct wl_display *display = videodata->display; - /* 1 sec, so we'll progress even if throttled to zero. */ - const Uint64 max_wait = SDL_GetTicksNS() + SDL_NS_PER_SECOND; + /* 20hz, so we'll progress even if throttled to zero. */ + const Uint64 max_wait = SDL_GetTicksNS() + (SDL_NS_PER_SECOND / 20); while (SDL_AtomicGet(&data->swap_interval_ready) == 0) { Uint64 now;