All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC QEMU PATCH] ui: Make the DisplayType enum entries conditional
@ 2021-06-09 10:02 Thomas Huth
  2021-06-09 11:24 ` Gerd Hoffmann
  2021-06-09 13:16 ` Markus Armbruster
  0 siblings, 2 replies; 12+ messages in thread
From: Thomas Huth @ 2021-06-09 10:02 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel
  Cc: libvir-list, smitterl, Eric Blake, Markus Armbruster

Libvirt's "domcapabilities" command has a way to state whether
certain graphic frontends are available in QEMU or not. Originally,
libvirt looked at the "--help" output of the QEMU binary to determine
whether SDL was available or not (by looking for the "-sdl" parameter
in the help text), but since libvirt stopped doing this analysis of
the help text, the detection of SDL is currently broken, see:

 https://bugzilla.redhat.com/show_bug.cgi?id=1790902

QEMU should provide a way via the QMP interface instead. The simplest
way, without introducing additional commands, is to make the DisplayType
enum entries conditional, so that the enum only contains the entries if
the corresponding CONFIG_xxx switches have been set. Unfortunately, this
only works for sdl, cocoa and spice, since gtk, egl-headless and curses
are hard-wired in the "data" section of the DisplayOptions, and thus
unfortunately always have to be defined.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 qapi/ui.json | 12 +++++++++---
 ui/console.c |  4 ++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/qapi/ui.json b/qapi/ui.json
index 1052ca9c38..c4f44cfe50 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -1126,9 +1126,15 @@
 #
 ##
 { 'enum'    : 'DisplayType',
-  'data'    : [ 'default', 'none', 'gtk', 'sdl',
-                'egl-headless', 'curses', 'cocoa',
-                'spice-app'] }
+  'data'    : [
+    { 'name': 'default' },
+    { 'name': 'none' },
+    { 'name': 'gtk' },
+    { 'name': 'sdl', 'if': 'defined(CONFIG_SDL)' },
+    { 'name': 'egl-headless' },
+    { 'name': 'curses' },
+    { 'name': 'cocoa', 'if': 'defined(CONFIG_COCOA)' },
+    { 'name': 'spice-app', 'if': 'defined(CONFIG_SPICE)'} ] }
 
 ##
 # @DisplayOptions:
diff --git a/ui/console.c b/ui/console.c
index 2de5f4105b..954f7162c3 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -2371,8 +2371,12 @@ bool qemu_display_find_default(DisplayOptions *opts)
 {
     static DisplayType prio[] = {
         DISPLAY_TYPE_GTK,
+#if defined(CONFIG_SDL)
         DISPLAY_TYPE_SDL,
+#endif
+#if defined(CONFIG_COCOA)
         DISPLAY_TYPE_COCOA
+#endif
     };
     int i;
 
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-06-10  5:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 10:02 [RFC QEMU PATCH] ui: Make the DisplayType enum entries conditional Thomas Huth
2021-06-09 11:24 ` Gerd Hoffmann
2021-06-09 11:29   ` Daniel P. Berrangé
2021-06-09 11:49     ` Gerd Hoffmann
2021-06-09 11:53       ` Daniel P. Berrangé
2021-06-09 12:01       ` Thomas Huth
2021-06-09 12:50         ` Gerd Hoffmann
2021-06-10  5:01           ` Markus Armbruster
2021-06-10  5:20           ` Thomas Huth
2021-06-09 13:11   ` Markus Armbruster
2021-06-09 13:16 ` Markus Armbruster
2021-06-09 14:36   ` Thomas Huth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.