From 42f33c1b0ec543eba3e564d7f96498648e283fff Mon Sep 17 00:00:00 2001 From: Phireh Date: Mon, 18 Nov 2024 16:06:15 +0100 Subject: [PATCH] Set EGL swap interval to 0 --- wayland.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wayland.c b/wayland.c index 8133c47..6e8c4ec 100644 --- a/wayland.c +++ b/wayland.c @@ -251,11 +251,19 @@ int main() wl_region_add(region, 0, 0, 480, 360); wl_surface_set_opaque_region(surface, region); + /* NOTE: It would seem that having a non-zero swap interval can hang the Mesa driver forever, according to this SDL GH issue: + https://github.com/libsdl-org/SDL/issues/4335#issuecomment-829789881 + */ + if (eglSwapInterval(egl_display, 0) != EGL_TRUE) + fprintf(stderr, "Could not set EGL swap interval\n"); + + int framecount = 0; + // Main event loop while (1) { wl_display_dispatch_pending(display); - fprintf(stdout, "Dispatching event...\n"); + fprintf(stdout, "Frame %d\n", framecount++); glClearColor(0.5, 0.3, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); glFlush();