[Linaro-mm-sig] [RFC v2] dma-buf: Add buffer sharing framework
sumit.semwal at linaro.org
Thu Sep 15 09:31:28 UTC 2011
The versions that I posted are also on feature-branch at git.linaro.orghere:
Some comments inline.
Thanks, and best regards,
On 13 September 2011 19:59, Sumit Semwal <sumit.semwal at ti.com> wrote:
> This is the first step in defining a buffer sharing framework.
> A new dma_buf buffer object is added, with hooks to allow for easy sharing
> this buffer object across devices.
> The framework allows:
> - a new buffer-object to be created with fixed size.
> - different devices to 'attach' themselves to this buffer, to facilitate
> backing storage negotiation, using dma_buf_attach() API.
> - association of a file pointer with each user-buffer and associated
> allocator-defined operations on that buffer. This operation is called the
> 'export' operation.
> - this exported buffer-object to be shared with the other entity by asking
> its 'file-descriptor (fd)', and sharing the fd across.
> - a received fd to get the buffer object back, where it can be accessed
> the associated exporter-defined operations.
> - the exporter and importer to share the scatterlist using get_scatterlist
> put_scatterlist operations.
> Atleast one 'attach()' call is required to be made prior to calling the
> buffer_map() callback.
> Couple of building blocks in get_scatterlist() are added to ease
> of sync'ing across exporter and importers, and late allocation by the
> Optionally, mmap() file operation is provided for the associated 'fd', as
> wrapper over the allocator defined mmap()[optional], to be used by devices
> might need one.
> The idea was first mooted at the Linaro memory management mini-summit in
> Budapest in May 2011, as part of multiple things needed for a 'unified
> management framework'. It took a more concrete shape at Linaro
> mini-summit in Cambridge, Aug 2011.
> This is based on design suggestions from many people at both the
> most notably from Arnd Bergmann <arnd at arndb.de>, Rob Clark <rob at ti.com>
> Daniel Vetter <daniel at ffwll.ch>.
> The implementation is inspired from proof-of-concept patch-set from
> Tomasz Stanislawski <t.stanislaws at samsung.com>, who demonstrated buffer
> between two v4l2 devices.
> v1: initial RFC.
> - added attach() / detach() dma_buf_ops, and
> - added handling of list of attachment in the dma_buf central API itself.
> - corrected copyright information.
I forgot to mention: As per review comments from Hans, and others, the read
/ write ops are removed for now from both dma_buf_ops and fops of the
associated file. Also mmap is made optional.
> Signed-off-by: Sumit Semwal <sumit.semwal at linaro.org>
> Signed-off-by: Sumit Semwal <sumit.semwal at ti.com>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Linaro-mm-sig