From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zhenyu Wang Subject: Re: Local Display Direct Flip Feature Discussion Date: Fri, 21 Dec 2018 10:52:38 +0800 Message-ID: <20181221025238.GA32123@zhen-hp.sh.intel.com> References: <237F54289DF84E4997F34151298ABEBC874D9434@SHSMSX101.ccr.corp.intel.com> <20181213123350.dc2gxfhzw2pxeu7s@sirius.home.kraxel.org> <20181219054255.GB9783@intel.com> <20181219112616.ely345jlk4zj36ru@sirius.home.kraxel.org> <237F54289DF84E4997F34151298ABEBC874E5E23@SHSMSX101.ccr.corp.intel.com> <20181220113335.3lldza37rfwb462h@sirius.home.kraxel.org> Reply-To: Zhenyu Wang Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1370949157==" Return-path: In-Reply-To: <20181220113335.3lldza37rfwb462h@sirius.home.kraxel.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Gerd Hoffmann Cc: intel-gfx , dri-devel@lists.freedesktop.org, "Yuan, Hang" , "Lv, Zhiyuan" , "Vetter, Daniel" , "Wang, Hongbo" , intel-gvt-dev List-Id: intel-gfx@lists.freedesktop.org --===============1370949157== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vIq7vvlOcsOjFaxi" Content-Disposition: inline --vIq7vvlOcsOjFaxi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2018.12.20 12:33:35 +0100, Gerd Hoffmann wrote: > On Thu, Dec 20, 2018 at 08:45:09AM +0000, Zhang, Tina wrote: > >=20 > >=20 > > > -----Original Message----- > > > From: intel-gvt-dev [mailto:intel-gvt-dev-bounces@lists.freedesktop.o= rg] On > > > Behalf Of Gerd Hoffmann > > > Sent: Wednesday, December 19, 2018 7:26 PM > > > To: Zhang, Tina > > > Cc: Tian, Kevin ; Wang, Zhenyu Z > > > ; Wang, Zhi A ; He, Min > > > ; Yuan, Hang ; Alex Williamson > > > ; Lv, Zhiyuan ; Vet= ter, > > > Daniel ; intel-gvt-dev > > dev@lists.freedesktop.org>; Wang, Hongbo > > > Subject: Re: Local Display Direct Flip Feature Discussion > > >=20 > > > Hi, > > >=20 > > > > > Isn't a framebuffer just a gem object with metadata (fourcc, widt= h, > > > > > 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 disp= lay > > > > > to the framebuffer? > > > > The special DRM framebuffer is transparent to the guest display dri= ver. > > > > We just want to use this object to save the guest framebuffer info = in > > > > host-side. > > >=20 > > > 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 crt= c 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 hos= t drm > > frambuffer has on gem backends, which means host cannot manage the >=20 > ... has no gem ... ? >=20 > > memory of this drm framebuffer. And it's OK, as the guest does the mana= gement. > > Besides, generic drm framebuffer was designed to be able to deal with t= his kind > > of situation. >=20 > 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. >=20 > What is the plan for hardware cursor support? Support two framebuffers, > for primary and cursor? >=20 > > > It makes sense to allow mapping guest outputs to host outputs. I thi= nk it is > > > more useful to handle that at crtc level not plane level, so it'll wo= rk for both > > > primary and cursor plane. I think it would be cleaner to introduce n= ew drm > > > (generic or i915) APIs for that instead of creating special framebuff= er objects > > > which behave in non-standard ways. > > The APIs solution is one of our options and we have patch for it. The u= serspace > > 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. >=20 > (3) Having this (in debugfs) would be useful for debugging purposes, > even in addition to (1) or (2). >=20 > (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. >=20 > (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. >=20 > 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 coul= d add > > > some page flip notification mechanism (using an eventfd for example) = so > > > qemu can update the host plane (or notify spice client) instantly ins= tead of > > > waiting for the next display refresh timer tick. > > We could do that. But the local display direct flip feature doesn't wan= t to involve > > the host userspace, considering the performance. >=20 > 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. >=20 > > Maybe we can add this mechanism to dma-buf use case. >=20 > That would be cool. >=20 > cheers, > Gerd >=20 --=20 Open Source Technology Center, Intel ltd. $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827 --vIq7vvlOcsOjFaxi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQTXuabgHDW6LPt9CICxBBozTXgYJwUCXBxVdgAKCRCxBBozTXgY JzBnAKCZHifEk07uGouKOlUdvKMGL2iT4wCeIeV8fW09E63DtmeizXJB+FkOFoE= =PUvI -----END PGP SIGNATURE----- --vIq7vvlOcsOjFaxi-- --===============1370949157== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============1370949157==--