xref: /rockchip-linux_mpp/osal/mpp_allocator_api.h (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1 /* SPDX-License-Identifier: Apache-2.0 OR MIT */
2 /*
3  * Copyright (c) 2023 Rockchip Electronics Co., Ltd.
4  */
5 
6 #ifndef __MPP_ALLOCATOR_API_H__
7 #define __MPP_ALLOCATOR_API_H__
8 
9 #include "mpp_allocator.h"
10 
11 typedef MPP_RET (*OsAllocatorFunc)(void *ctx, MppBufferInfo *info);
12 
13 typedef struct os_allocator_t {
14     MppBufferType type;
15     const char *name;
16 
17     MPP_RET (*open)(void **ctx, size_t alignment, MppAllocFlagType flags);
18     MPP_RET (*close)(void *ctx);
19 
20     OsAllocatorFunc alloc;
21     OsAllocatorFunc free;
22     OsAllocatorFunc import;
23     OsAllocatorFunc release;
24     OsAllocatorFunc mmap;
25 
26     /* allocator real flag update callback */
27     MppAllocFlagType (*flags)(void *ctx);
28 } os_allocator;
29 
30 #endif /* __MPP_ALLOCATOR_API_H__ */
31