[RFC PATCH v2 0/3] drm/i915/gvt: Enable vGPU local display direct flip
Gerd Hoffmann
kraxel at redhat.com
Tue May 21 19:39:44 UTC 2019
Hi,
> In the first version, we proposed to use drm_framebuffer standing for
> a virtual plane. Host uses the drm_framebuffer to do the assignment
> and gvt-g directly commits the guest framebuffer to the assigned
> plane, which is called in-kernel direct flip. In that proposal we
> leveraged i915 APIs to do the plane assignment and direct flip.
> However, we got an open about how to deliver the drm_framebuffer id to
> the host user space and the idea of adding new ioctls is rejected by
> upstream. Since the /sys way was also rejected by gvt-g, we began to
> think about reusing vfio display dma-buf interface for plane
> assignment.
I remember those discussions. So this approach isn't used any more.
That clarifies things a bit.
> In this second version, host uses the dma-buf interface to do the
> assignment and gvt-g direct commits the guest framebuffer to the
> assigned plane. We didn't introduce any new dma-buf ioctl for this.
> However gvt-g in kernel does need to know when to start in-kernel
> direct flip and when to stop. In this proposal, a switch is added to
> vgpu sys. User space can enable or disable the in-kernel direct flip
> by echo 1 or 0 to that attribute. And we would like to discuss with
> user space about this.
So, what happens exactly? With the sysfs switch disabled you'll
probably get traditional behavior, i.e. dmabufs are exported via
vfio API, and it changes on each page flip.
Now with the switch enabled, what changes? Userspace will still
get a dmabuf I guess, but probably not a new one on each page flip.
Can userspace mmap() the dmabuf?
Can userspace import the dmabuf as egl image, then use it as texture or
framebuffer?
Can userspace import the dmabuf as bo (using gbm_import_bo() for
example), create a drm framebuffer and map it to a crtc?
Will the content update automatically on pageflips?
> Besides, there is also another option: the guest page flip event is
> delivered to user space where qemu ui can query the dma-buf info and
> commit the framebuffer based on dma-buf to the HW plane. In this
> scenario, gvt-g doesn't do the in-kernel direct flip. Everything is
> handled by host user space (i.e. qemu ui).
Initial sketch of a drm ui:
https://git.kraxel.org/cgit/qemu/log/?h=sirius/display-drm
Does exactly this. In polling mode though. The kernel delivering a
guest page-flip notification to qemu somehow would be useful for a
timely host page-flip.
> With the help for drm leasing, qemu ui can fully control the leased
> pipe and plane resource. And the typical use case is pipe assignment
> (i.e. each VM is shown on one pipe/monitor). Comments are welcome.
Googling for drm leases doesn't turn up much. Seems rarely used.
Kernel got support. Seems Xorg has support (or patches exist),
i.e. I can ask the X server for a lease.
Does anything else exist?
A drm lease handle can be used like a drm master handle, except that
only the leased ressources are visible and usable, correct?
cheers,
Gerd
More information about the intel-gvt-dev
mailing list