xref: /OK3568_Linux_fs/external/linux-rga/core/RgaApi.cpp (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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 
19 #include "RgaApi.h"
20 
21 #include "RockchipRga.h"
22 
23 #ifdef ANDROID
24 using namespace android;
25 #endif
26 
c_RkRgaInit()27 int c_RkRgaInit() {
28     return 0;
29 }
30 
c_RkRgaDeInit()31 void c_RkRgaDeInit() {}
32 
c_RkRgaGetContext(void ** ctx)33 void c_RkRgaGetContext(void **ctx) {
34     RockchipRga& c_rkRga(RockchipRga::get());
35 
36     c_rkRga.RkRgaGetContext(ctx);
37 }
38 
c_RkRgaBlit(rga_info_t * src,rga_info_t * dst,rga_info_t * src1)39 int c_RkRgaBlit(rga_info_t *src, rga_info_t *dst, rga_info_t *src1) {
40     RockchipRga& c_rkRga(RockchipRga::get());
41 
42     return c_rkRga.RkRgaBlit(src, dst, src1);
43 }
44 
c_RkRgaColorFill(rga_info_t * dst)45 int c_RkRgaColorFill(rga_info_t *dst) {
46     RockchipRga& c_rkRga(RockchipRga::get());
47 
48     return c_rkRga.RkRgaCollorFill(dst);
49 }
50 
c_RkRgaFlush()51 int c_RkRgaFlush() {
52     RockchipRga& c_rkRga(RockchipRga::get());
53 
54     return c_rkRga.RkRgaFlush();
55 }
56 
57 #ifndef ANDROID /* linux */
c_RkRgaGetAllocBuffer(bo_t * bo_info,int width,int height,int bpp)58 int c_RkRgaGetAllocBuffer(bo_t *bo_info, int width, int height, int bpp) {
59     RockchipRga& c_rkRga(RockchipRga::get());
60 
61     return c_rkRga.RkRgaGetAllocBuffer(bo_info, width, height, bpp);
62 }
63 
c_RkRgaGetAllocBufferCache(bo_t * bo_info,int width,int height,int bpp)64 int c_RkRgaGetAllocBufferCache(bo_t *bo_info, int width, int height, int bpp) {
65     RockchipRga& c_rkRga(RockchipRga::get());
66 
67     return c_rkRga.RkRgaGetAllocBufferCache(bo_info, width, height, bpp);
68 }
69 
c_RkRgaGetMmap(bo_t * bo_info)70 int c_RkRgaGetMmap(bo_t *bo_info) {
71     RockchipRga& c_rkRga(RockchipRga::get());
72 
73     return c_rkRga.RkRgaGetMmap(bo_info);
74 }
75 
c_RkRgaUnmap(bo_t * bo_info)76 int c_RkRgaUnmap(bo_t *bo_info) {
77     RockchipRga& c_rkRga(RockchipRga::get());
78 
79     return c_rkRga.RkRgaUnmap(bo_info);
80 }
81 
c_RkRgaFree(bo_t * bo_info)82 int c_RkRgaFree(bo_t *bo_info) {
83     RockchipRga& c_rkRga(RockchipRga::get());
84 
85     return c_rkRga.RkRgaFree(bo_info);
86 }
87 
c_RkRgaGetBufferFd(bo_t * bo_info,int * fd)88 int c_RkRgaGetBufferFd(bo_t *bo_info, int *fd) {
89     RockchipRga& c_rkRga(RockchipRga::get());
90 
91     return c_rkRga.RkRgaGetBufferFd(bo_info, fd);
92 }
93 #endif /* #ifndef Andorid */
94 
95