1 /*************************************************************************/ /*!
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
8 The contents of this file are subject to the MIT license as set out below.
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:
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
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.
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.
32 This License is also included in this distribution in the file called
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 */ /**************************************************************************/
44 #ifndef __RGXAPI_KM_H__
45 #define __RGXAPI_KM_H__
47 #if defined(SUPPORT_SHARED_SLC) && !defined(PVRSRV_GPUVIRT_GUESTDRV)
49 ******************************************************************************
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
57 @Input hDevHandle : RGX Device Node
59 @Return PVRSRV_ERROR :
61 ******************************************************************************/
62 PVRSRV_ERROR RGXInitSLC(IMG_HANDLE hDevHandle);
65 #include "rgx_hwperf_km.h"
68 /******************************************************************************
69 * RGX HW Performance Profiling Control API(s)
70 *****************************************************************************/
72 /**************************************************************************/ /*!
73 @Function RGXHWPerfLazyConnect
74 @Description Obtain a connection object to the RGX device. The connection
75 is not actually opened until HWPerfOpen() is called.
76 @Output phDevData Address of a handle to a connection object
77 @Return PVRSRV_ERROR: for system error codes
78 */ /***************************************************************************/
79 PVRSRV_ERROR RGXHWPerfLazyConnect(
80 IMG_HANDLE* phDevData);
83 /**************************************************************************/ /*!
84 @Function RGXHWPerfOpen
85 @Description Opens a connection to the RGX device. Valid handle to the
86 connection object has to be provided which means the this
87 function needs to be preceded by the call to
88 RGXHWPerfLazyConnect() function.
89 @Input phDevData handle to a connection object
90 @Return PVRSRV_ERROR: for system error codes
91 */ /***************************************************************************/
92 PVRSRV_ERROR RGXHWPerfOpen(
96 /**************************************************************************/ /*!
97 @Function RGXHWPerfConnect
98 @Description Obtain a connection object to the RGX device. Allocated
99 connection object references opened connection.
100 Calling this function is an equivalent of calling
101 RGXHWPerfLazyConnect and RGXHWPerfOpen.
102 @Output phDevData Address of a handle to a connection object
103 @Return PVRSRV_ERROR: for system error codes
104 */ /***************************************************************************/
105 PVRSRV_ERROR RGXHWPerfConnect(
106 IMG_HANDLE* phDevData);
109 /**************************************************************************/ /*!
110 @Function RGXHWPerfFreeConnection
111 @Description Frees the handle to RGX device
112 @Input hSrvHandle Handle to connection object as returned from
113 RGXHWPerfLazyConnect()
114 @Return PVRSRV_ERROR: for system error codes
115 */ /***************************************************************************/
116 PVRSRV_ERROR RGXHWPerfFreeConnection(
117 IMG_HANDLE hDevData);
120 /**************************************************************************/ /*!
121 @Function RGXHWPerfClose
122 @Description Disconnect from the RGX device
123 @Input hSrvHandle Handle to connection object as returned from
124 RGXHWPerfConnect() or RGXHWPerfOpen()
125 @Return PVRSRV_ERROR: for system error codes
126 */ /***************************************************************************/
127 PVRSRV_ERROR RGXHWPerfClose(
128 IMG_HANDLE hDevData);
131 /**************************************************************************/ /*!
132 @Function RGXHWPerfDisconnect
133 @Description Disconnect from the RGX device
134 @Input hSrvHandle Handle to connection object as returned from
135 RGXHWPerfConnect() or RGXHWPerfOpen().
136 Calling this function is an equivalent of calling
137 RGXHWPerfClose and RGXHWPerfFreeConnection.
138 @Return PVRSRV_ERROR: for system error codes
139 */ /***************************************************************************/
140 PVRSRV_ERROR RGXHWPerfDisconnect(
141 IMG_HANDLE hDevData);
144 /**************************************************************************/ /*!
145 @Function RGXHWPerfControl
146 @Description Enable or disable the generation of RGX HWPerf event packets.
148 @Input hDevData Handle to connection object
149 @Input bToggle Switch to toggle or apply mask.
150 @Input ui64Mask Mask of events to control.
151 @Return PVRSRV_ERROR: for system error codes
152 */ /***************************************************************************/
153 PVRSRV_ERROR IMG_CALLCONV RGXHWPerfControl(
155 RGX_HWPERF_STREAM_ID eStreamId,
157 IMG_UINT64 ui64Mask);
160 /**************************************************************************/ /*!
161 @Function RGXHWPerfConfigureAndEnableCounters
162 @Description Enable and configure the performance counter block for
163 one or more device layout modules.
164 See RGXConfigureAndEnableHWPerfCounters().
165 @Input hDevData Handle to connection object
166 @Input ui32NumBlocks Number of elements in the array
167 @Input asBlockConfigs Address of the array of configuration blocks
168 @Return PVRSRV_ERROR: for system error codes
169 */ /***************************************************************************/
170 PVRSRV_ERROR IMG_CALLCONV RGXHWPerfConfigureAndEnableCounters(
172 IMG_UINT32 ui32NumBlocks,
173 RGX_HWPERF_CONFIG_CNTBLK* asBlockConfigs);
176 /**************************************************************************/ /*!
177 @Function RGXDisableHWPerfCounters
178 @Description Disable the performance counter block for one or more
179 device layout modules. See RGXDisableHWPerfCounters().
180 @Input hDevData Handle to connection/device object
181 @Input ui32NumBlocks Number of elements in the array
182 @Input aeBlockIDs An array of bytes with values taken from
183 the RGX_HWPERF_CNTBLK_ID enumeration.
184 @Return PVRSRV_ERROR: for system error codes
185 */ /***************************************************************************/
186 PVRSRV_ERROR IMG_CALLCONV RGXHWPerfDisableCounters(
188 IMG_UINT32 ui32NumBlocks,
189 IMG_UINT16* aeBlockIDs);
191 /**************************************************************************/ /*!
192 @Function RGXEnableHWPerfCounters
193 @Description Enable the performance counter block for one or more
194 device layout modules. See RGXEnableHWPerfCounters().
195 @Input hDevData Handle to connection/device object
196 @Input ui32NumBlocks Number of elements in the array
197 @Input aeBlockIDs An array of bytes with values taken from
198 the RGX_HWPERF_CNTBLK_ID enumeration.
199 @Return PVRSRV_ERROR: for system error codes
200 */ /***************************************************************************/
201 PVRSRV_ERROR IMG_CALLCONV RGXHWPerfEnableCounters(
203 IMG_UINT32 ui32NumBlocks,
204 IMG_UINT16* aeBlockIDs);
206 /******************************************************************************
207 * RGX HW Performance Profiling Retrieval API(s)
209 * The client must ensure their use of this acquire/release API for a single
210 * connection/stream must not be shared with multiple execution contexts e.g.
211 * between a kernel thread and an ISR handler. It is the client’s
212 * responsibility to ensure this API is not interrupted by a high priority
214 *****************************************************************************/
216 /**************************************************************************/ /*!
217 @Function RGXHWPerfAcquireData
218 @Description When there is data available to read this call returns with
219 the address and length of the data buffer the
220 client can safely read. This buffer may contain one or more
221 event packets. If no data is available then this call
222 returns OK and sets *puiBufLen to 0 on exit.
223 Clients must pair this call with a ReleaseData call.
224 @Input hDevData Handle to connection/device object
225 @Input eStreamId ID of the HWPerf stream
226 @Output ppBuf Address of a pointer to a byte buffer. On exit
227 it contains the address of buffer to read from
228 @Output puiBufLen Pointer to an integer. On exit it is the size
229 of the data to read from the buffer
230 @Return PVRSRV_ERROR: for system error codes
231 */ /***************************************************************************/
232 PVRSRV_ERROR RGXHWPerfAcquireData(
234 RGX_HWPERF_STREAM_ID eStreamId,
236 IMG_UINT32* pui32BufLen);
239 /**************************************************************************/ /*!
240 @Function RGXHWPerfGetFilter
241 @Description Reads HWPerf stream filter where stream is identified by
243 @Input hDevData Handle to connection/device object
244 @Input eStreamId ID of the HWPerf stream
245 @Output IMG_UINT64 HWPerf filter value
246 @Return PVRSRV_ERROR: for system error codes
247 */ /***************************************************************************/
248 PVRSRV_ERROR RGXHWPerfGetFilter(
250 RGX_HWPERF_STREAM_ID eStreamId,
251 IMG_UINT64 *ui64Filter
255 /**************************************************************************/ /*!
256 @Function RGXHWPerfReleaseData
257 @Description Called after client has read the event data out of the buffer
258 retrieved from the Acquire Data call to release resources.
259 @Input hDevData Handle to connection/device object
260 @Return PVRSRV_ERROR: for system error codes
261 */ /***************************************************************************/
263 PVRSRV_ERROR RGXHWPerfReleaseData(
265 RGX_HWPERF_STREAM_ID eStreamId);
268 #endif /* __RGXAPI_KM_H__ */
270 /******************************************************************************
271 End of file (rgxapi_km.h)
272 ******************************************************************************/