1 /* 2 * Copyright (C) 2016 Rockchip Electronics Co., Ltd. 3 * Authors: 4 * Zhiqin Wei <wzq@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 #ifndef _rockchip_rga_c_h_ 19 #define _rockchip_rga_c_h_ 20 21 #include <stdint.h> 22 #include <sys/types.h> 23 #include <stdlib.h> 24 #include <stdio.h> 25 #include <string.h> 26 #include <errno.h> 27 #include <time.h> 28 #include <unistd.h> 29 30 #include <sys/mman.h> 31 #include <linux/stddef.h> 32 33 #include "drmrga.h" 34 #include "rga.h" 35 36 #ifdef __cplusplus 37 extern "C"{ 38 #endif 39 40 /* 41 * Compatible with the old version of C interface.The new 42 * version of the C interface no longer requires users to 43 * initialize rga, so RgaInit and RgaDeInit are just for 44 * compatibility with the old C interface, so please do 45 * not use ctx, because it is usually a NULL. 46 */ 47 #define RgaInit(ctx) ({ \ 48 int ret = 0; \ 49 ret = c_RkRgaInit(); \ 50 c_RkRgaGetContext(ctx); \ 51 ret;\ 52 }) 53 #define RgaDeInit(ctx) { \ 54 (void)ctx; /* unused */ \ 55 c_RkRgaDeInit(); \ 56 } 57 #define RgaBlit(...) c_RkRgaBlit(__VA_ARGS__) 58 #define RgaCollorFill(...) c_RkRgaColorFill(__VA_ARGS__) 59 #define RgaFlush() c_RkRgaFlush() 60 61 int c_RkRgaInit(); 62 void c_RkRgaDeInit(); 63 void c_RkRgaGetContext(void **ctx); 64 int c_RkRgaBlit(rga_info_t *src, rga_info_t *dst, rga_info_t *src1); 65 int c_RkRgaColorFill(rga_info_t *dst); 66 int c_RkRgaFlush(); 67 68 #ifndef ANDROID /* linux */ 69 int c_RkRgaGetAllocBuffer(bo_t *bo_info, int width, int height, int bpp); 70 int c_RkRgaGetAllocBufferCache(bo_t *bo_info, int width, int height, int bpp); 71 int c_RkRgaGetMmap(bo_t *bo_info); 72 int c_RkRgaUnmap(bo_t *bo_info); 73 int c_RkRgaFree(bo_t *bo_info); 74 int c_RkRgaGetBufferFd(bo_t *bo_info, int *fd); 75 #endif /* #ifndef ANDROID */ 76 77 #ifdef __cplusplus 78 } 79 #endif 80 81 #endif /* #ifndef _rockchip_rga_c_h_ */ 82