Re: [RFC QEMU PATCH] ui: Make the DisplayType enum entries conditional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/06/2021 15.16, Markus Armbruster wrote:
Thomas Huth <thuth@xxxxxxxxxx> writes:

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.

Here:

     { 'union'   : 'DisplayOptions',
       'base'    : { 'type'           : 'DisplayType',
                     '*full-screen'   : 'bool',
                     '*window-close'  : 'bool',
                     '*show-cursor'   : 'bool',
                     '*gl'            : 'DisplayGLMode' },
       'discriminator' : 'type',
       'data'    : { 'gtk'            : 'DisplayGTK',
                     'curses'         : 'DisplayCurses',
                     'egl-headless'   : 'DisplayEGLHeadless'} }

Flat union branches can be made conditional like so:

       'data'    : { 'gtk'            : { 'type': 'DisplayGTK',
                                          'if': 'defined(CONFIG_GTK)' },

Then you should be able to make the corresponding enum value
conditional, too.

Thanks for the hint, I'll give it a try!

 Thomas




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux