xref: /OK3568_Linux_fs/external/linux-rga/samples/utils/allocator/include/drm_alloc.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (C) 2022  Rockchip Electronics Co., Ltd.
3  * Authors:
4  *     Randall zhuo <randall.zhuo@rock-chips.com>
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef __RGA_SAMPLES_ALLOCATOR_DRM_ALLOC_H__
20 #define __RGA_SAMPLES_ALLOCATOR_DRM_ALLOC_H__
21 
22 /* memory type definitions. */
23 enum drm_rockchip_gem_mem_type
24 {
25     /* Physically Continuous memory and used as default. */
26     ROCKCHIP_BO_CONTIG = 1 << 0,
27     /* cachable mapping. */
28     ROCKCHIP_BO_CACHABLE = 1 << 1,
29     /* write-combine mapping. */
30     ROCKCHIP_BO_WC = 1 << 2,
31     ROCKCHIP_BO_SECURE = 1 << 3,
32     ROCKCHIP_BO_MASK = ROCKCHIP_BO_CONTIG | ROCKCHIP_BO_CACHABLE |
33                        ROCKCHIP_BO_WC | ROCKCHIP_BO_SECURE
34 };
35 
36 void* drm_buf_alloc(int TexWidth, int TexHeight,int bpp, int *fd, int *handle, size_t *actual_size, int flags = 0);
37 int drm_buf_destroy(int buf_fd, int handle, void *drm_buf, size_t size);
38 uint32_t drm_buf_get_phy(int handle);
39 
40 #endif /* #ifndef __RGA_SAMPLES_ALLOCATOR_DRM_ALLOC_H__ */
41