diff mbox

[v18,0/6] drm/i915/gvt: Dma-buf support for GVT-g

Message ID 20171123061232.7kfquhnlkdctfsdp@zhen-hp.sh.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhenyu Wang Nov. 23, 2017, 6:12 a.m. UTC
On 2017.11.15 11:49:00 +0100, Gerd Hoffmann wrote:
> On Wed, Nov 15, 2017 at 05:11:49PM +0800, Tina Zhang wrote:
> > v17->v18:
> > 1) unmap vgpu's opregion when destroying vgpu.
> > 2) update comments for VFIO_DEVICE_GET_GFX_DMABUF. (Alex)
> 
> > This patch set adds the dma-buf support for intel GVT-g.
> > 
> > dma-buf is an uniform mechanism to share DMA buffers across different
> > devices and subsystems. dma-buf for intel GVT-g is mainly used to share
> > the vgpu's framebuffer to userspace to leverage userspace graphics stacks
> > to render the framebuffer to the display monitor.
> > 
> > The main idea is that we create a gem object and set vgpu's framebuffer as
> > its backing storage. Then, export a dma-buf associated with this gem object.
> > With the fd of this dma-buf, userspace can directly handle this buffer.
> > 
> > This patch set can be tried with the following example:
> > 	git://git.kraxel.org/qemu  branch: work/intel-vgpu
> > 
> > A topic branch with the latest patch set is:
> >         https://github.com/intel/gvt-linux.git   branch: topic/dmabuf
> 
> Tested-by: Gerd Hoffmann <kraxel@redhat.com>
> 

After debugging with Tina on one left race that fixed by
https://lists.freedesktop.org/archives/intel-gvt-dev/2017-November/002505.html

I still need below qemu fix for proper cursor handling, otherwise qemu
just crashed when I click in my terminal program which hides cursor then.


And with these it seems pretty fine now that I'll queue them up for -next pull.

thanks

Comments

Zhang, Tina Nov. 23, 2017, 7:51 a.m. UTC | #1
> -----Original Message-----
> From: intel-gvt-dev [mailto:intel-gvt-dev-bounces@lists.freedesktop.org] On
> Behalf Of Zhenyu Wang
> Sent: Thursday, November 23, 2017 2:13 PM
> To: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Tian, Kevin <kevin.tian@intel.com>; alex.williamson@redhat.com; intel-
> gfx@lists.freedesktop.org; joonas.lahtinen@linux.intel.com; Wang, Zhi A
> <zhi.a.wang@intel.com>; linux-kernel@vger.kernel.org;
> zhenyuw@linux.intel.com; Zhang, Tina <tina.zhang@intel.com>;
> kwankhede@nvidia.com; Lv, Zhiyuan <zhiyuan.lv@intel.com>; daniel@ffwll.ch;
> chris@chris-wilson.co.uk; intel-gvt-dev@lists.freedesktop.org; Yuan, Hang
> <hang.yuan@intel.com>
> Subject: Re: [PATCH v18 0/6] drm/i915/gvt: Dma-buf support for GVT-g
> 
> On 2017.11.15 11:49:00 +0100, Gerd Hoffmann wrote:
> > On Wed, Nov 15, 2017 at 05:11:49PM +0800, Tina Zhang wrote:
> > > v17->v18:
> > > 1) unmap vgpu's opregion when destroying vgpu.
> > > 2) update comments for VFIO_DEVICE_GET_GFX_DMABUF. (Alex)
> >
> > > This patch set adds the dma-buf support for intel GVT-g.
> > >
> > > dma-buf is an uniform mechanism to share DMA buffers across
> > > different devices and subsystems. dma-buf for intel GVT-g is mainly
> > > used to share the vgpu's framebuffer to userspace to leverage
> > > userspace graphics stacks to render the framebuffer to the display monitor.
> > >
> > > The main idea is that we create a gem object and set vgpu's
> > > framebuffer as its backing storage. Then, export a dma-buf associated with
> this gem object.
> > > With the fd of this dma-buf, userspace can directly handle this buffer.
> > >
> > > This patch set can be tried with the following example:
> > > 	git://git.kraxel.org/qemu  branch: work/intel-vgpu
> > >
> > > A topic branch with the latest patch set is:
> > >         https://github.com/intel/gvt-linux.git   branch: topic/dmabuf
> >
> > Tested-by: Gerd Hoffmann <kraxel@redhat.com>
> >
> 
> After debugging with Tina on one left race that fixed by
> https://lists.freedesktop.org/archives/intel-gvt-dev/2017-
> November/002505.html
The next version of this patch set will include this patch.
Thanks.

BR,
Tina
> 
> I still need below qemu fix for proper cursor handling, otherwise qemu just
> crashed when I click in my terminal program which hides cursor then.
> 
> diff --git a/hw/vfio/display.c b/hw/vfio/display.c index
> e500ec2cb1..d9a044b080 100644
> --- a/hw/vfio/display.c
> +++ b/hw/vfio/display.c
> @@ -169,8 +169,9 @@ static void vfio_display_dmabuf_update(void *opaque)
>      cursor = vfio_display_get_dmabuf(vdev, DRM_PLANE_TYPE_CURSOR);
>      if (vdev->cursor != cursor) {
>          vdev->cursor = cursor;
> -        dpy_gl_cursor_dmabuf(vdev->display_con,
> -                             &cursor->buf);
> +        if (cursor)
> +            dpy_gl_cursor_dmabuf(vdev->display_con,
> +                                 &cursor->buf);
>          free_bufs = true;
>      }
>      if (cursor != NULL) {
> 
> And with these it seems pretty fine now that I'll queue them up for -next pull.
> 
> thanks
> 
> --
> Open Source Technology Center, Intel ltd.
> 
> $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
diff mbox

Patch

diff --git a/hw/vfio/display.c b/hw/vfio/display.c
index e500ec2cb1..d9a044b080 100644
--- a/hw/vfio/display.c
+++ b/hw/vfio/display.c
@@ -169,8 +169,9 @@  static void vfio_display_dmabuf_update(void *opaque)
     cursor = vfio_display_get_dmabuf(vdev, DRM_PLANE_TYPE_CURSOR);
     if (vdev->cursor != cursor) {
         vdev->cursor = cursor;
-        dpy_gl_cursor_dmabuf(vdev->display_con,
-                             &cursor->buf);
+        if (cursor)
+            dpy_gl_cursor_dmabuf(vdev->display_con,
+                                 &cursor->buf);
         free_bufs = true;
     }
     if (cursor != NULL) {