From: Marc-André Lureau <[email protected]>

With -display spice-app, the value of the gl option is ignored: gl=off
enables OpenGL exactly like gl=on. Only omitting the option keeps OpenGL
disabled.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4639
Fixes: d8aec9d9f129 ("display: add -display spice-app launching a Spice client")
Reported-by: @jeremie.b
Signed-off-by: Marc-André Lureau <[email protected]>
---
 ui/spice-app.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ui/spice-app.c b/ui/spice-app.c
index fe3df62bfa5d..90e8de0bc87d 100644
--- a/ui/spice-app.c
+++ b/ui/spice-app.c
@@ -180,8 +180,14 @@ static void spice_app_display_early_init(DisplayOptions 
*opts)
     qemu_opt_set(qopts, "image-compression", "off", &error_abort);
     qemu_opt_set(qopts, "streaming-video", "off", &error_abort);
 #ifdef HAVE_SPICE_GL
-    qemu_opt_set(qopts, "gl", opts->has_gl ? "on" : "off", &error_abort);
-    display_opengl = opts->has_gl;
+    if (opts->has_gl &&
+        opts->gl != DISPLAY_GL_MODE_ON &&
+        opts->gl != DISPLAY_GL_MODE_OFF) {
+        error_report("spice-app only supports gl=on/off");
+        exit(1);
+    }
+    display_opengl = opts->has_gl && opts->gl != DISPLAY_GL_MODE_OFF;
+    qemu_opt_set(qopts, "gl", display_opengl ? "on" : "off", &error_abort);
 #endif
 }
 
-- 
2.56.0.rc0.29.g47ce80527c56


Reply via email to