summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'sgx_km/eurasia_km/include4/pvr_debug.h')
-rw-r--r--sgx_km/eurasia_km/include4/pvr_debug.h283
1 files changed, 283 insertions, 0 deletions
diff --git a/sgx_km/eurasia_km/include4/pvr_debug.h b/sgx_km/eurasia_km/include4/pvr_debug.h
new file mode 100644
index 0000000..be78c77
--- /dev/null
+++ b/sgx_km/eurasia_km/include4/pvr_debug.h
@@ -0,0 +1,283 @@
1/*************************************************************************/ /*!
2@Title PVR Debug Declarations
3@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4@Description Provides debug functionality
5@License Dual MIT/GPLv2
6
7The contents of this file are subject to the MIT license as set out below.
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19Alternatively, the contents of this file may be used under the terms of
20the GNU General Public License Version 2 ("GPL") in which case the provisions
21of GPL are applicable instead of those above.
22
23If you wish to allow use of your version of this file only under the terms of
24GPL, and not to allow others to use your version of this file under the terms
25of the MIT license, indicate your decision by deleting the provisions above
26and replace them with the notice and other provisions required by GPL as set
27out in the file called "GPL-COPYING" included in this distribution. If you do
28not delete the provisions above, a recipient may use your version of this file
29under the terms of either the MIT license or GPL.
30
31This License is also included in this distribution in the file called
32"MIT-COPYING".
33
34EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
35PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
36BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
38COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
39IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
40CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41*/ /**************************************************************************/
42#ifndef __PVR_DEBUG_H__
43#define __PVR_DEBUG_H__
44
45
46#include "img_types.h"
47
48
49#if defined (__cplusplus)
50extern "C" {
51#endif
52
53#define PVR_MAX_DEBUG_MESSAGE_LEN (512)
54
55/* These are privately used by pvr_debug, use the PVR_DBG_ defines instead */
56#define DBGPRIV_FATAL 0x001UL
57#define DBGPRIV_ERROR 0x002UL
58#define DBGPRIV_BUFFERED 0x004UL
59#define DBGPRIV_WARNING 0x008UL
60#define DBGPRIV_MESSAGE 0x010UL
61#define DBGPRIV_VERBOSE 0x020UL
62#define DBGPRIV_CALLTRACE 0x040UL
63#define DBGPRIV_ALLOC 0x080UL
64#define DBGPRIV_DBGDRV_MESSAGE 0x100UL
65
66#define DBGPRIV_DBGLEVEL_COUNT 9
67
68#if !defined(PVRSRV_NEED_PVR_ASSERT) && defined(DEBUG)
69#define PVRSRV_NEED_PVR_ASSERT
70#endif
71
72#if defined(PVRSRV_NEED_PVR_ASSERT) && !defined(PVRSRV_NEED_PVR_DPF)
73#define PVRSRV_NEED_PVR_DPF
74#endif
75
76#if !defined(PVRSRV_NEED_PVR_TRACE) && (defined(DEBUG) || defined(TIMING))
77#define PVRSRV_NEED_PVR_TRACE
78#endif
79
80/* PVR_ASSERT() and PVR_DBG_BREAK handling */
81
82#if defined(PVRSRV_NEED_PVR_ASSERT)
83
84#if defined(LINUX) && defined(__KERNEL__)
85/* In Linux kernel mode, use BUG() directly. This produces the correct
86 filename and line number in the panic message. */
87#define PVR_ASSERT(EXPR) do \
88 { \
89 if (!(EXPR)) \
90 { \
91 PVRSRVDebugPrintf(DBGPRIV_FATAL, __FILE__, __LINE__, \
92 "Debug assertion failed!"); \
93 BUG(); \
94 } \
95 } while (0)
96
97#else /* defined(LINUX) && defined(__KERNEL__) */
98
99IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVDebugAssertFail(const IMG_CHAR *pszFile,
100 IMG_UINT32 ui32Line);
101
102#if defined(LINUX)
103 #define PVR_ASSERT(EXPR) do \
104 { \
105 if (!(EXPR)) \
106 PVRSRVDebugAssertFail(__FILE__, __LINE__); \
107 } while (0)
108#else
109 #if defined (__QNXNTO__)
110 #define PVR_ASSERT(EXPR) if (!(EXPR)) PVRSRVDebugAssertFail(__FILE__, __LINE__);
111 #else
112 #define PVR_ASSERT(EXPR) if (!(EXPR)) PVRSRVDebugAssertFail(__FILE__, __LINE__)
113 #endif
114#endif
115
116#endif /* defined(LINUX) && defined(__KERNEL__) */
117
118
119 #if defined(LINUX) && defined(__KERNEL__)
120 #define PVR_DBG_BREAK BUG()
121 #else
122 #define PVR_DBG_BREAK PVRSRVDebugAssertFail(__FILE__, __LINE__)
123 #endif
124
125#else /* defined(PVRSRV_NEED_PVR_ASSERT) */
126
127 #define PVR_ASSERT(EXPR)
128 #define PVR_DBG_BREAK
129
130#endif /* defined(PVRSRV_NEED_PVR_ASSERT) */
131
132
133/* PVR_DPF() handling */
134
135#if defined(PVRSRV_NEED_PVR_DPF)
136
137#if defined(PVRSRV_NEW_PVR_DPF)
138
139 /* New logging mechanism */
140 #define PVR_DBG_FATAL DBGPRIV_FATAL
141 #define PVR_DBG_ERROR DBGPRIV_ERROR
142 #define PVR_DBG_BUFFERED DBGPRIV_BUFFERED
143 #define PVR_DBG_WARNING DBGPRIV_WARNING
144 #define PVR_DBG_MESSAGE DBGPRIV_MESSAGE
145 #define PVR_DBG_VERBOSE DBGPRIV_VERBOSE
146 #define PVR_DBG_CALLTRACE DBGPRIV_CALLTRACE
147 #define PVR_DBG_ALLOC DBGPRIV_ALLOC
148 #define PVR_DBGDRIV_MESSAGE DBGPRIV_DBGDRV_MESSAGE
149
150 /* These levels are always on with PVRSRV_NEED_PVR_DPF */
151 #define __PVR_DPF_0x001UL(x...) PVRSRVDebugPrintf(DBGPRIV_FATAL, x)
152 #define __PVR_DPF_0x002UL(x...) PVRSRVDebugPrintf(DBGPRIV_ERROR, x)
153 #define __PVR_DPF_0x004UL(x...) PVRSRVDebugPrintf(DBGPRIV_BUFFERED, x)
154
155 /* Some are compiled out completely in release builds */
156#if defined(DEBUG)
157 #define __PVR_DPF_0x008UL(x...) PVRSRVDebugPrintf(DBGPRIV_WARNING, x)
158 #define __PVR_DPF_0x010UL(x...) PVRSRVDebugPrintf(DBGPRIV_MESSAGE, x)
159 #define __PVR_DPF_0x020UL(x...) PVRSRVDebugPrintf(DBGPRIV_VERBOSE, x)
160 #define __PVR_DPF_0x040UL(x...) PVRSRVDebugPrintf(DBGPRIV_CALLTRACE, x)
161 #define __PVR_DPF_0x080UL(x...) PVRSRVDebugPrintf(DBGPRIV_ALLOC, x)
162 #define __PVR_DPF_0x100UL(x...) PVRSRVDebugPrintf(DBGPRIV_DBGDRV_MESSAGE, x)
163
164#elif defined(PVR_DBGPRIV_LEVEL)
165
166#if (PVR_DBGPRIV_LEVEL >= DBGPRIV_WARNING)
167 #define __PVR_DPF_0x008UL(x...) PVRSRVDebugPrintf(DBGPRIV_WARNING, x)
168#else
169 #define __PVR_DPF_0x008UL(x...)
170#endif
171
172#if (PVR_DBGPRIV_LEVEL >= DBGPRIV_MESSAGE)
173 #define __PVR_DPF_0x010UL(x...) PVRSRVDebugPrintf(DBGPRIV_MESSAGE, x)
174#else
175 #define __PVR_DPF_0x010UL(x...)
176#endif
177
178#if (PVR_DBGPRIV_LEVEL >= DBGPRIV_VERBOSE)
179 #define __PVR_DPF_0x020UL(x...) PVRSRVDebugPrintf(DBGPRIV_VERBOSE, x)
180#else
181 #define __PVR_DPF_0x020UL(x...)
182#endif
183
184#if (PVR_DBGPRIV_LEVEL >= DBGPRIV_CALLTRACE)
185 #define __PVR_DPF_0x040UL(x...) PVRSRVDebugPrintf(DBGPRIV_CALLTRACE, x)
186#else
187 #define __PVR_DPF_0x040UL(x...)
188#endif
189
190#if (PVR_DBGPRIV_LEVEL >= DBGPRIV_ALLOC)
191 #define __PVR_DPF_0x080UL(x...) PVRSRVDebugPrintf(DBGPRIV_ALLOC, x)
192#else
193 #define __PVR_DPF_0x080UL(x...)
194#endif
195
196#if (PVR_DBGPRIV_LEVEL >= DBGPRIV_DBGDRV_MESSAGE)
197 #define __PVR_DPF_0x100UL(x...) PVRSRVDebugPrintf(DBGPRIV_DBGDRV_MESSAGE, x)
198#else
199 #define __PVR_DPF_0x100UL(x...)
200#endif
201
202#else
203 #define __PVR_DPF_0x008UL(x...)
204 #define __PVR_DPF_0x010UL(x...)
205 #define __PVR_DPF_0x020UL(x...)
206 #define __PVR_DPF_0x040UL(x...)
207 #define __PVR_DPF_0x080UL(x...)
208 #define __PVR_DPF_0x100UL(x...)
209#endif
210
211 /* Translate the different log levels to separate macros
212 * so they can each be compiled out.
213 */
214#if defined(DEBUG)
215 #define __PVR_DPF(lvl, x...) __PVR_DPF_ ## lvl (__FILE__, __LINE__, x)
216#else
217 #define __PVR_DPF(lvl, x...) __PVR_DPF_ ## lvl ("", 0, x)
218#endif
219
220 /* Get rid of the double bracketing */
221 #define PVR_DPF(x) __PVR_DPF x
222
223#else /* defined(PVRSRV_NEW_PVR_DPF) */
224
225 /* Old logging mechanism */
226 #define PVR_DBG_FATAL DBGPRIV_FATAL,__FILE__, __LINE__
227 #define PVR_DBG_ERROR DBGPRIV_ERROR,__FILE__, __LINE__
228 #define PVR_DBG_WARNING DBGPRIV_WARNING,__FILE__, __LINE__
229 #define PVR_DBG_MESSAGE DBGPRIV_MESSAGE,__FILE__, __LINE__
230 #define PVR_DBG_VERBOSE DBGPRIV_VERBOSE,__FILE__, __LINE__
231 #define PVR_DBG_CALLTRACE DBGPRIV_CALLTRACE,__FILE__, __LINE__
232 #define PVR_DBG_ALLOC DBGPRIV_ALLOC,__FILE__, __LINE__
233 #define PVR_DBG_BUFFERED DBGPRIV_BUFFERED,__FILE__, __LINE__
234 #define PVR_DBGDRIV_MESSAGE DBGPRIV_DBGDRV_MESSAGE, "", 0
235
236 #define PVR_DPF(X) PVRSRVDebugPrintf X
237
238#endif /* defined(PVRSRV_NEW_PVR_DPF) */
239
240IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVDebugPrintf(IMG_UINT32 ui32DebugLevel,
241 const IMG_CHAR *pszFileName,
242 IMG_UINT32 ui32Line,
243 const IMG_CHAR *pszFormat,
244 ...) IMG_FORMAT_PRINTF(4, 5);
245
246#if defined(PVR_DBGPRIV_LEVEL) && defined(SUPPORT_ANDROID_PLATFORM)
247IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVDebugPrintfSetLevel(IMG_UINT32 ui32DebugLevel);
248#endif
249
250IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVDebugPrintfDumpCCB(void);
251
252#else /* defined(PVRSRV_NEED_PVR_DPF) */
253
254 #define PVR_DPF(X)
255
256#endif /* defined(PVRSRV_NEED_PVR_DPF) */
257
258/* PVR_TRACE() handling */
259
260#if defined(PVRSRV_NEED_PVR_TRACE)
261
262 #define PVR_TRACE(X) PVRSRVTrace X
263
264IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVTrace(const IMG_CHAR* pszFormat, ... )
265 IMG_FORMAT_PRINTF(1, 2);
266
267#else /* defined(PVRSRV_NEED_PVR_TRACE) */
268
269 #define PVR_TRACE(X)
270
271#endif /* defined(PVRSRV_NEED_PVR_TRACE) */
272
273
274#if defined (__cplusplus)
275}
276#endif
277
278#endif /* __PVR_DEBUG_H__ */
279
280/******************************************************************************
281 End of file (pvr_debug.h)
282******************************************************************************/
283