From 0b71a5d5caa4f709d37fa1d7786dffc2c94f8414 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 11 Nov 2014 16:54:45 +0100 Subject: 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 Reviewed-by: Max Reitz --- vl.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'vl.c') diff --git a/vl.c b/vl.c index 74c2681..15bccc4 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(); -- cgit v1.1