[EARLY RFC][PATCH] dma-buf: Add dma-buf heaps framework
John Stultz
john.stultz at linaro.org
Tue Feb 26 00:55:45 UTC 2019
On Mon, Feb 25, 2019 at 6:36 AM Andrew F. Davis <afd at ti.com> wrote:
> +static int dma_heap_buffer_alloc(struct dma_heap *heap, size_t len, unsigned int flags)
> +{
> + struct dma_heap_buffer *buffer;
> + int fd, ret;
> +
> + buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
> + if (!buffer)
> + return -ENOMEM;
> +
> + buffer->heap = heap;
> + ret = heap->ops->allocate(heap, buffer, len, flags);
> + if (ret) {
> + kfree(buffer);
> + return ret;
> + }
Similarly, I think the struct dma_heap_buffer, should be allocated and
returned by the heap's allocate function.
That way it can allocate its own larger structure (with the
dma_heap_buffer as part of it) with private fields, and use
container_of() to traverse from the buffer to the private data.
Once I get things building, I'll share my changes.
thanks
-john
More information about the dri-devel
mailing list