qemu-devel
[Top][All Lists]
Advanced

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

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


From: Thomas Huth
Subject: Re: [RFC QEMU PATCH] ui: Make the DisplayType enum entries conditional
Date: Wed, 9 Jun 2021 16:36:05 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0

On 09/06/2021 15.16, Markus Armbruster wrote:
Thomas Huth <thuth@redhat.com> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]