[Intel-gfx] [RFC PATCH 0/6] drm/i915/gvt: dma-buf support for GVT-g

Xiaoguang Chen xiaoguang.chen at intel.com
Fri Apr 28 09:35:24 UTC 2017


This patch set adds the dma-buf support for intel GVT-g.
dma-buf is a uniform mechanism to share DMA buffers across different
devices and sub-systems.
dma-buf for intel GVT-g is mainly used to share the vgpu's framebuffer
to other users or sub-systems so they can use the dma-buf to show the
desktop of a vm which uses intel vgpu.

The main idea is we create a gem object and set vgpu's framebuffer as
the backing storage of this gem object. And associate this gem obj
to a dma-buf object then export this dma-buf at the meantime
generate a file descriptor for this dma-buf. Finally deliver this file
descriptor to end users.
In the implementation we create an anonymous fd and send this fd to users
using an vfio device region. Once users get this anonymous fd they can do
ioctl using this anonymous fd to get the file descriptor we generated for
dma-buf.

We have an example program on how to use the dma-buf. You can download
the program to have a try :)
git repo: https://github.com/01org/igvtg-qemu branch:kvmgt_dmabuf_example

Xiaoguang Chen (6):
  drm/i915/gvt: extend the GVT-g architecture to support vfio device
    region
  drm/i915/gvt: OpRegion support for GVT-g
  drm/i915/gvt: framebuffer decoder support for GVT-g
  drm/i915: export i915 dmabuf_ops
  drm/i915/gvt: dmabuf support for GVT-g
  drm/i915/gvt: support QEMU getting the dmabuf

 drivers/gpu/drm/i915/gvt/Makefile      |   3 +-
 drivers/gpu/drm/i915/gvt/display.c     |   2 +-
 drivers/gpu/drm/i915/gvt/display.h     |   2 +
 drivers/gpu/drm/i915/gvt/dmabuf.c      | 268 ++++++++++++++++++
 drivers/gpu/drm/i915/gvt/dmabuf.h      |  50 ++++
 drivers/gpu/drm/i915/gvt/fb_decoder.c  | 487 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/gvt/fb_decoder.h  | 170 ++++++++++++
 drivers/gpu/drm/i915/gvt/gvt.c         |   2 +
 drivers/gpu/drm/i915/gvt/gvt.h         |   4 +
 drivers/gpu/drm/i915/gvt/kvmgt.c       | 227 ++++++++++++++-
 drivers/gpu/drm/i915/gvt/opregion.c    |  12 +-
 drivers/gpu/drm/i915/i915_drv.h        |   2 +
 drivers/gpu/drm/i915/i915_gem_dmabuf.c |   2 +-
 include/uapi/linux/vfio.h              |   1 +
 14 files changed, 1224 insertions(+), 8 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/gvt/dmabuf.c
 create mode 100644 drivers/gpu/drm/i915/gvt/dmabuf.h
 create mode 100644 drivers/gpu/drm/i915/gvt/fb_decoder.c
 create mode 100644 drivers/gpu/drm/i915/gvt/fb_decoder.h

-- 
1.9.1



More information about the Intel-gfx mailing list