* [PATCH] dma-buf: heap-helpers: Set dma-buf exporter name
@ 2020-08-14 14:25 ` Ezequiel Garcia
0 siblings, 0 replies; 6+ messages in thread
From: Ezequiel Garcia @ 2020-08-14 14:25 UTC (permalink / raw)
To: linux-media, dri-devel
Cc: Sumit Semwal, Andrew F . Davis, Benjamin Gaignard, Liam Mark,
Laura Abbott, Brian Starkey, John Stultz, Ezequiel Garcia,
kernel
Currently the heap helper uses DEFINE_DMA_BUF_EXPORT_INFO,
which uses KBUILD_MODNAME for the dma_buf_export_info.exp_name.
This effectively makes all dma-bufs exported by the heap
helper as coming from "heap-helpers", instead of the actual heap name
(cma, system, etc).
Fix this by adding a dma-heap name getter, and then setting
dma_buf_export_info.exp_name.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
drivers/dma-buf/dma-heap.c | 5 +++++
drivers/dma-buf/heaps/heap-helpers.c | 1 +
include/linux/dma-heap.h | 2 ++
3 files changed, 8 insertions(+)
diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
index afd22c9dbdcf..13d001ee381a 100644
--- a/drivers/dma-buf/dma-heap.c
+++ b/drivers/dma-buf/dma-heap.c
@@ -190,6 +190,11 @@ void *dma_heap_get_drvdata(struct dma_heap *heap)
return heap->priv;
}
+const char *dma_heap_get_name(struct dma_heap *heap)
+{
+ return heap->name;
+}
+
struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info)
{
struct dma_heap *heap, *h, *err_ret;
diff --git a/drivers/dma-buf/heaps/heap-helpers.c b/drivers/dma-buf/heaps/heap-helpers.c
index 9f964ca3f59c..47ecf9518442 100644
--- a/drivers/dma-buf/heaps/heap-helpers.c
+++ b/drivers/dma-buf/heaps/heap-helpers.c
@@ -30,6 +30,7 @@ struct dma_buf *heap_helper_export_dmabuf(struct heap_helper_buffer *buffer,
{
DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
+ exp_info.exp_name = dma_heap_get_name(buffer->heap);
exp_info.ops = &heap_helper_ops;
exp_info.size = buffer->size;
exp_info.flags = fd_flags;
diff --git a/include/linux/dma-heap.h b/include/linux/dma-heap.h
index 454e354d1ffb..0acf7e71afb5 100644
--- a/include/linux/dma-heap.h
+++ b/include/linux/dma-heap.h
@@ -50,6 +50,8 @@ struct dma_heap_export_info {
*/
void *dma_heap_get_drvdata(struct dma_heap *heap);
+const char *dma_heap_get_name(struct dma_heap *heap);
+
/**
* dma_heap_add - adds a heap to dmabuf heaps
* @exp_info: information needed to register this heap
--
2.27.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] dma-buf: heap-helpers: Set dma-buf exporter name
@ 2020-08-14 14:25 ` Ezequiel Garcia
0 siblings, 0 replies; 6+ messages in thread
From: Ezequiel Garcia @ 2020-08-14 14:25 UTC (permalink / raw)
To: linux-media, dri-devel
Cc: kernel, Liam Mark, Laura Abbott, Andrew F . Davis, Ezequiel Garcia
Currently the heap helper uses DEFINE_DMA_BUF_EXPORT_INFO,
which uses KBUILD_MODNAME for the dma_buf_export_info.exp_name.
This effectively makes all dma-bufs exported by the heap
helper as coming from "heap-helpers", instead of the actual heap name
(cma, system, etc).
Fix this by adding a dma-heap name getter, and then setting
dma_buf_export_info.exp_name.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
drivers/dma-buf/dma-heap.c | 5 +++++
drivers/dma-buf/heaps/heap-helpers.c | 1 +
include/linux/dma-heap.h | 2 ++
3 files changed, 8 insertions(+)
diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
index afd22c9dbdcf..13d001ee381a 100644
--- a/drivers/dma-buf/dma-heap.c
+++ b/drivers/dma-buf/dma-heap.c
@@ -190,6 +190,11 @@ void *dma_heap_get_drvdata(struct dma_heap *heap)
return heap->priv;
}
+const char *dma_heap_get_name(struct dma_heap *heap)
+{
+ return heap->name;
+}
+
struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info)
{
struct dma_heap *heap, *h, *err_ret;
diff --git a/drivers/dma-buf/heaps/heap-helpers.c b/drivers/dma-buf/heaps/heap-helpers.c
index 9f964ca3f59c..47ecf9518442 100644
--- a/drivers/dma-buf/heaps/heap-helpers.c
+++ b/drivers/dma-buf/heaps/heap-helpers.c
@@ -30,6 +30,7 @@ struct dma_buf *heap_helper_export_dmabuf(struct heap_helper_buffer *buffer,
{
DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
+ exp_info.exp_name = dma_heap_get_name(buffer->heap);
exp_info.ops = &heap_helper_ops;
exp_info.size = buffer->size;
exp_info.flags = fd_flags;
diff --git a/include/linux/dma-heap.h b/include/linux/dma-heap.h
index 454e354d1ffb..0acf7e71afb5 100644
--- a/include/linux/dma-heap.h
+++ b/include/linux/dma-heap.h
@@ -50,6 +50,8 @@ struct dma_heap_export_info {
*/
void *dma_heap_get_drvdata(struct dma_heap *heap);
+const char *dma_heap_get_name(struct dma_heap *heap);
+
/**
* dma_heap_add - adds a heap to dmabuf heaps
* @exp_info: information needed to register this heap
--
2.27.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] dma-buf: heap-helpers: Set dma-buf exporter name
2020-08-14 14:25 ` Ezequiel Garcia
@ 2020-08-15 2:19 ` John Stultz
-1 siblings, 0 replies; 6+ messages in thread
From: John Stultz @ 2020-08-15 2:19 UTC (permalink / raw)
To: Ezequiel Garcia
Cc: linux-media, dri-devel, Sumit Semwal, Andrew F . Davis,
Benjamin Gaignard, Liam Mark, Laura Abbott, Brian Starkey,
kernel
On Fri, Aug 14, 2020 at 7:25 AM Ezequiel Garcia <ezequiel@collabora.com> wrote:
>
> Currently the heap helper uses DEFINE_DMA_BUF_EXPORT_INFO,
> which uses KBUILD_MODNAME for the dma_buf_export_info.exp_name.
>
> This effectively makes all dma-bufs exported by the heap
> helper as coming from "heap-helpers", instead of the actual heap name
> (cma, system, etc).
>
> Fix this by adding a dma-heap name getter, and then setting
> dma_buf_export_info.exp_name.
>
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Untested, but looks sane to me.
Acked-by: John Stultz <john.stultz@linaro.org>
On a slightly related note, I'm starting to regret the current
heap-helpers approach (Andrew probably gets an "I told you so" there
:). While it avoids a lot of duplication, it's really an all or
nothing approach, and doesn't really compare well to other drm style
helper functions. I may eventually try to break the system and cma
implementations out of the helper code and try to consider a different
approach to avoid the duplication.
thanks
-john
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] dma-buf: heap-helpers: Set dma-buf exporter name
@ 2020-08-15 2:19 ` John Stultz
0 siblings, 0 replies; 6+ messages in thread
From: John Stultz @ 2020-08-15 2:19 UTC (permalink / raw)
To: Ezequiel Garcia
Cc: Liam Mark, Andrew F . Davis, dri-devel, Laura Abbott, kernel,
linux-media
On Fri, Aug 14, 2020 at 7:25 AM Ezequiel Garcia <ezequiel@collabora.com> wrote:
>
> Currently the heap helper uses DEFINE_DMA_BUF_EXPORT_INFO,
> which uses KBUILD_MODNAME for the dma_buf_export_info.exp_name.
>
> This effectively makes all dma-bufs exported by the heap
> helper as coming from "heap-helpers", instead of the actual heap name
> (cma, system, etc).
>
> Fix this by adding a dma-heap name getter, and then setting
> dma_buf_export_info.exp_name.
>
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Untested, but looks sane to me.
Acked-by: John Stultz <john.stultz@linaro.org>
On a slightly related note, I'm starting to regret the current
heap-helpers approach (Andrew probably gets an "I told you so" there
:). While it avoids a lot of duplication, it's really an all or
nothing approach, and doesn't really compare well to other drm style
helper functions. I may eventually try to break the system and cma
implementations out of the helper code and try to consider a different
approach to avoid the duplication.
thanks
-john
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] dma-buf: heap-helpers: Set dma-buf exporter name
2020-08-15 2:19 ` John Stultz
@ 2020-08-15 3:04 ` Ezequiel Garcia
-1 siblings, 0 replies; 6+ messages in thread
From: Ezequiel Garcia @ 2020-08-15 3:04 UTC (permalink / raw)
To: John Stultz
Cc: Ezequiel Garcia, Liam Mark, Andrew F . Davis, dri-devel,
Laura Abbott, kernel, linux-media
On Fri, 14 Aug 2020 at 23:20, John Stultz <john.stultz@linaro.org> wrote:
>
> On Fri, Aug 14, 2020 at 7:25 AM Ezequiel Garcia <ezequiel@collabora.com> wrote:
> >
> > Currently the heap helper uses DEFINE_DMA_BUF_EXPORT_INFO,
> > which uses KBUILD_MODNAME for the dma_buf_export_info.exp_name.
> >
> > This effectively makes all dma-bufs exported by the heap
> > helper as coming from "heap-helpers", instead of the actual heap name
> > (cma, system, etc).
> >
> > Fix this by adding a dma-heap name getter, and then setting
> > dma_buf_export_info.exp_name.
> >
> > Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
>
> Untested, but looks sane to me.
>
> Acked-by: John Stultz <john.stultz@linaro.org>
>
Cool.
> On a slightly related note, I'm starting to regret the current
> heap-helpers approach (Andrew probably gets an "I told you so" there
> :). While it avoids a lot of duplication, it's really an all or
> nothing approach, and doesn't really compare well to other drm style
> helper functions. I may eventually try to break the system and cma
> implementations out of the helper code and try to consider a different
> approach to avoid the duplication.
>
Fully agreed :-) It definitely looks too rigid right now.
Cheers,
Ezequiel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] dma-buf: heap-helpers: Set dma-buf exporter name
@ 2020-08-15 3:04 ` Ezequiel Garcia
0 siblings, 0 replies; 6+ messages in thread
From: Ezequiel Garcia @ 2020-08-15 3:04 UTC (permalink / raw)
To: John Stultz
Cc: Liam Mark, dri-devel, Andrew F . Davis, Laura Abbott, kernel,
Ezequiel Garcia, linux-media
On Fri, 14 Aug 2020 at 23:20, John Stultz <john.stultz@linaro.org> wrote:
>
> On Fri, Aug 14, 2020 at 7:25 AM Ezequiel Garcia <ezequiel@collabora.com> wrote:
> >
> > Currently the heap helper uses DEFINE_DMA_BUF_EXPORT_INFO,
> > which uses KBUILD_MODNAME for the dma_buf_export_info.exp_name.
> >
> > This effectively makes all dma-bufs exported by the heap
> > helper as coming from "heap-helpers", instead of the actual heap name
> > (cma, system, etc).
> >
> > Fix this by adding a dma-heap name getter, and then setting
> > dma_buf_export_info.exp_name.
> >
> > Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
>
> Untested, but looks sane to me.
>
> Acked-by: John Stultz <john.stultz@linaro.org>
>
Cool.
> On a slightly related note, I'm starting to regret the current
> heap-helpers approach (Andrew probably gets an "I told you so" there
> :). While it avoids a lot of duplication, it's really an all or
> nothing approach, and doesn't really compare well to other drm style
> helper functions. I may eventually try to break the system and cma
> implementations out of the helper code and try to consider a different
> approach to avoid the duplication.
>
Fully agreed :-) It definitely looks too rigid right now.
Cheers,
Ezequiel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-08-17 7:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-14 14:25 [PATCH] dma-buf: heap-helpers: Set dma-buf exporter name Ezequiel Garcia
2020-08-14 14:25 ` Ezequiel Garcia
2020-08-15 2:19 ` John Stultz
2020-08-15 2:19 ` John Stultz
2020-08-15 3:04 ` Ezequiel Garcia
2020-08-15 3:04 ` Ezequiel Garcia
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.