Re: [PATCH v4 0/8] media: add virtio-media driver

From: Mauro Carvalho Chehab

Date: Sun Jul 12 2026 - 03:10:58 EST


On Mon, 22 Jun 2026 16:43:35 -0400
Brian Daniels <briandaniels@xxxxxxxxxx> wrote:

> From: Alexandre Courbot <gnurou@xxxxxxxxx>
>
> Add the first version of the virtio-media driver.
>
> This driver acts roughly as a V4L2 relay between user-space and the
> virtio virtual device on the host, so it is relatively simple, yet
> unconventional. It doesn't use VB2 or other frameworks typically used in
> a V4L2 driver, and most of its complexity resides in correctly and
> efficiently building the virtio descriptor chain to pass to the host,
> avoiding copies whenever possible. This is done by
> scatterlist_builder.[ch].
>
> This version supports MMAP buffers, while USERPTR buffers can also be
> enabled through a driver option. DMABUF support is still pending.

In practice, USERPTR was used on several drivers that wanted to
share buffers between V4L2 and GPU (so, a previous approach before
DMABUF implementation).

On my tests with this driver, I was unable use a 1080p camera with
V4L2 and GPU on crossvm. Lower resolutions worked. No idea if this
was a limitation of crossvm (I only used it to test this driver)
or if it is due to a poor MMAP implementation.



> Compliance Testing
>
> This was tested using v4l2-compliance. Since virtio-media serves as
> a proxy to host devices for the guest VMs, we expect the guest
> compliance test to essentially match the host compliance test for the
> same device.
>
> NOTE: v4l2-compliance changes its test behavior depending on the driver
> name. In the guest, the driver name for virtio-media proxied-devices is
> always "virtio-media", even if the actual host device has a driver name
> of e.g. "uvcvideo". To ensure the test is consistent between the host
> and the guest, I created a patch for the v4l2-compliance tool that
> allows you to override the driver name. All test results that follow use
> this patch:
> https://lore.kernel.org/r/20260528163448.4031965-1-briandaniels@xxxxxxxxxx/

As mentioned before, please submit this with their rationale in
separate as a [PATCH v4l-utils] to linux-media ML.

>
> All tests used a Logitech USB Webcam C925e.

Please test it displaying inside crossvm - or even better to QEMU if
you manage to add virtio-media support to it.

Being at QEMU makes a lot easier for everyone to test it.


Thanks,
Mauro