On Tue, Jun 30, 2026 at 01:23:09PM +0200, Albert Esteve wrote: > Add the QEMU side of the vhost-user-media device, which connects to a > virtio-media vhost-user backend daemon implementing the V4L2 API over > the virtio-media protocol. > > The virtio-media device is specified in the VirtIO specification v1.4, > section 5.22: > https://docs.oasis-open.org/virtio/virtio/v1.4/cs01/virtio-v1.4-cs01.html > > Tested with the rust-vmm vhost-device-media backend [1]: > > cargo run -- -s /path/to/media.sock -d /dev/video0 --backend v4l2-proxy > > Example invocation: > > qemu-system-x86_64 \ > -chardev socket,path=/tmp/media.sock,id=media \ > -device vhost-user-media-pci,chardev=media,id=media > > [1] https://github.com/rust-vmm/vhost-device/pull/944 > > Signed-off-by: Albert Esteve <[email protected]> > --- > hw/display/Kconfig | 5 + > hw/display/meson.build | 3 + > hw/display/vhost-user-media-pci.c | 77 ++++++ > hw/display/vhost-user-media.c | 393 +++++++++++++++++++++++++++ > hw/virtio/virtio.c | 3 +- > include/hw/virtio/vhost-user-media.h | 47 ++++ > 6 files changed, 527 insertions(+), 1 deletion(-) > create mode 100644 hw/display/vhost-user-media-pci.c > create mode 100644 hw/display/vhost-user-media.c > create mode 100644 include/hw/virtio/vhost-user-media.h > > diff --git a/hw/display/Kconfig b/hw/display/Kconfig > index b3593fe981..060274b1e6 100644 > --- a/hw/display/Kconfig > +++ b/hw/display/Kconfig > @@ -120,6 +120,11 @@ config VHOST_USER_VGA > default y > depends on VIRTIO_VGA && VHOST_USER_GPU > > +config VHOST_USER_MEDIA > + bool > + default y > + depends on VIRTIO && VHOST_USER > + > config DPCD > bool > select AUX > diff --git a/hw/display/meson.build b/hw/display/meson.build > index ffecedbf70..214c047df6 100644 > --- a/hw/display/meson.build > +++ b/hw/display/meson.build > @@ -37,6 +37,9 @@ system_ss.add(when: 'CONFIG_NEXTCUBE', if_true: > files('next-fb.c')) > system_ss.add(when: 'CONFIG_VGA', if_true: files('vga.c')) > system_ss.add(when: 'CONFIG_VIRTIO', if_true: files('virtio-dmabuf.c')) > system_ss.add(when: 'CONFIG_DM163', if_true: files('dm163.c')) > +system_ss.add(when: 'CONFIG_VHOST_USER_MEDIA', if_true: > files('vhost-user-media.c')) > +system_ss.add(when: ['CONFIG_VHOST_USER_MEDIA', 'CONFIG_VIRTIO_PCI' ], > + if_true: files('vhost-user-media-pci.c')) > > stub_ss.add([files('acpi-vga-stub.c'), pixman]) > if (config_all_devices.has_key('CONFIG_VGA_CIRRUS') or > diff --git a/hw/display/vhost-user-media-pci.c > b/hw/display/vhost-user-media-pci.c > new file mode 100644 > index 0000000000..ad9e3900a4 > --- /dev/null > +++ b/hw/display/vhost-user-media-pci.c > @@ -0,0 +1,77 @@ > +/* > + * Vhost-user MEDIA virtio device PCI glue > + * > + * Copyright Red Hat, Inc. 2024
Have you really been hanging on to this new code for 2 years before posting ? Should this be 2026 ? > + * Authors: Albert Esteve <[email protected]> > + * > + * SPDX-License-Identifier: GPL-2.0-or-later > + */ > diff --git a/hw/display/vhost-user-media.c b/hw/display/vhost-user-media.c > new file mode 100644 > index 0000000000..5c627437e7 > --- /dev/null > +++ b/hw/display/vhost-user-media.c > @@ -0,0 +1,393 @@ > +/* > + * Vhost-user Media device > + * > + * Copyright Red Hat, Inc. 2024 Same Q > + * > + * This is the boilerplate for instantiating a vhost-user device > + * implementing a virtio-media device. > + * > + * Authors: > + * Albert Esteve <[email protected]> > + * > + * SPDX-License-Identifier: GPL-2.0-or-later > + */ > + > diff --git a/include/hw/virtio/vhost-user-media.h > b/include/hw/virtio/vhost-user-media.h > new file mode 100644 > index 0000000000..30bdef8ce1 > --- /dev/null > +++ b/include/hw/virtio/vhost-user-media.h > @@ -0,0 +1,47 @@ > +/* > + * vhost-user-media virtio device > + * > + * Copyright Red Hat, Inc. 2024 Again With regards, Daniel -- |: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
