summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorGert Wollny <gert.wollny@collabora.com>2024-09-11 09:14:30 +0000
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-09-13 20:12:16 +0200
commitae23cd00170baaa2777eb1ee87b70f472dbb3c44 (patch)
treee09b2dddb3fa6a81cee02229ade49ea0ab54829e
parenteaea80315f8237715dd83ae7c55ad4280f66db7c (diff)
downloadfocaccia-qemu-ae23cd00170baaa2777eb1ee87b70f472dbb3c44.tar.gz
focaccia-qemu-ae23cd00170baaa2777eb1ee87b70f472dbb3c44.zip
ui/sdl2: set swap interval explicitly when OpenGL is enabled
Before 176e3783f2ab (ui/sdl2: OpenGL window context)
SDL_CreateRenderer was called unconditionally setting
the swap interval to 0. Since SDL_CreateRenderer is now no
longer called when OpenGL is enabled, the swap interval is
no longer set explicitly and vsync handling depends on
the environment settings which may lead to a performance
regression with virgl as reported in
   https://gitlab.com/qemu-project/qemu/-/issues/2565

Restore the old vsync handling by explicitly calling
SDL_GL_SetSwapInterval if OpenGL is enabled.

Fixes: 176e3783f2ab (ui/sdl2: OpenGL window context)
Closes: https://gitlab.com/qemu-project/qemu/-/issues/2565

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <01020191e05ce6df-84da6386-62c2-4ce8-840e-ad216ac253dd-000000@eu-west-1.amazonses.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-rw-r--r--ui/sdl2.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ui/sdl2.c b/ui/sdl2.c
index e4cb66c5da..bd4f5a9da1 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -115,6 +115,7 @@ void sdl2_window_create(struct sdl2_console *scon)
         SDL_SetHint(SDL_HINT_RENDER_BATCHING, "1");
 
         scon->winctx = SDL_GL_CreateContext(scon->real_window);
+        SDL_GL_SetSwapInterval(0);
     } else {
         /* The SDL renderer is only used by sdl2-2D, when OpenGL is disabled */
         scon->real_renderer = SDL_CreateRenderer(scon->real_window, -1, 0);