1 /*************************************************************************/ /*!
3 @Title PVR GPU Trace module common environment interface
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @License Dual MIT/GPLv2
7 The contents of this file are subject to the MIT license as set out below.
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
19 Alternatively, the contents of this file may be used under the terms of
20 the GNU General Public License Version 2 ("GPL") in which case the provisions
21 of GPL are applicable instead of those above.
23 If you wish to allow use of your version of this file only under the terms of
24 GPL, and not to allow others to use your version of this file under the terms
25 of the MIT license, indicate your decision by deleting the provisions above
26 and replace them with the notice and other provisions required by GPL as set
27 out in the file called "GPL-COPYING" included in this distribution. If you do
28 not delete the provisions above, a recipient may use your version of this file
29 under the terms of either the MIT license or GPL.
31 This License is also included in this distribution in the file called
34 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
35 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
36 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
38 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
39 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
40 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 */ /**************************************************************************/
43 #ifndef PVR_GPUTRACE_H_
44 #define PVR_GPUTRACE_H_
46 #include "img_types.h"
48 #include "rgx_hwperf.h"
51 #if defined(__linux__)
53 void PVRGpuTraceEnqueueEvent(
54 PVRSRV_DEVICE_NODE *psDevNode,
55 IMG_UINT32 ui32FirmwareCtx,
56 IMG_UINT32 ui32ExternalJobRef,
57 IMG_UINT32 ui32InternalJobRef,
58 RGX_HWPERF_KICK_TYPE eKickType);
60 /* Early initialisation of GPU Trace events logic.
61 * This function is called on *driver* initialisation. */
62 PVRSRV_ERROR PVRGpuTraceSupportInit(void);
64 /* GPU Trace resources final cleanup.
65 * This function is called on driver de-initialisation. */
66 void PVRGpuTraceSupportDeInit(void);
68 /* Initialisation for AppHints callbacks.
69 * This function is called during the late stage of driver initialisation but
70 * before the device initialisation but after the debugfs sub-system has been
72 void PVRGpuTraceInitAppHintCallbacks(const PVRSRV_DEVICE_NODE *psDeviceNode);
74 /* Per-device initialisation of the GPU Trace resources */
75 PVRSRV_ERROR PVRGpuTraceInitDevice(PVRSRV_DEVICE_NODE *psDeviceNode);
77 /* Per-device cleanup for the GPU Trace resources. */
78 void PVRGpuTraceDeInitDevice(PVRSRV_DEVICE_NODE *psDeviceNode);
80 /* Enables the gpu trace sub-system for a given device. */
81 PVRSRV_ERROR PVRGpuTraceSetEnabled(
82 PVRSRV_DEVICE_NODE *psDeviceNode,
85 /* Returns IMG_TRUE if the gpu trace sub-system has been enabled (but not
86 * necessarily initialised). */
87 IMG_BOOL PVRGpuTraceIsEnabled(void);
89 /* Performs some initialisation steps if the feature was enabled
90 * on driver startup. */
91 void PVRGpuTraceInitIfEnabled(PVRSRV_DEVICE_NODE *psDeviceNode);
93 /* FTrace events callbacks interface */
95 void PVRGpuTraceEnableUfoCallback(void);
96 void PVRGpuTraceDisableUfoCallback(void);
98 void PVRGpuTraceEnableFirmwareActivityCallback(void);
99 void PVRGpuTraceDisableFirmwareActivityCallback(void);
101 #else /* defined(__linux__) */
103 static inline void PVRGpuTraceEnqueueEvent(
104 PVRSRV_DEVICE_NODE *psDevNode,
105 IMG_UINT32 ui32FirmwareCtx,
106 IMG_UINT32 ui32ExternalJobRef,
107 IMG_UINT32 ui32InternalJobRef,
108 RGX_HWPERF_KICK_TYPE eKickType)
110 PVR_UNREFERENCED_PARAMETER(psDevNode);
111 PVR_UNREFERENCED_PARAMETER(ui32ExternalJobRef);
112 PVR_UNREFERENCED_PARAMETER(ui32InternalJobRef);
113 PVR_UNREFERENCED_PARAMETER(eKickType);
116 static inline PVRSRV_ERROR PVRGpuTraceSupportInit(void) {
120 static inline void PVRGpuTraceSupportDeInit(void) {}
122 static inline void PVRGpuTraceInitAppHintCallbacks(
123 const PVRSRV_DEVICE_NODE *psDeviceNode)
125 PVR_UNREFERENCED_PARAMETER(psDeviceNode);
128 static inline PVRSRV_ERROR PVRGpuTraceInitDevice(
129 PVRSRV_DEVICE_NODE *psDeviceNode)
131 PVR_UNREFERENCED_PARAMETER(psDeviceNode);
135 static inline void PVRGpuTraceDeInitDevice(PVRSRV_DEVICE_NODE *psDeviceNode)
137 PVR_UNREFERENCED_PARAMETER(psDeviceNode);
140 static inline PVRSRV_ERROR PVRGpuTraceSetEnabled(
141 PVRSRV_DEVICE_NODE *psDeviceNode,
144 PVR_UNREFERENCED_PARAMETER(psDeviceNode);
145 PVR_UNREFERENCED_PARAMETER(bNewValue);
149 static inline IMG_BOOL PVRGpuTraceIsEnabled(void)
154 static inline void PVRGpuTraceInitIfEnabled(PVRSRV_DEVICE_NODE *psDeviceNode)
156 PVR_UNREFERENCED_PARAMETER(psDeviceNode);
159 static inline void PVRGpuTraceEnableUfoCallback(void) {}
160 static inline void PVRGpuTraceDisableUfoCallback(void) {}
162 static inline void PVRGpuTraceEnableFirmwareActivityCallback(void) {}
163 static inline void PVRGpuTraceDisableFirmwareActivityCallback(void) {}
165 #endif /* defined(__linux__) */
167 #endif /* PVR_GPUTRACE_H_ */