refactor[allocator]: Refactor allocator flow

1. Allocator api is determined by buffer type.
2. Allocator ctx is determined by both buffer type and buffer flags.
3. All allocator dma_heap / drm / ion / ext_dma should support different
buffer flags.
4. The buffer flag supports cacheable / 32-bit / contig options.
5. Add flags update flow on allocator create process.
6. Add mpp_dmabuf_has_partial_ops to disable dmabuf partial ops when the
kernel driver has bug.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: If36a05c6704112cad3ab46861023597ff02bf14c
This commit is contained in:
Herman Chen
2023-11-21 18:14:13 +08:00
parent 630bcb9000
commit 6ce3007994
23 changed files with 337 additions and 444 deletions

29
osal/mpp_allocator_api.h Normal file
View File

@@ -0,0 +1,29 @@
/* SPDX-License-Identifier: Apache-2.0 OR MIT */
/*
* Copyright (c) 2023 Rockchip Electronics Co., Ltd.
*/
#ifndef __MPP_ALLOCATOR_API_H__
#define __MPP_ALLOCATOR_API_H__
#include "mpp_allocator.h"
typedef MPP_RET (*OsAllocatorFunc)(void *ctx, MppBufferInfo *info);
typedef struct os_allocator_t {
MppBufferType type;
MPP_RET (*open)(void **ctx, size_t alignment, MppAllocFlagType flags);
MPP_RET (*close)(void *ctx);
OsAllocatorFunc alloc;
OsAllocatorFunc free;
OsAllocatorFunc import;
OsAllocatorFunc release;
OsAllocatorFunc mmap;
/* allocator real flag update callback */
MppAllocFlagType (*flags)(void *ctx);
} os_allocator;
#endif /* __MPP_ALLOCATOR_API_H__ */