qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 15/18] ui/sdl: try to instantiate the matching opengl renderer


From: marcandre . lureau
Subject: [PATCH v2 15/18] ui/sdl: try to instantiate the matching opengl renderer
Date: Tue, 7 Mar 2023 15:56:34 +0400

From: Marc-André Lureau <marcandre.lureau@redhat.com>

User can still bypass the QEMU choice with SDL_RENDER_DRIVER environment
variable. (for some reason, specifying a driver disables batching and
breaks rendering, so enable it explicitly)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/sdl2.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/ui/sdl2.c b/ui/sdl2.c
index 592eca3e1c..e83ea53628 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -99,7 +99,18 @@ void sdl2_window_create(struct sdl2_console *scon)
                                          surface_width(scon->surface),
                                          surface_height(scon->surface),
                                          flags);
+    if (scon->opengl) {
+        const char *driver = "opengl";
+
+        if (scon->opts->gl == DISPLAYGL_MODE_ES) {
+            driver = "opengles2";
+        }
+
+        SDL_SetHint(SDL_HINT_RENDER_DRIVER, driver);
+        SDL_SetHint(SDL_HINT_RENDER_BATCHING, "1");
+    }
     scon->real_renderer = SDL_CreateRenderer(scon->real_window, -1, 0);
+
     if (scon->opengl) {
         scon->winctx = SDL_GL_CreateContext(scon->real_window);
     }
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]