Re: [PATCH v3 1/2] drm/virtio: Add window server support
From: Gerd Hoffmann
Date: Fri Feb 16 2018 - 05:48:51 EST
> > Yes.
>
> Would it make sense for virtio-gpu to map buffers to the guest via PCI BARs?
> So we can use a single drm driver for both 2d and 3d.
Should be doable.
I'm wondering two things though:
(1) Will shmem actually help avoiding a copy?
virtio-gpu with virgl will (even if the guest doesn't use opengl) store
the resources in gpu memory. So the VIRTIO_GPU_CMD_TRANSFER_TO_HOST_2D
copy goes from guest memory directly to gpu memory, and if we export
that as dma-buf and pass it to the wayland server it should be able to
render it without doing another copy.
How does the wl_shm_pool workflow look like inside the wayland server?
Can it ask the gpu to render directly from the pool? Or is a copy to
gpu memory needed here? If the latter we would effectively trade one
copy for another ...
(2) Could we handle the mapping without needing shmem?
Possibly we could extend the vgem driver. So we pass in a iov (which
qemu gets from guest via VIRTIO_GPU_CMD_RESOURCE_ATTACH_BACKING), get
back a drm object. Which effectively creates drm objects on the host
which match the drm object in the guest (both backed by the same set of
physical pages).
cheers,
Gerd