From 1cc1af1b08423364e7fa50c92fedcb983e2c01a7 Mon Sep 17 00:00:00 2001 From: Rimon Xu Date: Thu, 27 Oct 2022 11:38:21 +0800 Subject: [PATCH] [osal]: reorder dma heap type select priority Change-Id: Ifd2286ecf97fb4477693c24cdaec10c1df15eacf Signed-off-by: Rimon Xu --- inc/mpp_buffer.h | 4 +++- osal/allocator/allocator_dma_heap.c | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/inc/mpp_buffer.h b/inc/mpp_buffer.h index fa22e090..110a13ff 100644 --- a/inc/mpp_buffer.h +++ b/inc/mpp_buffer.h @@ -145,11 +145,13 @@ typedef enum { * flags originate from drm_rockchip_gem_mem_type */ -#define MPP_BUFFER_FLAGS_MASK 0x000f0000 //ROCKCHIP_BO_MASK << 16 +#define MPP_BUFFER_FLAGS_MASK 0x003f0000 //ROCKCHIP_BO_MASK << 16 #define MPP_BUFFER_FLAGS_CONTIG 0x00010000 //ROCKCHIP_BO_CONTIG << 16 #define MPP_BUFFER_FLAGS_CACHABLE 0x00020000 //ROCKCHIP_BO_CACHABLE << 16 #define MPP_BUFFER_FLAGS_WC 0x00040000 //ROCKCHIP_BO_WC << 16 #define MPP_BUFFER_FLAGS_SECURE 0x00080000 //ROCKCHIP_BO_SECURE << 16 +#define MPP_BUFFER_FLAGS_ALLOC_KMAP 0x00100000 //ROCKCHIP_BO_ALLOC_KMAP << 16 +#define MPP_BUFFER_FLAGS_DMA32 0x00200000 //ROCKCHIP_BO_DMA32 << 16 /* * MppBufferInfo variable's meaning is different in different MppBufferType diff --git a/osal/allocator/allocator_dma_heap.c b/osal/allocator/allocator_dma_heap.c index 927d9ff5..7e3a6371 100644 --- a/osal/allocator/allocator_dma_heap.c +++ b/osal/allocator/allocator_dma_heap.c @@ -68,20 +68,20 @@ typedef struct { typedef enum DmaHeapType_e { DMA_HEAP_CMA = (1 << 0), DMA_HEAP_CACHABLE = (1 << 1), - DMA_HEAP_DMA64 = (1 << 2), - DMA_HEAP_TYPE_MASK = DMA_HEAP_CMA | DMA_HEAP_CACHABLE | DMA_HEAP_DMA64, + DMA_HEAP_DMA32 = (1 << 2), + DMA_HEAP_TYPE_MASK = DMA_HEAP_CMA | DMA_HEAP_CACHABLE | DMA_HEAP_DMA32, DMA_HEAP_TYPE_NB, } DmaHeapType; static const char *heap_names[] = { - "system-uncached-dma32", /* 0 - default */ + "system-uncached", /* 0 - default */ "cma-uncached", /* 1 - DMA_HEAP_CMA */ - "system-dma32", /* 2 - DMA_HEAP_CACHABLE */ + "system", /* 2 - DMA_HEAP_CACHABLE */ "cma", /* 3 - DMA_HEAP_CACHABLE | DMA_HEAP_CMA */ - "system-uncached", /* 4 - DMA_HEAP_DMA64 */ - "cma-uncached", /* 5 - DMA_HEAP_DMA64 | DMA_HEAP_CMA */ - "system", /* 6 - DMA_HEAP_DMA64 | DMA_HEAP_CACHABLE */ - "cma", /* 7 - DMA_HEAP_DMA64 | DMA_HEAP_CACHABLE | DMA_HEAP_CMA */ + "system-uncached-dma32", /* 4 - DMA_HEAP_DMA32 */ + "cma-uncached", /* 5 - DMA_HEAP_DMA32 | DMA_HEAP_CMA */ + "system-dma32", /* 6 - DMA_HEAP_DMA32 | DMA_HEAP_CACHABLE */ + "cma", /* 7 - DMA_HEAP_DMA32 | DMA_HEAP_CACHABLE | DMA_HEAP_CMA */ }; static int heap_fds[DMA_HEAP_TYPE_NB]; @@ -168,6 +168,9 @@ static MPP_RET os_allocator_dma_heap_open(void **ctx, MppAllocatorCfg *cfg) if (cfg->flags & (MPP_BUFFER_FLAGS_CACHABLE >> 16)) type |= DMA_HEAP_CACHABLE; + if (cfg->flags & (MPP_BUFFER_FLAGS_DMA32 >> 16)) + type |= DMA_HEAP_DMA32; + fd = heap_fd_open(type); if (fd < 0) { mpp_err_f("open dma heap type %x failed!\n", type);