[2/2] libxl_dm: honor opengl flag for SDL
diff mbox series

Message ID 1554406611-11262-2-git-send-email-cjp256@gmail.com
State New, archived
Headers show
Series
  • [1/2] libxl: Add virtio vga interface support for qemu
Related show

Commit Message

Chris Patterson April 4, 2019, 7:36 p.m. UTC
From: Chris Patterson <pattersonc@ainfosec.com>

It was honored in libxl__build_device_model_args_old(), but did not
transition to libxl__build_device_model_args_new().

The opengl flag is useful for SDL to toggle virgl when using virtio-vga.

To accomplish this, we also switch from the short-hand "-sdl" notation to
"-display sdl", which should be fine compatibility-wise as "-display sdl"
is used as far back as qemu 0.15 [1].

"-display sdl,gl=on" is supported as far back as qemu 2.7 [2].

[1] https://github.com/qemu/qemu/blob/stable-0.15/qemu-options.hx#L617
[2] https://github.com/qemu/qemu/blob/stable-2.7/qemu-options.hx#L929

Signed-off-by: Chris Patterson <pattersonc@ainfosec.com>
---
 docs/man/xl.cfg.5.pod.in | 3 +--
 tools/libxl/libxl_dm.c   | 5 ++++-
 2 files changed, 5 insertions(+), 3 deletions(-)

Patch
diff mbox series

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 0d4fd49..a2d3988 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -2297,8 +2297,7 @@  Simple DirectMedia Layer). The default is (0) not enabled.
 
 =item B<opengl=BOOLEAN>
 
-Enable OpenGL acceleration of the SDL display. Only effects machines
-using B<device_model_version="qemu-xen-traditional"> and only if the
+Enable OpenGL acceleration of the SDL display.  Only works if the
 device-model was compiled with OpenGL support. Default is (0) false.
 
 =item B<nographic=BOOLEAN>
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 2aaa359..5928214 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -1307,7 +1307,10 @@  static int libxl__build_device_model_args_new(libxl__gc *gc,
     flexarray_append_pair(dm_args, "-display", "none");
 
     if (sdl) {
-        flexarray_append(dm_args, "-sdl");
+        flexarray_append_pair(dm_args, "-display", GCSPRINTF("sdl%s",
+                              libxl_defbool_val(sdl->opengl) ?
+                              ",gl=on" : ""));
+
         if (sdl->display)
             flexarray_append_pair(dm_envs, "DISPLAY", sdl->display);
         if (sdl->xauthority)