[PATCH v4] mmap on the dma-buf directly

Thomas Hellstrom thomas at shipmail.org
Thu Aug 13 04:09:48 PDT 2015

On 08/13/2015 01:29 AM, Tiago Vignatti wrote:
> Hi,
> The idea is to create a GEM bo in one process and pass the prime handle of the
> it to another process, which in turn uses the handle only to map and write.
> This could be useful for Chrome OS architecture, where the Web content
> ("unpriviledged process") maps and CPU-draws a buffer, which was previously
> allocated in the GPU process ("priviledged process").
> In v2, I've added a patch that Daniel kindly drafted to allow the
> unpriviledged process flush through a prime fd. In v3, I've fixed a few
> concerns and then added end_cpu_access to i915. In v4, I fixed Sumit Semwal's
> concerns about dma-duf documentation and the FIXME missing in that same patch,
> and also removed WARN in i915 dma-buf mmap (pointed by Chris). PTAL.
> Best Regards,
> Tiago

I take it, this is intended to be a generic interface used mostly for 2D

In that case, using SYNC is crucial for performance of incoherent
architectures and I'd rather see it mandatory than an option. It could
perhaps be made mandatory preferrably using an error or a one-time
kernel warning. If nobody uses the SYNC interface, it is of little use.

Also I think the syncing needs to be extended to two dimensions. A long
time ago when this was brought up people argued why we should limit it
to two dimensions, but I believe two dimensions addresses most
performance-problematic use-cases. A default implementation of
twodimensional sync can easily be made using the one-dimensional API.


> Daniel Thompson (1):
>   drm: prime: Honour O_RDWR during prime-handle-to-fd
> Daniel Vetter (1):
>   dma-buf: Add ioctls to allow userspace to flush
> Tiago Vignatti (2):
>   drm/i915: Implement end_cpu_access
>   drm/i915: Use CPU mapping for userspace dma-buf mmap()
>  Documentation/dma-buf-sharing.txt      | 12 ++++++++
>  drivers/dma-buf/dma-buf.c              | 50 ++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/drm_prime.c            | 10 ++-----
>  drivers/gpu/drm/i915/i915_gem_dmabuf.c | 28 ++++++++++++++++++-
>  include/uapi/drm/drm.h                 |  1 +
>  include/uapi/linux/dma-buf.h           | 43 +++++++++++++++++++++++++++++
>  6 files changed, 136 insertions(+), 8 deletions(-)
>  create mode 100644 include/uapi/linux/dma-buf.h

More information about the dri-devel mailing list