[PATCH v2 0/3] hw/display: add vhost-user-media device

Albert Esteve posted 3 patches 3 weeks, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260901-virtio-media-v2-0-bd3cc9347ab9@redhat.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, Albert Esteve <aesteve@redhat.com>, Cornelia Huck <cohuck@redhat.com>
MAINTAINERS                                 |   6 +
hw/display/Kconfig                          |   5 +
hw/display/meson.build                      |   3 +
hw/display/vhost-user-media-pci.c           | 115 +++++++++
hw/display/vhost-user-media.c               | 388 ++++++++++++++++++++++++++++
hw/virtio/virtio.c                          |   3 +-
include/hw/virtio/vhost-user-media.h        |  46 ++++
include/standard-headers/linux/virtio_ids.h |   1 +
8 files changed, 566 insertions(+), 1 deletion(-)
[PATCH v2 0/3] hw/display: add vhost-user-media device
Posted by Albert Esteve 3 weeks, 4 days ago
This series introduces the QEMU frontend for the virtio-media device,
a VirtIO device that exposes V4L2 video device functionality to the guest
over the virtio-media protocol, as specified in the VirtIO specification
v1.4, section 5.22 [1].

Overview
--------
Patch 1 adds VIRTIO_ID_MEDIA definition from Linux v7.3-rc1.

Patch 2 introduces the vhost-user-media device frontend as defined by
the specification.

Patch 3 adds a shared memory PCI BAR (BAR 2) sized by GET_SHMEM_CONFIG
and used by the guest driver as a MMAP mapping window for video buffer
exchange with the host backend. The region is exposed to the guest
through a VirtIO shared memory capability.

Testing
-------
The series was tested with:

  Guest driver: the virtio-media out-of-tree Linux kernel driver [2].
  An upstream series for this driver has also been posted [3].

  Host backend: the rust-vmm vhost-device-media backend [4]:
      cargo run -- -s /path/to/media.sock -d /dev/video0 --backend v4l2-proxy

  Full QEMU invocation:

      qemu-system-x86_64 \
          -chardev socket,path=/path/to/media.sock,id=media \
          -device vhost-user-media-pci,chardev=media,id=media \
          -object memory-backend-memfd,id=mem,size=4G,share=on \
          -numa node,memdev=mem

[1] https://docs.oasis-open.org/virtio/virtio/v1.4/cs01/virtio-v1.4-cs01.html
[2] https://github.com/chromeos/virtio-media/tree/main/driver
[3] https://lore.kernel.org/all/20260622204343.1994418-1-briandaniels@google.com/
[4] https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-media

--
Changes in v2:
- virtio_ids.h header updated from kernel sources
- Updated copyright year to current
- Added MAINTAINERS entry for vhost-user-media
- Added GET_SHMEM_CONFIG request for media shm region
- Few other changes to align media with other backends
- Link to v1: https://lore.kernel.org/qemu-devel/20260630112310.552606-1-aesteve@redhat.com/

Signed-off-by: Albert Esteve <aesteve@redhat.com>
---
Albert Esteve (3):
      linux-headers: add VIRTIO_ID_MEDIA
      hw/display: add vhost-user-media device
      hw/display/vhost-user-media: add shared memory region BAR

 MAINTAINERS                                 |   6 +
 hw/display/Kconfig                          |   5 +
 hw/display/meson.build                      |   3 +
 hw/display/vhost-user-media-pci.c           | 115 +++++++++
 hw/display/vhost-user-media.c               | 388 ++++++++++++++++++++++++++++
 hw/virtio/virtio.c                          |   3 +-
 include/hw/virtio/vhost-user-media.h        |  46 ++++
 include/standard-headers/linux/virtio_ids.h |   1 +
 8 files changed, 566 insertions(+), 1 deletion(-)
---
base-commit: d2e570cc0f97b936902a5b1b86b73c0f5998b475
change-id: 20260901-virtio-media-81b38a604aaa

Best regards,
-- 
Albert Esteve <aesteve@redhat.com>