Local Display Direct Flip Feature Discussion
Zhang, Tina
tina.zhang at intel.com
Thu Dec 13 09:17:38 UTC 2018
Hi,
We're working on enabling a new feature called "Local Display Direct Flip" in GVT-g. And we want to use this thread to introduce this feature and discuss the userspace interface.
What is the local display direct flip feature?
This feature provides vGPUs with the capabilities to control a subset of the local HW display engine resources to display output from a virtualized environment. With this feature, vGPUs can leverage HW display engine's capabilities to compose their framebuffers and post the final outputs to the assigned local display monitors.
Please see https://lists.freedesktop.org/archives/intel-gvt-dev/2018-December/004559.html for details.
Why the proposed local display direct flip feature is considered more efficient?
Currently, GVT-g upstream support local display based on dma-buf. For example, with dma-buf, GTK UI can compose the guest framebuffers and post the final framebuffer to the local display monitor. Although this dma-buf solution is flexible for both local display and remote display, this solution has to involve userspace when the guest framebuffer is updated. And usually, this happens every frame.
Meanwhile, local display direct flip feature doesn't need to involve userspace for the guest plane update. Userspace just needs to do the assignment once (although the feature supports the dynamic assignment), and planes on the assigned pipe can be leveraged by the guest to compose its framebuffers w/o involving host userspace any more. That's why it's considered more efficient.
The proposed userspace interface:
Each plane of the vGPU is exposed as a DRM framebuffer object in the host-side during the vGPU creation. So host userspace can assign the HW display planes to vGPU's planes by using existing DRM/KMS APIs. After the assignment, host kernel can directly help guest to update the information to the display registers of the assigned display resources. However, the only problem is how we return the DRM framebuffer id to host userspace.
Currently, we have two options:
1. Through "/sys/bus/pci/devices/0000:00:02.0/$UUID/intel_vgpu/plane_id_index"
With the proposed "plane_id_index" attribute, userspace can echo the plane number to the attribute and then use cat to dump the userspace id of the DRM framebuffer standing for that vGPU's plane in the host-side.
2. Through vfio ioctl:
We can extend VFIO_DEVICE_QUERY_GFX_PLANE ABI by proposing "VFIO_GFX_PLANE_TYPE_DRM_FB" type. So that vendor driver can return the framebuffer id when userspace invoking "VFIO_DEVICE_QUERY_GFX_PLANE" ioctl with flags as "VFIO_GFX_PLANE_TYPE_DRM_FB | VFIO_GFX_PLANE_TYPE_PROBE"
The patches are on:
https://github.com/intel/igvtg-qemu/tree/topic/local_display_direct_flip
https://github.com/intel/gvt-linux/tree/topic/local_display_direct_flip
How to try it:
Qemu: https://github.com/intel/igvtg-qemu/tree/topic/local_display_direct_flip
Kernel: https://github.com/intel/gvt-linux/tree/topic/local_display_direct_flip
(Note: these branches include both of the two options of userspace interface and they are live branches as WIP)
The reference boot script:
-m 4096 -smp 2 -M pc \
-name kvmgt1 \
-hda $1 \
-bios /home/tinazhang/workspace/KVMGT/qemu-upstream/qemu/roms/seabios/out/bios.bin -enable-kvm \
-net nic,macaddr=00:A1:00:00:00:BD -net tap,script=/etc/qemu-ifup \
-vga none \
-display kms \
-k en-us \
-serial stdio \
-machine kernel_irqchip=on \
-global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 \
-cpu host -usb -usbdevice tablet \
-device vfio-pci,sysfsdev=/sys/bus/pci/devices/0000:00:02.0/$UUID,rombar=0,x-igd-opregion=on,display=on
To-do list:
We got kernel-side to-do list here: https://lists.freedesktop.org/archives/intel-gvt-dev/2018-December/004559.html
Besides, here is one for the proposed Qemu KMS UI and hope that one could be interesting.
To support Mult-VMs pipe assignment by assigning each crtc to a VM:
The proposed KMS UI can only support one VM pipe assignment, due to the DRM master limitation. However, kernel has supported a feature called DRM-lease (https://keithp.com/blogs/DRM-lease-2/). And userspace graphics stacks have also implemented this feature. This can solve the DRM master problem by leasing the pipe and its resources to one App which is Qemu in our case.
Thanks.
BR,
Tina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20181213/300aeb2f/attachment.html>
More information about the intel-gvt-dev
mailing list