RK3368 GPU version Rogue M 1.28
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue_m / services / include / rgxapi_km.h
1 /*************************************************************************/ /*!
2 @File
3 @Title          RGX API Header kernel mode
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description    Exported RGX API details
6 @License        Dual MIT/GPLv2
7
8 The contents of this file are subject to the MIT license as set out below.
9
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 Alternatively, the contents of this file may be used under the terms of
21 the GNU General Public License Version 2 ("GPL") in which case the provisions
22 of GPL are applicable instead of those above.
23
24 If you wish to allow use of your version of this file only under the terms of
25 GPL, and not to allow others to use your version of this file under the terms
26 of the MIT license, indicate your decision by deleting the provisions above
27 and replace them with the notice and other provisions required by GPL as set
28 out in the file called "GPL-COPYING" included in this distribution. If you do
29 not delete the provisions above, a recipient may use your version of this file
30 under the terms of either the MIT license or GPL.
31
32 This License is also included in this distribution in the file called
33 "MIT-COPYING".
34
35 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
36 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
37 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
38 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
39 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
40 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
41 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 */ /**************************************************************************/
43
44 #ifndef __RGXAPI_KM_H__
45 #define __RGXAPI_KM_H__
46
47 #if defined(SUPPORT_SHARED_SLC)
48 /*!
49 ******************************************************************************
50
51  @Function      RGXInitSLC
52
53  @Description Init the SLC after a power up. It is required to call this 
54               function if using SUPPORT_SHARED_SLC. Otherwise, it shouldn't
55                           be called.
56
57  @Input    hDevHandle : RGX Device Node
58
59  @Return   PVRSRV_ERROR :
60
61 ******************************************************************************/
62 PVRSRV_ERROR RGXInitSLC(IMG_HANDLE hDevHandle);
63 #endif
64
65 #if defined(SUPPORT_KERNEL_HWPERF)
66
67 #include "rgx_hwperf_km.h"
68
69
70 /******************************************************************************
71  * RGX HW Performance Profiling Control API(s)
72  *****************************************************************************/
73
74 /**************************************************************************/ /*!
75 @Function      RGXHWPerfConnect
76 @Description   Obtain a connection object to the HWPerf device
77 @Output        phDevData      Address of a handle to a connection object
78 @Return        PVRSRV_ERROR:  for system error codes
79 */ /***************************************************************************/
80 PVRSRV_ERROR RGXHWPerfConnect(
81                 IMG_HANDLE* phDevData);
82
83
84 /**************************************************************************/ /*!
85 @Function       RGXHWPerfDisconnect
86 @Description    Disconnect from the HWPerf device
87 @Input          hSrvHandle    Handle to connection object as returned from
88                                 RGXHWPerfConnect()
89 @Return         PVRSRV_ERROR: for system error codes
90 */ /***************************************************************************/
91 PVRSRV_ERROR RGXHWPerfDisconnect(
92                 IMG_HANDLE hDevData);
93
94
95 /**************************************************************************/ /*!
96 @Function       RGXHWPerfControl
97 @Description    Enable or disable the generation of RGX HWPerf event packets.
98                  See RGXCtrlHWPerf().
99 @Input          hDevData         Handle to connection object
100 @Input          bToggle          Switch to toggle or apply mask.
101 @Input          ui64Mask         Mask of events to control.
102 @Return         PVRSRV_ERROR:    for system error codes
103 */ /***************************************************************************/
104 PVRSRV_ERROR IMG_CALLCONV RGXHWPerfControl(
105                 IMG_HANDLE  hDevData,
106                 IMG_BOOL    bToggle,
107                 IMG_UINT64  ui64Mask);
108
109
110 /**************************************************************************/ /*!
111 @Function       RGXHWPerfConfigureAndEnableCounters
112 @Description    Enable and configure the performance counter block for
113                  one or more device layout modules.
114                  See RGXConfigureAndEnableHWPerfCounters().
115 @Input          hDevData         Handle to connection object
116 @Input          ui32NumBlocks    Number of elements in the array
117 @Input          asBlockConfigs   Address of the array of configuration blocks
118 @Return         PVRSRV_ERROR:    for system error codes
119 */ /***************************************************************************/
120 PVRSRV_ERROR IMG_CALLCONV RGXHWPerfConfigureAndEnableCounters(
121                 IMG_HANDLE                 hDevData,
122                 IMG_UINT32                 ui32NumBlocks,
123                 RGX_HWPERF_CONFIG_CNTBLK*  asBlockConfigs);
124
125
126 /**************************************************************************/ /*!
127 @Function       RGXDisableHWPerfCounters
128 @Description    Disable the performance counter block for one or more
129                  device layout modules. See RGXDisableHWPerfCounters().
130 @Input          hDevData        Handle to connection/device object
131 @Input          ui32NumBlocks   Number of elements in the array
132 @Input          aeBlockIDs      An array of bytes with values taken from
133                                  the RGX_HWPERF_CNTBLK_ID enumeration.
134 @Return         PVRSRV_ERROR:   for system error codes
135 */ /***************************************************************************/
136 PVRSRV_ERROR IMG_CALLCONV RGXHWPerfDisableCounters(
137                 IMG_HANDLE   hDevData,
138                 IMG_UINT32   ui32NumBlocks,
139                 IMG_UINT16*   aeBlockIDs);
140
141
142 /******************************************************************************
143  * RGX HW Performance Profiling Retrieval API(s)
144  *
145  * The client must ensure their use of this acquire/release API for a single 
146  * connection/stream must not be shared with multiple execution contexts e.g.
147  * between a kernel thread and an ISR handler. It is the client’s
148  * responsibility to ensure this API is not interrupted by a high priority
149  * thread/ISR
150  *****************************************************************************/
151
152 /**************************************************************************/ /*!
153 @Function       RGXHWPerfAcquireData
154 @Description    When there is data available to read this call returns with
155                  the address and length of the data buffer the
156                  client can safely read. This buffer may contain one or more
157                  event packets. If no data is available then this call 
158                                  returns OK and sets *puiBufLen to 0 on exit.
159                                  Clients must pair this call with a ReleaseData call.
160 @Input          hDevData        Handle to connection/device object
161 @Output         ppBuf           Address of a pointer to a byte buffer. On exit
162                                  it contains the address of buffer to read from
163 @Output         puiBufLen       Pointer to an integer. On exit it is the size
164                                  of the data to read from the buffer
165 @Return         PVRSRV_ERROR:   for system error codes
166 */ /***************************************************************************/
167 PVRSRV_ERROR RGXHWPerfAcquireData(
168                 IMG_HANDLE  hDevData,
169                 IMG_PBYTE*  ppBuf,
170                 IMG_UINT32* pui32BufLen);
171
172
173 /**************************************************************************/ /*!
174 @Function       RGXHWPerfReleaseData
175 @Description    Called after client has read the event data out of the buffer
176                  retrieved from the Acquire Data call to release resources.
177 @Input          hDevData        Handle to connection/device object
178 @Return         PVRSRV_ERROR:   for system error codes
179 */ /***************************************************************************/
180 IMG_INTERNAL
181 PVRSRV_ERROR RGXHWPerfReleaseData(
182                 IMG_HANDLE hDevData);
183
184
185 #endif /* SUPPORT_KERNEL_HWPERF */
186
187
188 #endif /* __RGXAPI_KM_H__ */
189
190 /******************************************************************************
191  End of file (rgxapi_km.h)
192 ******************************************************************************/