ui: add a D-Bus display backend

The "dbus" display backend exports the QEMU consoles and other
UI-related interfaces over D-Bus.

By default, the connection is established on the session bus, but you
can specify a different bus with the "addr" option.

The backend takes the "org.qemu" service name, while still allowing
further instances to queue on the same name (so you can lookup all the
available instances too). It accepts any number of clients at this
point, although this is expected to evolve with options to restrict
clients, or only accept p2p via fd passing.

The interface is intentionally very close to the internal QEMU API,
and can be introspected or interacted with busctl/dfeet etc:

$ ./qemu-system-x86_64 -name MyVM -display dbus
$ busctl --user introspect org.qemu /org/qemu/Display1/Console_0

org.qemu.Display1.Console           interface -         -               -
.RegisterListener                   method    h         -               -
.SetUIInfo                          method    qqiiuu    -               -
.DeviceAddress                      property  s         "pci/0000/01.0" emits-change
.Head                               property  u         0               emits-change
.Height                             property  u         480             emits-change
.Label                              property  s         "VGA"           emits-change
.Type                               property  s         "Graphic"       emits-change
.Width                              property  u         640             emits-change
[...]

See the interfaces XML source file and Sphinx docs for the generated API
documentations.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Marc-André Lureau 2021-07-15 11:53:53 +04:00
parent d83acfd013
commit 142ca628a7
14 changed files with 1862 additions and 2 deletions

View file

@ -1862,6 +1862,10 @@ DEF("display", HAS_ARG, QEMU_OPTION_display,
#endif
#if defined(CONFIG_OPENGL)
"-display egl-headless[,rendernode=<file>]\n"
#endif
#if defined(CONFIG_DBUS_DISPLAY)
"-display dbus[,addr=<dbusaddr>]\n"
" [,gl=on|core|es|off][,rendernode=<file>]\n"
#endif
"-display none\n"
" select display backend type\n"
@ -1889,6 +1893,17 @@ SRST
application. The Spice server will redirect the serial consoles
and QEMU monitors. (Since 4.0)
``dbus``
Export the display over D-Bus interfaces. (Since 7.0)
The connection is registered with the "org.qemu" name (and queued when
already owned).
``addr=<dbusaddr>`` : D-Bus bus address to connect to.
``gl=on|off|core|es`` : Use OpenGL for rendering (the D-interface will
share framebuffers with DMABUF file descriptors).
``sdl``
Display video output via SDL (usually in a separate graphics
window; see the SDL documentation for other possibilities).