From: Marc-André Lureau <marcandre.lur...@redhat.com> Hi,
Both Spice and VNC are relatively complex and inefficient for local-only display/console export. The goal of this display backend is to export over D-Bus an interface close to the QEMU internal console API. Any -display or -audio backend should be possible to implement externally that way. D-Bus is the protocol of choice for the desktop, it has many convenient bindings for various languages, or tools (d-feet, busctl etc). Data blob transfer is more efficient than QMP too. This implementation makes use of p2p connections for data streaming, and a bus for basic introspection & interactions. It is currently Unix-only, but it should be possible to port to other systems relatively easily (minus fd-passing, which will have to use fallback or different methods). This will allow to lift some task from the QEMU process (Spice or VNC aren't trivial!). Backends can come and go. You can have several display opened (say Boxes & virt-manager), while exporting the display over VNC for example. An IPC interface is an easy starting point for writing backends in different languages. I started a Gtk4 & VNC backends in Rust. Rather than rewrite existing backends, it would be more interesting to develop new ones imho, such as a RDP backend (based on IronRDP & freerdp). An option is also to build the QEMU backends as D-Bus backends (maybe not too difficult). Given the current goals, the D-Bus interface is not meant to be stable. Clients/backends should be shipped together with QEMU. QEMU could ship its own Gtk4 widget/library (ideally written in Rust, with an exposed C/GIR API). The last part of the series modify vhost-user-gpu to notify directly the client of display changes, bypassing QEMU (VGA-time will be blank, atm) Basic testing: $ qemu-system- ... -display dbus And after git clone https://gitlab.com/marcandre.lureau/qemu-display.git $ cargo run --bin qemu-gtk4 Better to use with gl=on and virgl. You may also export audio with "-audiodev dbus" (see related patch). Marc-André Lureau (27): ui: fold qemu_alloc_display in only caller vhost-user-gpu: glFlush before notifying clients vhost-user-gpu: fix vugbm_device_init fallback vhost-user-gpu: fix cursor move/update ui: factor out qemu_console_set_display_gl_ctx() ui: associate GL context outside of display listener registration ui: make gl_block use a counter ui: add a gl-unblock warning timer ui: simplify gl unblock & flush ui: dispatch GL events to all listeners ui: split the GL context in a different object ui: move qemu_spice_fill_device_address to ui/util.c console: save current scanout details ui: add a D-Bus display backend audio: add dbusaudio backend vhost-user-gpu: add vg_send_disable_scanout() vhost-user-gpu: add vg_send_scanout_dmabuf() vhost-user-gpu: add vg_send_dmabuf_update() vhost-user-gpu: add vg_send_scanout() vhost-user-gpu: add vg_send_cursor_update() vhost-user-gpu: add vg_send_cursor_pos() vhost-user-gpu: add vg_send_update() vhost-user: add VHOST_USER_GPU_QEMU_DBUS_LISTENER ui: add GraphicHwOps.register_dbus_listener() vhost-user-gpu: implement register_dbus_listener() vhost-user-gpu: check the PIXMAN format is supported vhost-user-gpu: implement GPU_QEMU_DBUS_LISTENER docs/interop/vhost-user.rst | 10 + meson.build | 5 + qapi/audio.json | 3 +- qapi/ui.json | 27 +- audio/audio_int.h | 7 + audio/audio_template.h | 2 + contrib/vhost-user-gpu/vugbm.h | 2 +- contrib/vhost-user-gpu/vugpu.h | 37 +- include/hw/virtio/vhost-backend.h | 2 + include/hw/virtio/virtio-gpu.h | 1 + include/qemu/dbus.h | 20 + include/ui/console.h | 68 ++- include/ui/egl-context.h | 6 +- include/ui/gtk.h | 11 +- include/ui/sdl2.h | 7 +- include/ui/spice-display.h | 5 +- subprojects/libvhost-user/libvhost-user.h | 5 + ui/dbus.h | 69 +++ audio/audio.c | 1 + audio/dbusaudio.c | 649 ++++++++++++++++++++++ contrib/vhost-user-gpu/vhost-user-gpu.c | 580 +++++++++++++++---- contrib/vhost-user-gpu/virgl.c | 45 +- contrib/vhost-user-gpu/vugbm.c | 44 +- hw/display/qxl.c | 5 +- hw/display/vhost-user-gpu.c | 35 +- hw/display/virtio-gpu-base.c | 19 +- hw/display/virtio-vga.c | 13 +- hw/virtio/vhost-user.c | 23 + ui/console.c | 312 +++++++---- ui/dbus-console.c | 460 +++++++++++++++ ui/dbus-error.c | 45 ++ ui/dbus-listener.c | 480 ++++++++++++++++ ui/dbus.c | 290 ++++++++++ ui/egl-context.c | 6 +- ui/egl-headless.c | 20 +- ui/gtk-egl.c | 11 +- ui/gtk-gl-area.c | 9 +- ui/gtk.c | 25 +- ui/sdl2-gl.c | 12 +- ui/sdl2.c | 14 +- ui/spice-core.c | 50 -- ui/spice-display.c | 25 +- ui/util.c | 75 +++ util/module.c | 3 + audio/meson.build | 3 +- audio/trace-events | 5 + contrib/vhost-user-gpu/meson.build | 6 +- qemu-options.hx | 11 + ui/dbus-display1.xml | 205 +++++++ ui/meson.build | 18 + ui/trace-events | 11 + 51 files changed, 3386 insertions(+), 411 deletions(-) create mode 100644 ui/dbus.h create mode 100644 audio/dbusaudio.c create mode 100644 ui/dbus-console.c create mode 100644 ui/dbus-error.c create mode 100644 ui/dbus-listener.c create mode 100644 ui/dbus.c create mode 100644 ui/util.c create mode 100644 ui/dbus-display1.xml -- 2.29.0