[RFC PATCH v2 0/3] drm/i915/gvt: Enable vGPU local display direct flip
Tina Zhang
tina.zhang at intel.com
Fri May 10 04:15:25 UTC 2019
The first version and some backgrounds:
https://lists.freedesktop.org/archives/intel-gvt-dev/2018-December/004559.html
In this version, instead of direct using framebuffer pinned on guest GGTT space,
a shadow framebuffer with decoded guest framebuffer information is proposed on
host side where the shadow framebuffer can be used by GVT-g to do the page flip
through drm/kms APIs.
With the proposed shadow framebuffer, this patch-set is trying to implement the
feature w/o changing i915 code.
Plane assignment:
-----------------
Userspace leverage the vfio/display dma-buf APIs to do the plane assignment.
Besides, userspace needs to switch on "enable_direct_flip" attribute to inform
GVT-g to do in-kernel direct flip.
In-kernel direct flip:
----------------------
With "enable_direct_flip" switched on, during vGPU page flip, GVT-g will:
1) Find out the assigned HW planes.
GVT-g is the owner of the I915_GEM_OBJECT_IS_PROXY GEM which is exposed by
GVT-g with dma-buf interface.
GVT-g scan the framebuffers set on the active planes to see if there are some
framebuffers with I915_GEM_OBJECT_IS_PROXY GEM.
A HW plane using a framebuffer with I915_GEM_OBJECT_IS_PROXY GEM is considered
as an assigned plane. GVT-g gets the assignment information through gvt_info
structure of the I915_GEM_OBJECT_IS_PROXY GEM.
2) Decode vGPU's framebuffer info and use that to update the shadow framebuffer.
3) Commit the shadow framebuffer through "drm_atomic_commit()".
Performance consideration:
-------------------------
In order to achieve better performance, drm async plane update mechanism is
expected to be used, which can reduce the time spent on waiting for the next
vblank. However, this performance enhancement requires i915 to support the
async plane update first.
About Multi-pipe assignment:
---------------------------
Currently we only tried one-pipe assignment (i.e. assign a pipe and its planes to
one VM), with the help of the proposed QEMU KMS UI (https://github.com/intel/
Igvtg-qemu/commit/fa58b441ea62381269b329869d608b61d6f1c9fb).
Multi-pipe assignment is considered doable as well, if the QEMU KMS UI can use the
leasing APIs to lease a pipe and its related planes from a compositor (e.g. xorg),
which is based on drm leasing mechanism.
How to test:
------------
1. GVT-g QEMU repo:
Repo: https://github.com/intel/Igvtg-qemu
Branch: topic/local_display_direct_flip
Commit: https://github.com/intel/Igvtg-qemu/commit/fa58b441ea62381269b329869d608b61d6f1c9fb
Please add " -display kms" option.
2. Kernel:
Apply this patch-set againest upstream kernel version >= 5.1-rc4
Userspace needs to swich on the direct function through the proposed
"enable_direct_flip" attribute by "echo 1 > enable_direct_flip".
Tina Zhang (3):
drm/i915/gvt: Introduce vgpu shadow framebuffer
drm/i915/gvt: Introduce enable_direct_flip attribute
drm/i915/gvt: Enable vGPU direct flip
drivers/gpu/drm/i915/gvt/display.c | 110 ++++++++++++
drivers/gpu/drm/i915/gvt/display.h | 2 +-
drivers/gpu/drm/i915/gvt/dmabuf.c | 10 +-
drivers/gpu/drm/i915/gvt/dmabuf.h | 10 +-
drivers/gpu/drm/i915/gvt/gvt.h | 7 +
drivers/gpu/drm/i915/gvt/handlers.c | 332 ++++++++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/gvt/kvmgt.c | 38 +++++
7 files changed, 505 insertions(+), 4 deletions(-)
--
2.7.4
More information about the intel-gvt-dev
mailing list