[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 1/2] sdl2: Add gles options
From: |
Elie Tournier |
Subject: |
[Qemu-devel] [RFC 1/2] sdl2: Add gles options |
Date: |
Wed, 17 Jan 2018 14:50:28 +0000 |
This commit add an option to the sdl display: `-display sdl,gles=on`
This will allow the user to create an OpenGL ES context.
Signed-off-by: Elie Tournier <address@hidden>
---
qemu-options.hx | 5 ++++-
ui/sdl2.c | 1 +
vl.c | 11 ++++++++++-
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/qemu-options.hx b/qemu-options.hx
index 678181c599..18a616e339 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1257,7 +1257,7 @@ ETEXI
DEF("display", HAS_ARG, QEMU_OPTION_display,
"-display sdl[,frame=on|off][,alt_grab=on|off][,ctrl_grab=on|off]\n"
- " [,window_close=on|off][,gl=on|off]\n"
+ " [,window_close=on|off][,gl=on|off][,gles=on|off]\n"
"-display gtk[,grab_on_hover=on|off][,gl=on|off]|\n"
"-display vnc=<display>[,<optargs>]\n"
"-display curses\n"
@@ -1492,6 +1492,9 @@ Enable/disable spice seamless migration. Default is off.
@item gl=[on|off]
Enable/disable OpenGL context. Default is off.
address@hidden gles=[on|off]
+Enable/disable OpenGL ES context. Default is off.
+
@item rendernode=<file>
DRM render node for OpenGL rendering. If not specified, it will pick
the first available. (Since 2.9)
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 89c6a2633c..e78cff1a6f 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -762,6 +762,7 @@ void sdl_display_early_init(int opengl)
case 0: /* off */
break;
case 1: /* on */
+ case 2: /* gles = on */
#ifdef CONFIG_OPENGL
display_opengl = 1;
#endif
diff --git a/vl.c b/vl.c
index 2586f25952..3fe325222e 100644
--- a/vl.c
+++ b/vl.c
@@ -2154,6 +2154,15 @@ static DisplayType select_display(const char *p)
} else {
goto invalid_sdl_args;
}
+ } else if (strstart(opts, ",gles=", &nextopt)) {
+ opts = nextopt;
+ if (strstart(opts, "on", &nextopt)) {
+ request_opengl = 2;
+ } else if (strstart(opts, "off", &nextopt)) {
+ request_opengl = 0;
+ } else {
+ goto invalid_sdl_args;
+ }
} else if (strstart(opts, ",gl=", &nextopt)) {
opts = nextopt;
if (strstart(opts, "on", &nextopt)) {
@@ -4364,7 +4373,7 @@ int main(int argc, char **argv, char **envp)
qemu_console_early_init();
- if (request_opengl == 1 && display_opengl == 0) {
+ if ((request_opengl == 1 || request_opengl == 2) && display_opengl == 0) {
#if defined(CONFIG_OPENGL)
error_report("OpenGL is not supported by the display");
#else
--
2.15.1