sdl2: add support for display rendering using opengl.
Add new sdl2-gl.c file, with display
rendering functions using opengl.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
diff --git a/vl.c b/vl.c
index 74c2681..15bccc4 100644
--- a/vl.c
+++ b/vl.c
@@ -130,6 +130,7 @@
const char *bios_name = NULL;
enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
DisplayType display_type = DT_DEFAULT;
+int request_opengl = -1;
int display_opengl;
static int display_remote;
const char* keyboard_layout = NULL;
@@ -1990,6 +1991,15 @@
} else {
goto invalid_sdl_args;
}
+ } else if (strstart(opts, ",gl=", &nextopt)) {
+ opts = nextopt;
+ if (strstart(opts, "on", &nextopt)) {
+ request_opengl = 1;
+ } else if (strstart(opts, "off", &nextopt)) {
+ request_opengl = 0;
+ } else {
+ goto invalid_sdl_args;
+ }
} else {
invalid_sdl_args:
fprintf(stderr, "Invalid SDL option string: %s\n", p);
@@ -4005,6 +4015,19 @@
early_gtk_display_init();
}
#endif
+#if defined(CONFIG_SDL)
+ if (display_type == DT_SDL) {
+ sdl_display_early_init(request_opengl);
+ }
+#endif
+ if (request_opengl == 1 && display_opengl == 0) {
+#if defined(CONFIG_OPENGL)
+ fprintf(stderr, "OpenGL is not supported by the display.\n");
+#else
+ fprintf(stderr, "QEMU was built without opengl support.\n");
+#endif
+ exit(1);
+ }
socket_init();