[Intel-gfx] Local Display Direct Flip Feature Discussion

Daniel Vetter daniel at ffwll.ch
Fri Dec 21 13:48:59 UTC 2018


On Fri, Dec 21, 2018 at 10:52:38AM +0800, Zhenyu Wang wrote:
> On 2018.12.20 12:33:35 +0100, Gerd Hoffmann wrote:
> > On Thu, Dec 20, 2018 at 08:45:09AM +0000, Zhang, Tina wrote:
> > > 
> > > 
> > > > -----Original Message-----
> > > > From: intel-gvt-dev [mailto:intel-gvt-dev-bounces at lists.freedesktop.org] On
> > > > Behalf Of Gerd Hoffmann
> > > > Sent: Wednesday, December 19, 2018 7:26 PM
> > > > To: Zhang, Tina <tina.zhang at intel.com>
> > > > Cc: Tian, Kevin <kevin.tian at intel.com>; Wang, Zhenyu Z
> > > > <zhenyu.z.wang at intel.com>; Wang, Zhi A <zhi.a.wang at intel.com>; He, Min
> > > > <min.he at intel.com>; Yuan, Hang <hang.yuan at intel.com>; Alex Williamson
> > > > <alex.williamson at redhat.com>; Lv, Zhiyuan <zhiyuan.lv at intel.com>; Vetter,
> > > > Daniel <daniel.vetter at intel.com>; intel-gvt-dev <intel-gvt-
> > > > dev at lists.freedesktop.org>; Wang, Hongbo <hongbo.wang at intel.com>
> > > > Subject: Re: Local Display Direct Flip Feature Discussion
> > > > 
> > > >   Hi,
> > > > 
> > > > > > Isn't a framebuffer just a gem object with metadata (fourcc, width,
> > > > > > height, stride, ...) attached?  So I'm wondering how that works in
> > > > > > detail.  What happens on page-flip?  Do you make the framebuffer
> > > > > > reference another gem object then?  Or do you blit the guest display
> > > > > > to the framebuffer?
> > > > > The special DRM framebuffer is transparent to the guest display driver.
> > > > > We just want to use this object to save the guest framebuffer info in
> > > > > host-side.
> > > > 
> > > > Hmm, so this object isn't a normal drm framebuffer.  You are just
> > > > masquerading it as drm framebuffer, so you can assign it to a drm crtc or drm
> > > > plane.
> > > Not so bad actually :-)
> > > Host just wants to use a drm framebuffer to describe the drm framebuffer
> > > attached on a vGPU's plane. And the only special thing is that this host drm
> > > frambuffer has on gem backends, which means host cannot manage the
> > 
> > ... has no gem ... ?
> > 
> > > memory of this drm framebuffer. And it's OK, as the guest does the management.
> > > Besides, generic drm framebuffer was designed to be able to deal with this kind
> > > of situation.
> > 
> > Hmm, ok.  Never dealed with framebuffers not backed by gem objects so
> > far, seems to not be very common too.  But the doc comments in
> > include/drm/drm_framebuffer.h suggest it is fine indeed.

Just wanted to jump in here and clarify, since I've originally suggested
this:

Yup, drm_framebuffer backed by non-gem is perfectly fine for the KMS
framework. vmwgfx works like that already. Now we definitely want to
standardize on GEM for code sharing reasons (there's really not much you
need for a bare-bones display kms driver), but that's all the reasons.

Other use-case where we discussed special framebuffers is for connecting
drm to v4l, both as input (v4l fb attached to a plane) or special outputs
(v4l fb attached to a writeback point). And v4l and gvt use-case both have
the special semantics of automatically following to the next buffer
(depending upon what the other side does).

Cheers, Daniel


> > What is the plan for hardware cursor support?  Support two framebuffers,
> > for primary and cursor?
> > 
> > > > It makes sense to allow mapping guest outputs to host outputs.  I think it is
> > > > more useful to handle that at crtc level not plane level, so it'll work for both
> > > > primary and cursor plane.  I think it would be cleaner to introduce new drm
> > > > (generic or i915) APIs for that instead of creating special framebuffer objects
> > > > which behave in non-standard ways.
> > > The APIs solution is one of our options and we have patch for it. The userspace
> > > interface is still under discussion. And here are the three candidates:
> > > 1) Through i915 ioctl
> > > 2) Through vfio/display ioctl
> > > 3) Through GVT-g sys fs or debugfs
> > > And option2 is considered as the preferred one, as this drm framebuffer is related
> > > to the vGPU.
> > 
> > (3) Having this (in debugfs) would be useful for debugging purposes,
> >     even in addition to (1) or (2).
> > 
> > (2) Implies qemu must handle it, so support must either be implemented
> >     in qemu directly, or in another process cooperating with qemu in
> >     some way (extending spice protocol & spice client comes to mind).
> >     Given that the input side (mouse and kbd events) need cooperation
> >     with qemu anyway this might not be much of a limitation though.
> > 
> > (1) Would allow to handle this without having to worry about qemu/vfio
> >     at all.  Needs some infrastructure (drm ioctl to enumerate vgpus for
> >     example).  Possibly the amdgpu guys (which are doing vgpu using
> >     sr/iov instead of mdev) are interested in this too.
> > 
> > No clear winner, but I tend to agree that (2) looks best.
> >
> 
> yeah, that's always my idea on this, because vfio interface would be
> only place to align with vGPU/mdev life cycle. GVT specific sysfs should
> only contain kind of static configuration or things won't depend on vGPU
> open or close, so isn't a good place. Debugfs could be used for anything
> helpful to dump.
> 
> Original idea is still using dmabuf object to present vGPU plane.
> Instead of using polling for now as in qemu drm/kms display POC code,
> as you sugguested, some notification method could be created for vGPU
> plane flip.
> 
> For direct flip, some flag or attribute could be added for drm/i915
> ioctl when create drm_framebuffer from dmabuf or when modesetting to
> say "this is special vGPU plane buffer so pls help to do atomic async
> update on it when guest flip".
> 
> > > > Alternatively try to tackle the problem in a completely different way.
> > > > Right now qemu will check for display changes using a timer.  We could add
> > > > some page flip notification mechanism (using an eventfd for example) so
> > > > qemu can update the host plane (or notify spice client) instantly instead of
> > > > waiting for the next display refresh timer tick.
> > > We could do that. But the local display direct flip feature doesn't want to involve
> > > the host userspace, considering the performance.
> > 
> > Is the additional switch to qemu actually that much of a performance
> > problem?  I somehow doubt it, it's not like we are doing hundreds of
> > page-flips per second.
> > 
> > > Maybe we can add this mechanism to dma-buf use case.
> > 
> > That would be cool.
> > 
> > cheers,
> >   Gerd
> > 
> 
> -- 
> Open Source Technology Center, Intel ltd.
> 
> $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827



> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the intel-gvt-dev mailing list