[allocator]: Add dma_heap allocator

The dma_heap is introduced in kernel 5.10.

Change-Id: Id3c116d996da461467fe380a79434ba5ea875033
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2022-06-22 17:42:17 +08:00
parent 8e15a4a492
commit 60f5fc234a
7 changed files with 379 additions and 8 deletions

View File

@@ -18,6 +18,7 @@
#include "mpp_log.h"
#include "mpp_runtime.h"
#include "allocator_dma_heap.h"
#include "allocator_drm.h"
#include "allocator_ext_dma.h"
#include "allocator_ion.h"
@@ -37,6 +38,7 @@ MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
} break;
case MPP_BUFFER_TYPE_ION : {
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DMA_HEAP)) ? allocator_dma_heap :
#if HAVE_DRM
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
#endif
@@ -46,14 +48,16 @@ MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
*api = allocator_ext_dma;
} break;
case MPP_BUFFER_TYPE_DRM : {
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DMA_HEAP)) ? allocator_dma_heap :
#if HAVE_DRM
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
#else
* api =
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
#endif
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
allocator_std;
} break;
case MPP_BUFFER_TYPE_DMA_HEAP: {
*api = allocator_dma_heap;
} break;
default : {
ret = MPP_NOK;
} break;