[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 15/18] ui/sdl: try to instantiate the matching opengl renderer
From: |
marcandre . lureau |
Subject: |
[PULL v2 15/18] ui/sdl: try to instantiate the matching opengl renderer |
Date: |
Tue, 14 Mar 2023 00:01:31 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
-display sdl,gl=es didn't actually use OpenGL ES.
Using OpenGL ES allows to use ANGLE, which works generally better than
Windows/OEM OpenGL driver.
(note: users can still bypass the QEMU choice with SDL_RENDER_DRIVER
environment variable)
(note: 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>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
ui/sdl2.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 221cdced60..35c58c1104 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -58,6 +58,11 @@ static Notifier mouse_mode_notifier;
#define SDL2_MAX_IDLE_COUNT (2 * GUI_REFRESH_INTERVAL_DEFAULT \
/ SDL2_REFRESH_INTERVAL_BUSY + 1)
+/* introduced in SDL 2.0.10 */
+#ifndef SDL_HINT_RENDER_BATCHING
+#define SDL_HINT_RENDER_BATCHING "SDL_RENDER_BATCHING"
+#endif
+
static void sdl_update_caption(struct sdl2_console *scon);
static struct sdl2_console *get_scon_from_window(uint32_t window_id)
@@ -99,7 +104,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
- [PULL v2 05/18] meson: ensure dbus-display generated code is built before other units, (continued)
- [PULL v2 05/18] meson: ensure dbus-display generated code is built before other units, marcandre . lureau, 2023/03/13
- [PULL v2 06/18] ui: rename cursor_{put->unref}, marcandre . lureau, 2023/03/13
- [PULL v2 07/18] ui: rename cursor_{get->ref}, return it, marcandre . lureau, 2023/03/13
- [PULL v2 08/18] ui: keep current cursor with QemuConsole, marcandre . lureau, 2023/03/13
- [PULL v2 10/18] ui: set cursor position upon listener registration, marcandre . lureau, 2023/03/13
- [PULL v2 11/18] ui/sdl: get the GL context from the window, marcandre . lureau, 2023/03/13
- [PULL v2 09/18] ui: set cursor upon listener registration, marcandre . lureau, 2023/03/13
- [PULL v2 12/18] ui/shader: fix #version directive must occur on first line, marcandre . lureau, 2023/03/13
- [PULL v2 13/18] ui/egl: print EGL error, helping debugging, marcandre . lureau, 2023/03/13
- [PULL v2 15/18] ui/sdl: try to instantiate the matching opengl renderer,
marcandre . lureau <=
- [PULL v2 14/18] ui/sdl: add QEMU_ENABLE_SDL_LOGGING setting/environment, marcandre . lureau, 2023/03/13
- [PULL v2 16/18] ui: introduce egl_init(), marcandre . lureau, 2023/03/13
- [PULL v2 17/18] ui/dbus: do not require opengl & gbm, marcandre . lureau, 2023/03/13
- [PULL v2 18/18] ui/dbus: restrict opengl to gbm-enabled config, marcandre . lureau, 2023/03/13
- Re: [PULL v2 00/18] Display patches, Peter Maydell, 2023/03/14