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