xref: /OK3568_Linux_fs/external/rockit/tgi/sdk/include/RTSurfaceInterface.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2019 Rockchip Electronics Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * author: rimon.xu@rock-chips.com
17  *              fxw@rock-chips.com
18  *   date: 2020-04-27
19  */
20 
21 #ifndef INCLUDE_RT_PLAYER_RTSURFACEINTERFACE_H_
22 #define INCLUDE_RT_PLAYER_RTSURFACEINTERFACE_H_
23 
24 #include <sys/types.h>
25 #include <inttypes.h>
26 #include "rt_type.h"   // NOLINT
27 
28 typedef struct RT_NATIVEWINDOW_BUFFER_INFO {
29     INT32           dupFd;
30     INT32           name;   // this name can be used by other process
31     INT32           size;
32     unsigned long   phyAddr;  // NOLINT
33     void           *graphicBuffer;
34     void           *window;
35     void           *windowBuf;
36 } RTNativeWindowBufferInfo;
37 
38 typedef struct RT_SIDEBAND_INFO {
39     INT32 structSize;
40     INT32 structVersion;
41     INT32 left;
42     INT32 top;
43     INT32 right;
44     INT32 bottom;
45     INT32 usage;
46     INT32 width;
47     INT32 height;
48     INT32 format;
49     INT32 dataSpace;
50     INT32 transform;
51 } RTSidebandInfo;
52 
53 class RTSurfaceInterface {
54  public:
~RTSurfaceInterface()55     virtual ~RTSurfaceInterface() {}
56 
57     virtual INT32 connect(INT32 mode) = 0;
58     virtual INT32 disconnect(INT32 mode) = 0;
59 
60     virtual INT32 allocateBuffer(RTNativeWindowBufferInfo *info) = 0;
61     virtual INT32 freeBuffer(void *buf, INT32 fence) = 0;
62     virtual INT32 remainBuffer(void *buf, INT32 fence) = 0;
63     virtual INT32 queueBuffer(void *buf, INT32 fence) = 0;
64     virtual INT32 dequeueBuffer(void **buf) = 0;
65     virtual INT32 dequeueBufferAndWait(RTNativeWindowBufferInfo *info) = 0;
66     virtual INT32 mmapBuffer(RTNativeWindowBufferInfo *info, void **ptr) = 0;
67     virtual INT32 munmapBuffer(void **ptr, INT32 size, void *buf) = 0;
68 
69     virtual INT32 setCrop(INT32 left, INT32 top, INT32 right, INT32 bottom) = 0;
70     virtual INT32 setUsage(INT32 usage) = 0;
71     virtual INT32 setScalingMode(INT32 mode) = 0;
72     virtual INT32 setDataSpace(INT32 dataSpace) = 0;
73     virtual INT32 setTransform(INT32 transform) = 0;
74     virtual INT32 setSwapInterval(INT32 interval) = 0;
75     virtual INT32 setBufferCount(INT32 bufferCount) = 0;
76     virtual INT32 setBufferGeometry(INT32 width, INT32 height, INT32 format) = 0;
77     virtual INT32 setSidebandStream(RTSidebandInfo info) = 0;
78 
79     virtual INT32 query(INT32 cmd, INT32 *param) = 0;
80     virtual void* getNativeWindow() = 0;
81 };
82 
83 
84 #endif  // INCLUDE_RT_PLAYER_RTSURFACEINTERFACE_H_
85 
86