gpu: pvr: pdumpfs: add stream_frames debugfs entry
[sgx.git] / pvr / pvr_debug.h
1 /**********************************************************************
2  *
3  * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful but, except
10  * as otherwise stated in writing, without any warranty; without even the
11  * implied warranty of merchantability or fitness for a particular purpose.
12  * See the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * The full GNU General Public License is included in this distribution in
19  * the file called "COPYING".
20  *
21  * Contact Information:
22  * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23  * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
24  *
25  ******************************************************************************/
26
27 #ifndef __PVR_DEBUG_H__
28 #define __PVR_DEBUG_H__
29
30 #include <linux/fs.h>
31
32 #include "img_types.h"
33
34 #define PVR_MAX_DEBUG_MESSAGE_LEN       512
35
36 #define DBGPRIV_FATAL                   0x01UL
37 #define DBGPRIV_ERROR                   0x02UL
38 #define DBGPRIV_WARNING                 0x04UL
39 #define DBGPRIV_MESSAGE                 0x08UL
40 #define DBGPRIV_VERBOSE                 0x10UL
41 #define DBGPRIV_CALLTRACE               0x20UL
42 #define DBGPRIV_ALLOC                   0x40UL
43 #define DBGPRIV_ALLLEVELS               (DBGPRIV_FATAL | DBGPRIV_ERROR |     \
44                                          DBGPRIV_WARNING | DBGPRIV_MESSAGE | \
45                                          DBGPRIV_VERBOSE)
46
47 #define PVR_DBG_FATAL                   DBGPRIV_FATAL
48 #define PVR_DBG_ERROR                   DBGPRIV_ERROR
49 #define PVR_DBG_WARNING                 DBGPRIV_WARNING
50 #define PVR_DBG_MESSAGE                 DBGPRIV_MESSAGE
51 #define PVR_DBG_VERBOSE                 DBGPRIV_VERBOSE
52 #define PVR_DBG_CALLTRACE               DBGPRIV_CALLTRACE
53 #define PVR_DBG_ALLOC                   DBGPRIV_ALLOC
54
55 #if defined(CONFIG_PVR_DEBUG)
56
57 #define PVR_ASSERT(EXPR)                                                     \
58         do {                                                                 \
59                 if (!(EXPR))                                                 \
60                         PVRSRVDebugAssertFail(__FILE__, __LINE__);           \
61         } while (0)
62
63 #define PVR_DPF(level, fmt, ...)                                             \
64         PVRSRVDebugPrintf(level, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
65
66 #define PVR_TRACE(fmt, ...)                                                  \
67         PVRSRVTrace(fmt, ##__VA_ARGS__)
68
69 void PVRSRVDebugAssertFail(const char *pszFile, u32 ui32Line);
70 void PVRSRVDebugPrintf(u32 ui32DebugLevel, const char *pszFileName,
71                        u32 ui32Line, const char *pszFormat, ...);
72 void PVRSRVTrace(const char *pszFormat, ...);
73
74 int PVRDebugProcSetLevel(struct file *file, const char __user *buffer,
75                          unsigned long count, void *data);
76 int PVRDebugProcGetLevel(char *page, char **start, off_t off, int count,
77                          int *eof, void *data);
78 void PVRDebugSetLevel(u32 uDebugLevel);
79
80 #define PVR_DBG_BREAK
81
82 #else
83
84 #if defined(TIMING)
85
86 #define PVR_ASSERT(EXPR)                do { } while (0)
87 #define PVR_DPF(level, fmt, ...)        do { } while (0)
88 #define PVR_TRACE(fmt, ...)     \
89         PVRSRVTrace(fmt, ##__VA_ARGS__)
90 #define PVR_DBG_BREAK                   do { } while (0)
91
92 void PVRSRVTrace(const char *pszFormat, ...);
93
94 #else
95
96 #define PVR_ASSERT(EXPR)                do { } while (0)
97 #define PVR_DPF(level, fmt, ...)        do { } while (0)
98 #define PVR_TRACE(fmt, ...)             do { } while (0)
99 #define PVR_DBG_BREAK                   do { } while (0)
100
101 #endif          /* TIMING */
102
103 #endif          /* CONFIG_PVR_DEBUG */
104
105 #if defined(CONFIG_PVR_DEBUG) || defined(TIMING)
106
107 void pvr_dbg_init(void);
108 void pvr_dbg_cleanup(void);
109
110 #else
111
112 static inline void pvr_dbg_init(void) {};
113 static inline void pvr_dbg_cleanup(void) {};
114
115 #endif
116
117 #ifdef CONFIG_DEBUG_FS
118 extern struct dentry *pvr_debugfs_dir;
119 #endif
120
121 #endif