aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2014-11-11 16:54:45 +0100
committerGerd Hoffmann <kraxel@redhat.com>2015-05-05 10:48:26 +0200
commit0b71a5d5caa4f709d37fa1d7786dffc2c94f8414 (patch)
treedb4697889cfdac1fae3cf5a42055cb21cd08aa72 /vl.c
parent19dadfccd0124804e2790e7cb075c9df7cd3154f (diff)
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>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index 74c2681641..15bccc49a2 100644
--- a/vl.c
+++ b/vl.c
@@ -130,6 +130,7 @@ static int data_dir_idx;
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 @@ static DisplayType select_display(const char *p)
} 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 @@ int main(int argc, char **argv, char **envp)
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();