ANDROID: dma-heap: add vendor hook for dma heap alloc

Add start/end tracepoints around the allocate dma_heap_op call.

Bug: 351175506
Change-Id: Iaff719c6b7a64ac05236990e1194f51cbb10448b
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
This commit is contained in:
Sooyong Suk
2024-08-02 17:54:45 +09:00
committed by Suren Baghdasaryan
parent ce2b5c7bca
commit 17fcda65fd
3 changed files with 18 additions and 1 deletions
+9 -1
View File
@@ -17,6 +17,7 @@
#include <linux/uaccess.h>
#include <linux/xarray.h>
#include <uapi/linux/dma-heap.h>
#include <trace/hooks/dmabuf.h>
#define DEVNAME "dma_heap"
@@ -79,6 +80,8 @@ struct dma_buf *dma_heap_buffer_alloc(struct dma_heap *heap, size_t len,
u32 fd_flags,
u64 heap_flags)
{
struct dma_buf *dma_buf;
if (fd_flags & ~DMA_HEAP_VALID_FD_FLAGS)
return ERR_PTR(-EINVAL);
@@ -92,7 +95,12 @@ struct dma_buf *dma_heap_buffer_alloc(struct dma_heap *heap, size_t len,
if (!len)
return ERR_PTR(-EINVAL);
return heap->ops->allocate(heap, len, fd_flags, heap_flags);
trace_android_vh_dma_heap_buffer_alloc_start(heap->name, len,
fd_flags, heap_flags);
dma_buf = heap->ops->allocate(heap, len, fd_flags, heap_flags);
trace_android_vh_dma_heap_buffer_alloc_end(heap->name, len);
return dma_buf;
}
EXPORT_SYMBOL_GPL(dma_heap_buffer_alloc);