John Stultz
e09764eb7d
BACKPORT: FROMLIST: dma-buf: dma-heap: Provide accessor to get heap name
...
It can be useful to access the name for the heap,
so provide an accessor to do so.
Cc: Daniel Vetter <daniel@ffwll.ch >
Cc: Sumit Semwal <sumit.semwal@linaro.org >
Cc: Liam Mark <lmark@codeaurora.org >
Cc: Chris Goldsworthy <cgoldswo@codeaurora.org >
Cc: Laura Abbott <labbott@kernel.org >
Cc: Brian Starkey <Brian.Starkey@arm.com >
Cc: Hridya Valsaraju <hridya@google.com >
Cc: Suren Baghdasaryan <surenb@google.com >
Cc: Sandeep Patil <sspatil@google.com >
Cc: Daniel Mentz <danielmentz@google.com >
Cc: Ørjan Eide <orjan.eide@arm.com >
Cc: Robin Murphy <robin.murphy@arm.com >
Cc: Ezequiel Garcia <ezequiel@collabora.com >
Cc: Simon Ser <contact@emersion.fr >
Cc: James Jones <jajones@nvidia.com >
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: John Stultz <john.stultz@linaro.org >
[jstultz: Minor collision resolution w/ conflict in common.git]
Link: https://lore.kernel.org/lkml/20210209194818.2459062-1-john.stultz@linaro.org/
Bug: 167709539
Change-Id: I3d2126118336077ab1caa2b9312c94cb146dd194
2021-02-10 19:42:19 +00:00
Hridya Valsaraju
9419dd1656
ANDROID: dma-buf: heaps: Add a sysfs file to report total pool size.
...
In order to help with memory accounting, expose the total pool size of
all DMA-BUF heaps at /sys/kernel/dma_heap/total_pools_kb.
This information will be exposed as part of Android Bugreport[1].
[1]: https://android-review.googlesource.com/q/topic:%22b%252F167709539%22+(status:open%20OR%20status:merged)
Bug: 167709539
Change-Id: I6a1b52517e73103122690f6567f4f295db9ca1ad
Signed-off-by: Hridya Valsaraju <hridya@google.com >
2021-02-03 21:04:43 -08:00
John Stultz
c8bdd32555
FROMLIST: dma-buf: dma-heap: Keep track of the heap device struct
...
Keep track of the heap device struct.
This will be useful for special DMA allocations
and actions.
Signed-off-by: John Stultz <john.stultz@linaro.org >
Link: https://lore.kernel.org/lkml/20201110034934.70898-7-john.stultz@linaro.org/
Bug: 170887642
Change-Id: I55b8df5fd9fd46795a8f0171318895297d2dd379
2020-12-14 23:23:26 +00:00
John Stultz
8e1ec97355
ANDROID: dma-heap: Provide accessors so that in-kernel drivers can allocate dmabufs from specific heaps
...
This allows drivers who don't want to create their own
DMA-BUF exporter to be able to allocate DMA-BUFs directly
from existing DMA-BUF Heaps.
There is some concern that the premise of DMA-BUF heaps is
that userland knows better about what type of heap memory
is needed for a pipeline, so it would likely be best for
drivers to import and fill DMA-BUFs allocated by userland
instead of allocating one themselves, but this is still
up for debate.
Unfortunately we don't have any public users of this, so
we cannot push it upstream. However, vendors have asked
for this, so I'm submitting it to Andorid Common in the
hopes that we can eventually find what vendors are doing.
Signed-off-by: John Stultz <john.stultz@linaro.org >
Change-Id: I7b5ef690cefd2bfbbc2e01220ada49e44ef4fa04
Bug: 154341375
2020-08-21 20:24:29 +00:00
John Stultz
349e8360c9
ANDROID: dma-heap: Rework allocation calls to return struct dma_buf instead of fd
...
While most uses will want to allocate a fd for a dmabuf, there
are some cases where it might be useful to have just a dma_buf structure.
So refactor the heap allocaiton functions to return a struct dma_buf
and add a dma_heap_bufferfd_alloc() function to convert that return a fd.
Signed-off-by: John Stultz <john.stultz@linaro.org >
Change-Id: Id6fd7e8471b9555a08bcdf8ca210feb589fa51c1
Bug: 154341375
2020-08-21 20:24:29 +00:00
John Stultz
c700bdd223
ANDROID: dma-heap: Add proper kref handling on dma-buf heaps
...
Add proper refcounting on the dma_heap structure.
While existing heaps are built-in, we may eventually
have heaps loaded from modules, and we'll need to be
able to properly handle the references to the heaps
Also moves minor tracking into the heap structure so
we can properly free things.
Cc: Sumit Semwal <sumit.semwal@linaro.org >
Cc: Andrew F. Davis <afd@ti.com >
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org >
Cc: Liam Mark <lmark@codeaurora.org >
Cc: Laura Abbott <labbott@kernel.org >
Cc: Brian Starkey <Brian.Starkey@arm.com >
Cc: Hridya Valsaraju <hridya@google.com >
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: John Stultz <john.stultz@linaro.org >
Change-Id: I9f9e27f640c926882a639d6ad5dc3019d7e2c2b0
Link: https://lore.kernel.org/lkml/20200725032633.125006-1-john.stultz@linaro.org/T/#u
Bug: 154341375
---
v2: Fix potential race with kref_put being called while another
cpu was scanning the list to take a ref, pointed out by
Hridya
2020-08-21 20:24:29 +00:00
Andrew F. Davis
c02a81fba7
dma-buf: Add dma-buf heaps framework
...
This framework allows a unified userspace interface for dma-buf
exporters, allowing userland to allocate specific types of memory
for use in dma-buf sharing.
Each heap is given its own device node, which a user can allocate
a dma-buf fd from using the DMA_HEAP_IOC_ALLOC.
This code is an evoluiton of the Android ION implementation,
and a big thanks is due to its authors/maintainers over time
for their effort:
Rebecca Schultz Zavin, Colin Cross, Benjamin Gaignard,
Laura Abbott, and many other contributors!
Cc: Laura Abbott <labbott@redhat.com >
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org >
Cc: Sumit Semwal <sumit.semwal@linaro.org >
Cc: Liam Mark <lmark@codeaurora.org >
Cc: Pratik Patel <pratikp@codeaurora.org >
Cc: Brian Starkey <Brian.Starkey@arm.com >
Cc: Vincent Donnefort <Vincent.Donnefort@arm.com >
Cc: Sudipto Paul <Sudipto.Paul@arm.com >
Cc: Andrew F. Davis <afd@ti.com >
Cc: Christoph Hellwig <hch@infradead.org >
Cc: Chenbo Feng <fengc@google.com >
Cc: Alistair Strachan <astrachan@google.com >
Cc: Hridya Valsaraju <hridya@google.com >
Cc: Sandeep Patil <sspatil@google.com >
Cc: Hillf Danton <hdanton@sina.com >
Cc: Dave Airlie <airlied@gmail.com >
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Brian Starkey <brian.starkey@arm.com >
Acked-by: Sandeep Patil <sspatil@android.com >
Signed-off-by: Andrew F. Davis <afd@ti.com >
Signed-off-by: John Stultz <john.stultz@linaro.org >
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-2-john.stultz@linaro.org
2019-12-11 11:13:33 +05:30
Sean Paul
fae7d7d5f3
Revert "dma-buf: Add dma-buf heaps framework"
...
This reverts commit a69b0e855d
.
This patchset doesn't meet the UAPI requirements set out in [1] for the DRM
subsystem. Once the userspace component is reviewed and ready for merge
we can try again.
[1]- https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements
Fixes: a69b0e855d
("dma-buf: Add dma-buf heaps framework")
Cc: Laura Abbott <labbott@redhat.com >
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org >
Cc: Sumit Semwal <sumit.semwal@linaro.org >
Cc: Liam Mark <lmark@codeaurora.org >
Cc: Pratik Patel <pratikp@codeaurora.org >
Cc: Brian Starkey <Brian.Starkey@arm.com >
Cc: Vincent Donnefort <Vincent.Donnefort@arm.com >
Cc: Sudipto Paul <Sudipto.Paul@arm.com >
Cc: Andrew F. Davis <afd@ti.com >
Cc: Christoph Hellwig <hch@infradead.org >
Cc: Chenbo Feng <fengc@google.com >
Cc: Alistair Strachan <astrachan@google.com >
Cc: Hridya Valsaraju <hridya@google.com >
Cc: Hillf Danton <hdanton@sina.com >
Cc: dri-devel@lists.freedesktop.org
Cc: Brian Starkey <brian.starkey@arm.com >
Cc: John Stultz <john.stultz@linaro.org >
Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Rob Herring <robh@kernel.org >
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Cc: "Paul E. McKenney" <paulmck@linux.ibm.com >
Cc: Sean Paul <seanpaul@chromium.org >
Cc: "Andrew F. Davis" <afd@ti.com >
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Acked-by: David Airlie <airlied@linux.ie >
Signed-off-by: Sean Paul <sean@poorly.run >
Link: https://patchwork.freedesktop.org/patch/msgid/20191030203003.101156-6-sean@poorly.run
2019-10-30 16:41:49 -04:00
Andrew F. Davis
a69b0e855d
dma-buf: Add dma-buf heaps framework
...
This framework allows a unified userspace interface for dma-buf
exporters, allowing userland to allocate specific types of memory
for use in dma-buf sharing.
Each heap is given its own device node, which a user can allocate
a dma-buf fd from using the DMA_HEAP_IOC_ALLOC.
This code is an evoluiton of the Android ION implementation,
and a big thanks is due to its authors/maintainers over time
for their effort:
Rebecca Schultz Zavin, Colin Cross, Benjamin Gaignard,
Laura Abbott, and many other contributors!
Cc: Laura Abbott <labbott@redhat.com >
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org >
Cc: Sumit Semwal <sumit.semwal@linaro.org >
Cc: Liam Mark <lmark@codeaurora.org >
Cc: Pratik Patel <pratikp@codeaurora.org >
Cc: Brian Starkey <Brian.Starkey@arm.com >
Cc: Vincent Donnefort <Vincent.Donnefort@arm.com >
Cc: Sudipto Paul <Sudipto.Paul@arm.com >
Cc: Andrew F. Davis <afd@ti.com >
Cc: Christoph Hellwig <hch@infradead.org >
Cc: Chenbo Feng <fengc@google.com >
Cc: Alistair Strachan <astrachan@google.com >
Cc: Hridya Valsaraju <hridya@google.com >
Cc: Hillf Danton <hdanton@sina.com >
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org >
Reviewed-by: Brian Starkey <brian.starkey@arm.com >
Acked-by: Laura Abbott <labbott@redhat.com >
Tested-by: Ayan Kumar Halder <ayan.halder@arm.com >
Signed-off-by: Andrew F. Davis <afd@ti.com >
Signed-off-by: John Stultz <john.stultz@linaro.org >
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20191021190310.85221-2-john.stultz@linaro.org
2019-10-25 17:01:45 +05:30