xref: /aosp_15_r20/external/gmmlib/Source/util/g_gfxDebug.h (revision 35ffd701415c9e32e53136d61a677a8d0a8fc4a5)
1 //=================================================================================/
2 //Copyright (c) 2017 Intel Corporation                                             /
3 //                                                                                 /
4 //Permission is hereby granted, free of charge, to any person obtaining a copy     /
5 //of this software and associated documentation files (the "Software"), to deal    /
6 //in the Software without restriction, including without limitation the rights     /
7 //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell        /
8 //copies of the Software, and to permit persons to whom the Software is furnished  /
9 //to do so, subject to the following conditions:                                   /
10 //
11 //The above copyright notice and this permission notice shall be included in all   /
12 //copies or substantial portions of the Software.                                  /
13 //
14 //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR       /
15 //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,         /
16 //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE      /
17 //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,/
18 //WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN  /
19 //CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.       /
20 //---------------------------------------------------------------------------------
21 
22 #ifndef _G_GFXDEBUG_H_
23 #define _G_GFXDEBUG_H_
24 
25 
26 //===================== Debug Message Levels========================
27 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
28 
29 #define GFXDBG_OFF                   (0x00000000)
30 #define GFXDBG_CRITICAL              (0x00000001)
31 #define GFXDBG_NORMAL                (0x00000002)
32 #define GFXDBG_VERBOSE               (0x00000004)
33 #define GFXDBG_FUNCTION              (0x80000000)
34 #define GFXDBG_NONCRITICAL           (0x00000010)
35 #define GFXDBG_CRITICAL_DEBUG        (0x00000020)
36 #define GFXDBG_VERBOSE_VERBOSITY     (0x00000040)
37 #define GFXDBG_PROTOCAL              (0x00000100)
38 #define GFXDBG_FUNCTION_ENTRY        (0x80000000)
39 #define GFXDBG_FUNCTION_EXIT         (0x80000000)
40 #define GFXDBG_FUNCTION_ENTRY_VERBOSE (0x20000000)
41 #define GFXDBG_FUNCTION_EXIT_VERBOSE (0x20000000)
42 
43 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
44 #define DBG_OFF                        GFXDBG_OFF
45 #define DBG_CRITICAL                   GFXDBG_CRITICAL
46 #define DBG_NORMAL                     GFXDBG_NORMAL
47 #define DBG_VERBOSE                    GFXDBG_VERBOSE
48 #define DBG_FUNCTION                   GFXDBG_FUNCTION
49 #define DBG_NONCRITICAL                GFXDBG_NONCRITICAL
50 #define DBG_CRITICAL_DEBUG             GFXDBG_CRITICAL_DEBUG
51 #define DBG_VERBOSE_VERBOSITY          GFXDBG_VERBOSE_VERBOSITY
52 #define DBG_PROTOCAL                   GFXDBG_PROTOCAL
53 #define DBG_FUNCTION_ENTRY             GFXDBG_FUNCTION_ENTRY
54 #define DBG_FUNCTION_EXIT              GFXDBG_FUNCTION_EXIT
55 #define DBG_FUNCTION_ENTRY_VERBOSE     GFXDBG_FUNCTION_ENTRY_VERBOSE
56 #define DBG_FUNCTION_EXIT_VERBOSE      GFXDBG_FUNCTION_EXIT_VERBOSE
57 
58 
59 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
60 // This enum is used by DebugControlUI
61 // Use #define GFXDBG_<LEVEL> to specify debug level in driver code.
62 
63 enum
64 {
65     GFXDBG_ML_OFF                   =  0,
66     GFXDBG_ML_CRITICAL              =  1,
67     GFXDBG_ML_NORMAL                =  2,
68     GFXDBG_ML_VERBOSE               =  3,
69     GFXDBG_ML_FUNCTION              =  4,
70     GFXDBG_ML_COUNT                 =  5,
71 };
72 
73 //===================== Component ID's =============================
74 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
75 
76 enum
77 {
78     GFX_COMPONENT_GMM               =  2,
79 	GFX_COMPONENT_COUNT             = 12,
80 };
81 
82 //===================== Component Masks ============================
83 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
84 
85 enum
86 {
87     GFX_GMM_MASK             = (1 << GFX_COMPONENT_GMM),
88 };
89 
90 //================= Component Memory Allocation Tags ===============
91 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
92 //
93 // Tags are 4 byte ASCII character codes in the range 0-127 decimal.
94 // The leading @ character is to provide Intel unique tags.
95 // Passed in calls to ExAllocatePoolWithTag/ExFreePoolWithTag.
96 // Useful for pool tracking.
97 //
98 
99 #define GFX_COMPONENT_GMM_TAG                   'MMG@'
100 #define GFX_DEFAULT_TAG                         'CTNI'
101 
102 //======================= Component ALLOC_TAG ======================
103 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
104 
105 #ifdef __MINIPORT
106 #define REG_ASSERT_ENABLE_MASK                  L"z AssertEnableMask"
107 #define REG_DEBUG_ENABLE_MASK                   L"z DebugEnableMask"
108 #define REG_RINGBUF_DEBUG_MASK                  L"z RingBufDbgMask"
109 #define REG_REPORT_ASSERT_ENABLE                L"z ReportAssertEnable"
110 #define REG_ASSERT_BREAK_DISABLE                L"z AssertBreakDisable"
111 #define REG_GFX_COMPONENT_GMM                   L"z GMM_Debug_Lvl"
112 
113 #endif
114 
115 //======================= Component ALLOC_TAG ======================
116 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
117 
118 #if defined(__MINIPORT)
119 #define ALLOC_TAG               GFX_COMPONENT_MINIPORT_TAG
120 #elif defined(__SOFTBIOS)
121 #define ALLOC_TAG               GFX_COMPONENT_SOFTBIOS_TAG
122 #elif defined(__KCH)
123 #define ALLOC_TAG               GFX_COMPONENT_KCH_TAG
124 #elif defined(__AIM)
125 #define ALLOC_TAG               GFX_COMPONENT_AIM_TAG
126 #else
127 #define ALLOC_TAG               GFX_DEFAULT_TAG
128 #endif
129 
130 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
131 #ifdef __GFXDEBUG_C__    // Only to be defined by "gfxDebug.c" file.
132 
133     // Define the array of component ID strings. Note that the sequence
134     // of these strings must match the component ID's listed above.
135 
136     char *ComponentIdStrings[] = {
137         "INTC GMM: ",
138 
139     };
140 
141 #endif /* __GFXDEBUG_C__ */
142 
143 //================ Prototype for print routines ====================
144 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
145 
146 #ifdef __cplusplus
147 extern "C" {
148 #endif
149 void GMMPrintMessage(unsigned long DebugLevel, const char *DebugMessageFmt, ...);
150 
151 #ifdef __cplusplus
152 }
153 #endif
154 //==================== Generate debug routines =====================
155 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
156 //
157 // Debug routines either map into the base PrintMessage
158 // routine or they map into nothing. A code segment such as
159 // 'DebugPrint(args)' gets converted to '(args)' which
160 // is converted to nothing by the C compiler.
161 
162 #if __DEBUG_MESSAGE
163     #define GMMDebugMessage             GMMPrintMessage
164 	#define GMMDebugMessage(...)
165 #else
166     #define GMMDebugMessage(...)
167 #endif /* __DEBUG_MESSSAGE */
168 
169 //=================== Generate release routines ====================
170 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
171 //
172 // Release routines either map into the base PrintMessage
173 // routine or they map into nothing. A code segment such as
174 // 'ReleasePrint(args)' gets converted to '(args)' which
175 // is converted to nothing by the C compiler.
176 
177 #if __RELEASE_MESSAGE
178     #define GMMReleaseMessage             GMMPrintMessage
179 #else
180     #define GMMReleaseMessage(...)
181 #endif /* __RELEASE_MESSSAGE */
182 
183 //=================== Generate ASSERT macros  ======================
184 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
185 
186 #define GMMASSERT(expr)      __ASSERT(pDebugControl, GFX_COMPONENT_GMM, GFX_GMM_MASK, expr)
187 
188 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
189 #define GMMASSERTPTR(expr, ret)      __ASSERTPTR(pDebugControl, GFX_COMPONENT_GMM, GFX_GMM_MASK, expr, ret)
190 
191 //=========== void return value for ASSERPTR macros  ==========================
192 #define VOIDRETURN
193 
194 //============= Generate Message printing routines =================
195 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
196 
197 #ifdef __GFXDEBUG_C__    // Only to be defined by "gfxDebug.c" file.
198 
199   #ifdef __GMM
200      MESSAGE_FUNCTION(GMMPrintMessage, GFX_COMPONENT_GMM);
201   #endif /* __GMM */
202 
203 //  WARNING!!! DO NOT MODIFY this file - see detail above copyright.
204 #endif /* __GFXDEBUG_C__  */
205 
206 #endif //_G_GFXDEBUG_H_
207