Hi All,
The versions that I posted are also on feature-branch at git.linaro.orghere:
version 2: http://git.linaro.org/gitweb?p=people/sumitsemwal/linux-3.x.git%3Ba=shortlog... dma-buf-v2 version 1: http://git.linaro.org/gitweb?p=people/sumitsemwal/linux-3.x.git%3Ba=shortlog... dma-buf-v1
Some comments inline.
Thanks, and best regards, ~Sumit.
On 13 September 2011 19:59, Sumit Semwal sumit.semwal@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 of 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
for its 'file-descriptor (fd)', and sharing the fd across.
- a received fd to get the buffer object back, where it can be accessed
using the associated exporter-defined operations.
- the exporter and importer to share the scatterlist using get_scatterlist
and 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 introduction of sync'ing across exporter and importers, and late allocation by the exporter.
Optionally, mmap() file operation is provided for the associated 'fd', as wrapper over the allocator defined mmap()[optional], to be used by devices that 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 memory management framework'. It took a more concrete shape at Linaro memory-management mini-summit in Cambridge, Aug 2011.
This is based on design suggestions from many people at both the mini-summits, most notably from Arnd Bergmann arnd@arndb.de, Rob Clark rob@ti.com and Daniel Vetter daniel@ffwll.ch.
The implementation is inspired from proof-of-concept patch-set from Tomasz Stanislawski t.stanislaws@samsung.com, who demonstrated buffer sharing between two v4l2 devices.
v1: initial RFC. v2:
- added attach() / detach() dma_buf_ops, and
dma_buf_attach(),dma_buf_detach().
- 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@linaro.org Signed-off-by: Sumit Semwal sumit.semwal@ti.com
<snip>