From db84b948f90d274cbe1b104a336b0dce4a3819be Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 15 Dec 2025 12:44:17 -0500
Subject: [PATCH] egl: Default to a swap interval of 0.
This matches other platforms.
Also make sure Android explicitly sets vsync on restore, regardless of the
specific setting, to make sure it's consistent.
Fixes #14642.
---
src/video/SDL_egl.c | 2 ++
src/video/android/SDL_androidevents.c | 5 +----
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
index 72b6d590c0c55..66d3d4308d7e0 100644
--- a/src/video/SDL_egl.c
+++ b/src/video/SDL_egl.c
@@ -1144,6 +1144,8 @@ SDL_GLContext SDL_EGL_CreateContext(SDL_VideoDevice *_this, EGLSurface egl_surfa
}
}
+ SDL_GL_SetSwapInterval(0); // EGL tends to default to vsync=1. To make this consistent with the rest of SDL, we force it off at startup. Apps can explicitly enable it afterwards.
+
return (SDL_GLContext)egl_context;
}
diff --git a/src/video/android/SDL_androidevents.c b/src/video/android/SDL_androidevents.c
index d82ea18424866..0ebf4de837747 100644
--- a/src/video/android/SDL_androidevents.c
+++ b/src/video/android/SDL_androidevents.c
@@ -50,10 +50,7 @@ static void android_egl_context_restore(SDL_Window *window)
}
data->backup_done = false;
- if (data->has_swap_interval) {
- SDL_GL_SetSwapInterval(data->swap_interval);
- }
-
+ SDL_GL_SetSwapInterval(data->swap_interval);
}
}