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