xref: /aosp_15_r20/external/intel-media-driver/media_softlet/agnostic/common/os/mos_util_debug.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2019-2022, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file        mos_util_debug.h
24 //! \brief
25 //! \brief    Common OS Debug and Print utilities across different platform
26 //! \details  Provides assert and print to debug console functionality
27 //!           All MOS debug and print utilities will only function in debug or
28 //!           release internal drivers, in a release driver they will be NOPs.
29 //!
30 #ifndef __MOS_UTIL_DEBUG_H__
31 #define __MOS_UTIL_DEBUG_H__
32 #include <memory>
33 #include "mos_defs.h"
34 #include "mos_os_trace_event.h"
35 #include "media_class_trace.h"
36 #include "mos_oca_util_debug.h"
37 
38 #if MOS_MESSAGES_ENABLED
39 
40 //!
41 //! \brief Max number or sub-components per debug component
42 //!
43 #define MOS_MAX_SUBCOMPONENT_COUNT  20
44 
45 //!
46 //! \brief Mos message max buffer size
47 //!
48 #define MOS_MAX_MSG_BUF_SIZE        1024
49 
50 //!
51 //! \brief Max length of HLT file name
52 //!
53 #define MOS_MAX_HLT_FILENAME_LEN    260
54 
55 //!
56 //! \brief Define MOS Sub-Component IDs
57 //!
58 typedef enum
59 {
60     MOS_SUBCOMP_SELF               = 0,
61     MOS_SUBCOMP_HLT                = 1,
62     MOS_SUBCOMP_CODEC              = 2,
63     MOS_SUBCOMP_VP                 = 3,
64     MOS_SUBCOMP_CP                 = 4,
65     MOS_SUBCOMP_EXT                = 5,
66     MOS_SUBCOMP_COUNT
67 } MOS_SELF_SUBCOMP_ID;
68 
69 //!
70 //! \brief Define MHW Sub-Component IDs
71 //!
72 typedef enum
73 {
74     MOS_HW_SUBCOMP_ALL               = 0,
75     MOS_HW_SUBCOMP_COUNT
76 } MOS_HW_SUBCOMP_ID;
77 
78 // Define CodecHal Sub-Component IDs
79 typedef enum
80 {
81     MOS_CODEC_SUBCOMP_DDI          = 0,        // DDI files.
82     MOS_CODEC_SUBCOMP_DECODE       = 1,        // Decoders
83     MOS_CODEC_SUBCOMP_ENCODE       = 2,        // Encoders
84     MOS_CODEC_SUBCOMP_HW           = 3,        // HW interface
85     MOS_CODEC_SUBCOMP_PUBLIC       = 4,        // Public interface
86     MOS_CODEC_SUBCOMP_DEBUG        = 5,        // Debug interface
87     MOS_CODEC_SUBCOMP_CENC         = 6,        // CencDecoders
88     MOS_CODEC_SUBCOMP_COUNT                    // Must be last in the list
89 } MOS_CODEC_SUBCOMP_ID;
90 
91 // Define VpHal Sub-Component IDs
92 typedef enum
93 {
94     MOS_VP_SUBCOMP_DDI             = 0,        // DDI files.
95     MOS_VP_SUBCOMP_HW              = 1,        // HW interface
96     MOS_VP_SUBCOMP_PUBLIC          = 2,        // Public interface
97     MOS_VP_SUBCOMP_DEBUG           = 3,        // Debug interface
98     MOS_VP_SUBCOMP_RENDER          = 4,        // Render interface
99     MOS_VP_SUBCOMP_COUNT                       // Must be last in the list
100 } MOS_VP_SUBCOMP_ID;
101 
102 // Define CP Sub-Component IDs
103 // Mote: please update the diagram above __MOS_USER_FEATURE_KEY_SUB_COMPONENT_CP_TAG
104 //       in mos_util_user_feature_keys.h if you change this enum.
105 typedef enum
106 {
107     MOS_CP_SUBCOMP_DDI              = 0,             // CP-related DDIs
108     MOS_CP_SUBCOMP_DEVICE           = 1,             // The CP device class
109     MOS_CP_SUBCOMP_OS               = 2,             // The CP OS services classes
110     MOS_CP_SUBCOMP_PCH_HAL          = 3,             // The CP PCH HAL class
111     MOS_CP_SUBCOMP_GPU_HAL          = 4,             // The CP GPU HAL classes
112     MOS_CP_SUBCOMP_CODEC            = 5,             // Content Protection portions of the Codec UMD
113     MOS_CP_SUBCOMP_UMD_CONTEXT      = 6,             // Content Protection portions of UMD device context
114     MOS_CP_SUBCOMP_CMD_BUFFER       = 7,             // Content Protection Command buffer class
115     MOS_CP_SUBCOMP_SECURESESSION    = 8,             // The secure session classes
116     MOS_CP_SUBCOMP_AUTHCHANNEL      = 9,             // The AuthChannel classes
117     MOS_CP_SUBCOMP_DLL              = 10,            // CP DLL classes
118     MOS_CP_SUBCOMP_LIB              = 11,            // Lib classes
119     MOS_CP_SUBCOMP_MHW              = 12,            // CP MHW classes
120     MOS_CP_SUBCOMP_PROTECTEDSESSION = 13,            // Protected session class
121     MOS_CP_SUBCOMP_PROTECTED_RESOURCE_SESSION = 14,  // Protected Resource session class
122     MOS_CP_SUBCOMP_TEE_HAL          = 15,            // CP TEE HAL class
123     MOS_CP_SUBCOMP_CAPS             = 16,            // CP CAPS clas
124     MOS_CP_SUBCOMP_CPLIB            = 17,            // CP CPLIB interacting
125     MOS_CP_SUBCOMP_CENC             = 18,            // CP cenc class
126     MOS_CP_SUBCOMP_COUNT                             // Must be last in the list
127 } MOS_CP_SUBCOMP_ID;
128 
129 //!
130 //! \brief Define DDI Sub-Component IDs
131 //!
132 typedef enum
133 {
134     MOS_DDI_SUBCOMP_SELF           = 0,
135     MOS_DDI_SUBCOMP_COUNT
136 } MOS_DDI_SUBCOMP_ID;
137 
138 //!
139 //! \brief Define CM Sub-Component IDs
140 //!
141 typedef enum
142 {
143     MOS_CM_SUBCOMP_DDI             = 0,   // DDI files.
144     MOS_CM_SUBCOMP_SELF            = 1,
145     MOS_CM_SUBCOMP_PUBLIC          = 2,   // Public interface
146     MOS_CM_SUBCOMP_RENDERHAL       = 3,
147     MOS_CM_SUBCOMP_COUNT
148 } MOS_CM_SUBCOMP_ID;
149 
150 //!
151 //! \brief Define Scalability Sub-Component IDs
152 //!
153 typedef enum
154 {
155     MOS_SCALABILITY_SUBCOMP_SELF   = 0,
156     MOS_SCALABILITY_SUBCOMP_COUNT
157 } MOS_SCALABILITY_SUBCOMP_ID;
158 
159 //!
160 //! \brief Define MMC Sub-Component IDs
161 //!
162 typedef enum
163 {
164     MOS_MMC_SUBCOMP_SELF   = 0,
165     MOS_MMC_SUBCOMP_COUNT
166 } MOS_MMC_SUBCOMP_ID;
167 
168 //!
169 //! \brief Define media copy Sub-Component IDs
170 //!
171 typedef enum
172 {
173     MOS_MCPY_SUBCOMP_SELF   = 0,
174     MOS_MCPY_SUBCOMP_BLT,
175     MOS_MCPY_SUBCOMP_VEBOX,
176     MOS_MCPY_SUBCOMP_RENDER,
177     MOS_MCPY_SUBCOMP_COUNT
178 } MOS_MCPY_SUBCOMP_ID;
179 
180 //!
181 //! \brief Define messaging levels here in the order of importance
182 //!
183 typedef enum
184 {
185     MOS_MESSAGE_LVL_DISABLED                  = 0,
186     MOS_MESSAGE_LVL_CRITICAL                  = 1,
187     MOS_MESSAGE_LVL_NORMAL                    = 2,
188     MOS_MESSAGE_LVL_VERBOSE                   = 3,
189     MOS_MESSAGE_LVL_FUNCTION_ENTRY            = 4,
190     MOS_MESSAGE_LVL_FUNCTION_EXIT             = 5,
191     MOS_MESSAGE_LVL_FUNCTION_ENTRY_VERBOSE    = 6,
192     MOS_MESSAGE_LVL_MEMNINJA                  = 7,
193     MOS_MESSAGE_LVL_COUNT
194 } MOS_MESSAGE_LEVEL;
195 
196 //!
197 //! \brief Define Component IDs
198 //! When adding a component, need to update
199 //!   MOS_COMPONENT_ID,
200 //!   MOS_ComponentName,
201 //!   pcComponentUserFeatureKeys,
202 //!   subComponentCount
203 //!   and MOS_MESSAGE_COMPONENT_TAG.
204 //!
205 typedef enum
206 {
207     MOS_COMPONENT_OS,
208     MOS_COMPONENT_HW,
209     MOS_COMPONENT_CODEC,
210     MOS_COMPONENT_VP,
211     MOS_COMPONENT_CP,
212     MOS_COMPONENT_DDI,
213     MOS_COMPONENT_CM,
214     MOS_COMPONENT_CPLIB,
215     MOS_COMPONENT_SCALABILITY,
216     MOS_COMPONENT_MMC,
217     MOS_COMPONENT_MCPY,
218     MOS_COMPONENT_COUNT
219 } MOS_COMPONENT_ID;
220 
221 //!
222 //! \brief MOS debug params structure, includes debug level and asserts enabled.
223 //!
224 typedef struct _MOS_DEBUG_PARAMS
225 {
226     int32_t             bAssertEnabled;
227     MOS_MESSAGE_LEVEL   uiMessageLevel;
228 } MOS_DEBUG_PARAMS;
229 
230 //!
231 //! \brief MOS component debug params structure,
232 //!        Includes a component's MOS_DEBUG_PARAMS and an array of sub-component params.
233 //!
234 typedef struct _MOS_COMPONENT_DEBUG_PARAMS
235 {
236     MOS_DEBUG_PARAMS  component;
237     int32_t           bBySubComponent;
238     MOS_DEBUG_PARAMS  subComponents[MOS_MAX_SUBCOMPONENT_COUNT];    //!< currently only 16 subcomponent for each component
239 } MOS_COMPONENT_DEBUG_PARAMS;
240 
241 //!
242 //! \brief MOS message params structure
243 //!        Initialized by MosUtilDebug::MosMessageInit() and cleared by MosUtilDebug::MosMessageClose()
244 //!
245 typedef struct _MOS_MESSAGE_PARAMS
246 {
247     PFILE                       pLogFile;
248     PFILE                       pTraceFile;
249     uint32_t                    uiCounter;
250     int32_t                     bUseHybridLogTrace;                             //!< Log debug messages and trace dumps to a file or not
251     int32_t                     bUseOutputDebugString;                          //!< Onscreen debug message prints enabled or not
252     uint32_t                    bEnableMaps;                                    //!< Dump mapped memory regions to trace file
253     uint32_t                    bDisableAssert;                                 //!< Disable assert
254     uint32_t                    bEnableFlush;                                   //!< Enable flush
255     uint32_t                    bEnableMemoryFootPrint;                        //!< Disable Memory Foot Print
256     MOS_COMPONENT_DEBUG_PARAMS  components[MOS_COMPONENT_COUNT];
257     char                        g_MosMsgBuffer[MOS_MAX_MSG_BUF_SIZE];           //!< Array for debug message
258 } MOS_MESSAGE_PARAMS;
259 
260 //!
261 //! When printing from a C++ class, we'd like the class and function to be printed.
262 //! With our current Linux compiler, __FUNCTION__ does not include the class name.
263 //! So we use __PRETTY_FUNCTION__ and MOS_Message will remove extra data.
264 //! This is not needed for prints from C files so they will usually use __FUNCTION__.
265 //!
266 
267 #if USE_PRETTY_FUNCTION
268 #define MOS_FUNCTION __PRETTY_FUNCTION__
269 #else
270 #define MOS_FUNCTION __FUNCTION__
271 #endif // USE_PRETTY_FUNCTION
272 #endif
273 
274 class MosUtilDebug
275 {
276 public:
277     MosUtilDebug()          = delete;
278     ~MosUtilDebug()         = delete;
279 
280 #if MOS_MESSAGES_ENABLED
281     //!
282     //! \brief    Initialize the MOS message params structure and HLT.
283     //! \details  Initialize the MOS message params structure and HLT,
284     //!           to be called during device creation
285     //! \param    [in] mosCtx
286     //!           os device ctx handle
287     //! \return   void
288     //!
289     static void MosMessageInit(MediaUserSettingSharedPtr userSettingPtr);
290 
291     //!
292     //! \brief    Frees the MOS message buffer and MOS message parameters structure
293     //! \details  Frees the MOS message buffer and MOS message parameters structure,
294     //!           to be called during device destruction
295     //! \return   void
296     //!
297     static void MosMessageClose();
298 
299     //!
300     //! \brief    Close file handles and frees resources
301     //! \details  Close file handles and frees resources,
302     //!           and reopen file handles.To be called before workload submission
303     //! \return   void
304     //!
305     static void MosHLTFlush();
306 
307     //!
308     //! \brief    Disable Memory Foot Print
309     //! \details  Disable Memory Foot Print
310     //! \return   bool
311     //!
312     static bool EnableMemoryFootPrint();
313 
314     //!
315     //! \brief    Form a string that will prefix MOS's log file name
316     //! \details  Form a string that will prefix MOS's log file name
317     //!           The default log file location will be under
318     //!           %ProgramData%\Intel\Logs or %DriverData%\Intel\Logs
319     //!           depending on OS version
320     //! \param    PCHAR fileNamePrefix
321     //!           [out] Pointer to the string where the prefix is returned
322     //! \param    [in] userSettingPtr
323     //!           MediaUserSettingSharedPtr
324     //! \return   MOS_STATUS
325     //!           Returns one of the MOS_STATUS error codes if failed,
326     //!           else MOS_STATUS_SUCCESS
327     //!
328     static MOS_STATUS MosLogFileNamePrefix(char *fileNamePrefix, MediaUserSettingSharedPtr userSettingPtr);
329 
330     //!
331     //! \brief    Enable or disable asserts of a particular component, it is used by ULT also
332     //! \details  Enable or disable asserts of a particular component
333     //! \param    MOS_COMPONENT_ID compID
334     //!           [in] Indicates which component
335     //! \param    int32_t bEnable
336     //!           [in] Enable/disable flag
337     //! \return   void
338     //!
339     static void MosCompAssertEnableDisable(MOS_COMPONENT_ID compID, int32_t bEnable);
340 
341     //!
342     //! \brief    Prints debug messages in debug mode when enabled
343     //! \details  Prints debug messages if the level of the comp and sub-comp is
344     //!           set to less than the message level. Nop in release version.
345     //! \param    MOS_MESSAGE_LEVEL level
346     //!           [in] Level of the message
347     //! \param    MOS_COMPONENT_ID compID
348     //!           [in] Indicates which component
349     //! \param    uint8_t subCompID
350     //!           [in] Indicates which sub-component
351     //! \param    const PCHAR functionName
352     //!           [in] pointer to the function name
353     //! \param    int32_t lineNum
354     //!           [in] Indicates which line the message locate, -1 for no line output
355     //! \param    const PCHAR message
356     //!           [in] pointer to the message format string
357     //! \param    var_args
358     //!           [in] variable list of arguments for the message
359     //! \return   VOID
360     //!
361     static void MosMessage(
362         MOS_MESSAGE_LEVEL level,
363         MOS_COMPONENT_ID  compID,
364         uint8_t           subCompID,
365         const PCCHAR      functionName,
366         int32_t           lineNum,
367         const PCCHAR      message,
368         ...);
369 
370     //!
371     //! \brief    Prints debug messages in debug mode when enabled
372     //! \details  Prints debug messages if the level of the comp and sub-comp is
373     //!           set to less than the message level. Nop in release version.
374     //! \param    MOS_MESSAGE_LEVEL level
375     //!           [in] Level of the message
376     //! \param    MOS_COMPONENT_ID compID
377     //!           [in] Indicates which component
378     //! \param    uint8_t subCompID
379     //!           [in] Indicates which sub-component
380     //! \param    const PCHAR functionName
381     //!           [in] pointer to the function name
382     //! \param    int32_t lineNum
383     //!           [in] Indicates which line the message locate, -1 for no line output
384     //! \param    const PCHAR message
385     //!           [in] pointer to the message format string
386     //! \param    var_args
387     //!           [in] variable list of arguments for the message
388     //! \return   VOID
389     //!
390     static void MosMessageInternal(
391         MOS_MESSAGE_LEVEL level,
392         MOS_COMPONENT_ID  compID,
393         uint8_t           subCompID,
394         const PCCHAR      functionName,
395         int32_t           lineNum,
396         const PCCHAR      message,
397         va_list           var_args);
398 
399     //!
400     //! \brief    Checks whether debug messages should be printed.
401     //! \details  Determines by the print level, component and sub-component IDs
402     //!           whether the debug message should be printed.
403     //! \param    MOS_MESSAGE_LEVEL level
404     //!           [in] Level of the message
405     //! \param    MOS_COMPONENT_ID compID
406     //!           [in] Indicates which component
407     //! \param    uint8_t subCompID
408     //!           [in] Indicates which sub-component
409     //! \param    const char  *message
410     //!           [in] pointer to the message format string
411     //! \return   int32_t
412     //!
413     static int32_t MosShouldPrintMessage(
414         MOS_MESSAGE_LEVEL level,
415         MOS_COMPONENT_ID  compID,
416         uint8_t           subCompID,
417         const char *const message);
418 #endif
419 
420 #if MOS_ASSERT_ENABLED
421     //!
422     //! \brief    MOS assert function for MOS internal use
423     //! \details  Halts the cpu in debug mode when expression resolves to zero
424     //!           and only if assert enabled for both comp and sub-comp.
425     //!           Nop in release version
426     //!           Called by MOS_ASSERT macro only
427     //! \param    MOS_COMPONENT_ID compID
428     //!           [in] Indicates which component
429     //! \param    uint8_t subCompID
430     //!           [in] Indicates which sub-component
431     //! \return   void
432     //!
433     static void MosAssert(
434         MOS_COMPONENT_ID compID,
435         uint8_t          subCompID);
436 
437 #endif // MOS_ASSERT_ENABLED
438 
439 private:
440 
441 #if MOS_MESSAGES_ENABLED
442     //!
443     //! \brief    Add preface information to the HLT log when initialized
444     //! \details  Add preface information to the HLT log when initialized
445     //!           Used internally by MOS_HLTInit().
446     //! \param    PFILE pFile
447     //!           [out] Pointer to the log file
448     //! \return   void
449     //!
450     static void MosHltpPreface(
451         PFILE            pFile);
452 
453     /*----------------------------------------------------------------------------
454     | Name      : MOS_HltpCopyFile
455     | Purpose   : Copy all file content from the source file to the target file.
456     | Arguments : szFileName - source file name to copy from
457     |             pFile - target file
458     | Returns   : Returns one of the MOS_STATUS error codes if failed,
459     |             else MOS_STATUS_SUCCESS
460     | Comments  :
461     \---------------------------------------------------------------------------*/
462     static MOS_STATUS MosHltpCopyFile(PFILE pFile, const PCCHAR szFileName);
463 
464     //!
465     //! \brief    Set debug message level for a sub-component within a component
466     //! \details  Set debug message level for a sub-component within a component
467     //! \param    MOS_COMPONENT_ID compID
468     //!           [in] Indicates which component
469     //! \param    uint8_t subCompID
470     //!           [in] Indicates which sub-component
471     //! \param    MOS_MESSAGE_LEVEL msgLevel
472     //!           [in] Message level that the sub component allows
473     //! \return   void
474     //!
475     static void MosSetSubCompMessageLevel(MOS_COMPONENT_ID compID, uint8_t subCompID, MOS_MESSAGE_LEVEL msgLevel);
476 
477     //!
478     //! \brief    Set debug message level for a particular component
479     //! \details  Set debug message level for a particular component
480     //! \param    MOS_COMPONENT_ID compID
481     //!           [in] Indicates which component
482     //! \param    MOS_MESSAGE_LEVEL msgLevel
483     //!           [in] Message level that the component allows
484     //! \return   void
485     //!
486     static void MosSetCompMessageLevel(MOS_COMPONENT_ID compID, MOS_MESSAGE_LEVEL msgLevel);
487 
488     //!
489     //! \brief    Set debug message level for all components
490     //! \details  Set all component to the same msg level
491     //! \param    MOS_MESSAGE_LEVEL msgLevel
492     //!           [in] Message level that all components allow
493     //! \return   void
494     //!
495     static void MosSetCompMessageLevelAll(MOS_MESSAGE_LEVEL msgLevel);
496 
497     //!
498     //! \brief    Enable/disable asserts for a sub-component within a component
499     //! \details  Enable/disable asserts for a sub-component within a component
500     //! \param    MOS_COMPONENT_ID compID
501     //!           [in] Indicates which component
502     //! \param    uint8_t subCompID
503     //!           [in] Indicates which sub-component
504     //! \param    int32_t iFlag
505     //!           [in] Enable/disable flag
506     //! \return   void
507     //!
508     static void MosSubCompAssertEnableDisable(MOS_COMPONENT_ID compID, uint8_t subCompID, int32_t bEnable);
509 
510     //!
511     //! \brief    Set debug message level and asserts for a component and its sub-components.
512     //! \details  Set debug message level and asserts for a component and its sub-components.
513     //!              This includes registering all sub-components.
514     //! \param    MOS_COMPONENT_ID compID
515     //!           [in] Indicates which component
516     //! \param    [in] mosCtx
517     //!           os device ctx handle
518     //! \return   void
519     //!
520     static void MosMessageInitComponent(MOS_COMPONENT_ID compID, MediaUserSettingSharedPtr userSettingPtr);
521 
522     //!
523     //! \brief    Initialize or refresh the Hybrid Log and Trace facility
524     //! \details  Initialize or refresh the Hybrid Log and Trace facility
525     //!           Called during MOS init
526     //! \param    [in] mosCtx
527     //!           os device ctx handle
528     //! \return   MOS_STATUS
529     //!           Returns one of the MOS_STATUS error codes if failed,
530     //!           else MOS_STATUS_SUCCESS
531     //!
532     static MOS_STATUS MosHLTInit( MediaUserSettingSharedPtr userSettingPtr);
533 
534     //!
535     //! \brief    Close file handles and frees resources
536     //! \details  Close file handles and frees resources
537     //!           Called during MOS close
538     //! \return   void
539     //!
540     static void MosHLTClose();
541 
542 #if USE_PRETTY_FUNCTION
543     //!
544     //! \brief    Converts a __PRETTY_FUNCTION__ into Class::Method
545     //! \details  Converts a __PRETTY_FUNCTION__ into Class::Method to allow prettier debug output
546     //! \param    PCCHAR pcPrettyFunction
547     //!           [in] in the form of "TYPE [CLASS::]FUNCTION(INPUT LIST)"
548     //! \return   PCCHAR in the form of [CLASS::]FUNCTION
549     //!
550     static PCCHAR MosGetClassMethod(PCCHAR pcPrettyFunction);
551 #endif
552 
553 #endif // MOS_MESSAGES_ENABLED
554 
555 #if MOS_ASSERT_ENABLED
556     //!
557     //! \brief    Checks whether assert should be hit.
558     //! \details  Determines by the component and sub-component IDs
559     //!           whether an assert should be hit.
560     //! \param    MOS_COMPONENT_ID compID
561     //!           [in] Indicates which component
562     //! \param    uint8_t subCompID
563     //!           [in] Indicates which sub-component
564     //! \return   int32_t
565     //!
566     static int32_t MosShouldAssert(MOS_COMPONENT_ID compID, uint8_t subCompID);
567 #endif
568 public:
569 #if MOS_MESSAGES_ENABLED
570 
571     static const char * const m_mosLogLevelName[MOS_MESSAGE_LVL_COUNT];
572     static const char * const m_mosComponentName[MOS_COMPONENT_COUNT];
573 
574     //Temporarily defined as the reference to compatible with the cases using uf key to enable/disable APG.
575     static MOS_MESSAGE_PARAMS m_mosMsgParams;
576     static const char* m_pcComponentUserFeatureKeys[MOS_COMPONENT_COUNT][3];
577     static const uint8_t m_subComponentCount[MOS_COMPONENT_COUNT];
578 #endif
579 MEDIA_CLASS_DEFINE_END(MosUtilDebug)
580 };
581 
582 #if MOS_ASSERT_ENABLED
583 
584 //!
585 //! \def MOS_ASSERT(_compID, _subCompID, _expr)
586 //!  If \a _expr is not true, asserts with \a _compID and \a _subCompID info
587 //!
588 #define MOS_ASSERT(_compID, _subCompID, _expr)                   \
589     if(!(_expr))                                                 \
590     {                                                            \
591         MosUtilDebug::MosAssert(_compID, _subCompID);            \
592     }
593 
594 #else // MOS_ASSERT_ENABLED
595 
596 #define MOS_ASSERT(_compID, _subCompID, _expr)
597 
598 #endif // MOS_ASSERT_ENABLED
599 
600 #if MOS_MESSAGES_ENABLED
601 
602 // flush hlt message before workload submission
603 #define MOS_FLUSH_HLT_MESSAGE MosUtilDebug::MosHLTFlush();
604 
605 #define MOS_IS_MEMORY_FOOT_PRINT_ENABLED() MosUtilDebug::EnableMemoryFootPrint()
606 
607 
608 //!
609 //! \def MOS_DEBUGMESSAGE(_compID, _subCompID, _message, ...)
610 //!  Output DEBUG message \a _message with \_a _compID and \_a _subCompID info
611 //!
612 #define MOS_DEBUGMESSAGE(_level, _compID, _subCompID, _message, ...)                        \
613     MosUtilDebug::MosMessage(_level, _compID, _subCompID, MOS_FUNCTION, __LINE__, _message, ##__VA_ARGS__)
614 
615 //!
616 //! \def MOS_DEBUGMESSAGE(_compID, _subCompID, _message, ...)
617 //!  Output DEBUG message \a _message with \_a _compID and \_a _subCompID info
618 //!
619 #define MOS_DEBUGMESSAGE_NOLINE(_level, _compID, _subCompID, _message, ...)                 \
620     MosUtilDebug::MosMessage(_level, _compID, _subCompID, MOS_FUNCTION, -1, _message, ##__VA_ARGS__)
621 
622 //!
623 //! \def MOS_FUNCTION_ENTER(_compID, _subCompID)
624 //!  Output ENTRY message with \_a _compID and \_a _subCompID info
625 //!
626 #define MOS_FUNCTION_ENTER(_compID, _subCompID)                                             \
627     MOS_DEBUGMESSAGE_NOLINE(MOS_MESSAGE_LVL_FUNCTION_ENTRY, _compID, _subCompID, "")
628 
629 //!
630 //! \def MOS_FUNCTION_EXIT(_compID, _subCompID, hr)
631 //!  Output EXIT message with \_a _compID and \_a _subCompID info and the result hr.
632 //!
633 #define MOS_FUNCTION_EXIT(_compID, _subCompID, eStatus)                                           \
634     MOS_DEBUGMESSAGE_NOLINE(MOS_MESSAGE_LVL_FUNCTION_EXIT, _compID, _subCompID, ": eStatus = 0x%x", eStatus)
635 
636 //!
637 //! \def MOS_FUNCTION_ENTER_VERBOSE(_compID, _subCompID)
638 //!  Output VERBOSE ENTRY message with \_a _compID and \_a _subCompID info
639 //!
640 #define MOS_FUNCTION_ENTER_VERBOSE(_compID, _subCompID)                                     \
641     MOS_DEBUGMESSAGE(MOS_MESSAGE_LVL_FUNCTION_ENTRY_VERBOSE, _compID, _subCompID, "")
642 
643 //!
644 //! \def MOS_CRITICALMESSAGE(_compID, _subCompID, _message, ...)
645 //!  Output DEBUG message \a _message with \_a _compID and \_a _subCompID info
646 //!
647 #define MOS_CRITICALMESSAGE(_compID, _subCompID, _message, ...)                             \
648     MOS_DEBUGMESSAGE(MOS_MESSAGE_LVL_CRITICAL, _compID, _subCompID, _message, ##__VA_ARGS__)
649 
650 //!
651 //! \def MOS_ASSERTMESSAGE(_compID, _subCompID, _message, ...)
652 //!  Output CRITICAL message \a _message with \_a _compID and \_a _subCompID info
653 //!  and triggers an assert.
654 //!
655 #define MOS_ASSERTMESSAGE(_compID, _subCompID, _message, ...)                               \
656     MOS_CRITICALMESSAGE(_compID, _subCompID, _message, ##__VA_ARGS__);                      \
657     MOS_ASSERT(_compID, _subCompID, false);
658 
659 //!
660 //! \def MOS_NORMALMESSAGE(_compID, _subCompID, _message, ...)
661 //!  Output NORMAL message \a _message with \_a _compID and \_a _subCompID info
662 //!
663 #define MOS_NORMALMESSAGE(_compID, _subCompID, _message, ...)                               \
664     MOS_DEBUGMESSAGE(MOS_MESSAGE_LVL_NORMAL, _compID, _subCompID, _message, ##__VA_ARGS__)
665 
666 //!
667 //! \def MOS_VERBOSEMESSAGE(_compID, _subCompID, _message, ...)
668 //!  Output DEBUG message \a _message with \_a _compID and \_a _subCompID info
669 //!
670 #define MOS_VERBOSEMESSAGE(_compID, _subCompID, _message, ...)                              \
671     MOS_DEBUGMESSAGE(MOS_MESSAGE_LVL_VERBOSE, _compID, _subCompID, _message, ##__VA_ARGS__)
672 
673 //!
674 //! \def MOS_MEMNINJAMESSAGE(_compID, _subCompID, _message, ...)
675 //!  Output DEBUG message \a _message with \_a _compID and \_a _subCompID info
676 //!
677 #define MOS_MEMNINJAMESSAGE(_compID, _subCompID, _message, ...)                             \
678     MOS_DEBUGMESSAGE(MOS_MESSAGE_LVL_MEMNINJA, _compID, _subCompID, _message, ##__VA_ARGS__)
679 
680 //!
681 //! \def MOS_DEBUGMESSAGE_IF(_cond, _level, _compID, _subCompID, _message, ...)
682 //!  If \a _cond is true, output message \a _message of level \a _level with
683 //!  \_a _compID and \_a _subCompID info
684 //!
685 #define MOS_DEBUGMESSAGE_IF(_cond, _level, _compID, _subCompID, _message, ...)              \
686     if (_cond)                                                                              \
687     {                                                                                       \
688         MOS_DEBUGMESSAGE(_level, _compID, _subCompID, _message, ##__VA_ARGS__);             \
689     }
690 
691 //!
692 //! \def MOS_TraceEventExt
693 //!  this is trace event interface extension, only for debug purpose.
694 //!
695 #define MOS_TraceEventExt MOS_TraceEvent
696 #define MOS_TraceDumpExt  MOS_TraceDataDump
697 
698 #define MOS_TraceDataExt0 MOS_TraceData0
699 #define MOS_TraceDataExt  MOS_TraceData
700 
701 //!
702 //! \def New trace interface with keyword filter, need have at least 1 param in trace data
703 //!
704 #define MOS_TraceDecodePicParam(usId, usType, ...)                                 \
705     if (MosUtilities::TraceKeyEnabled(TR_KEY_DECODE_PICPARAM))                     \
706     {                                                                              \
707         TR_FILL_PARAM(__VA_ARGS__);                                                \
708         TR_WRITE_PARAM(MosUtilities::MosTraceEvent, usId, usType);                 \
709     }
710 #define MOS_TraceDecodeSliceParam(usId, usType, ...)                               \
711     if (MosUtilities::TraceKeyEnabled(TR_KEY_DECODE_SLICEPARAM))                   \
712     {                                                                              \
713         TR_FILL_PARAM(__VA_ARGS__);                                                \
714         TR_WRITE_PARAM(MosUtilities::MosTraceEvent, usId, usType);                 \
715     }
716 #define MOS_TraceDecodeTileParam(usId, usType, ...)                                \
717     if (MosUtilities::TraceKeyEnabled(TR_KEY_DECODE_TILEPARAM))                    \
718     {                                                                              \
719         TR_FILL_PARAM(__VA_ARGS__);                                                \
720         TR_WRITE_PARAM(MosUtilities::MosTraceEvent, usId, usType);                 \
721     }
722 #define MOS_TraceDecodeQMatrix(usId, usType, ...)                                  \
723     if (MosUtilities::TraceKeyEnabled(TR_KEY_DECODE_QMATRIX))                      \
724     {                                                                              \
725         TR_FILL_PARAM(__VA_ARGS__);                                                \
726         TR_WRITE_PARAM(MosUtilities::MosTraceEvent, usId, usType);                 \
727     }
728 #define MOS_TraceDecodeBitStreamInfo(usId, usType, ...)                                  \
729     if (MosUtilities::TraceKeyEnabled(TR_KEY_DECODE_BITSTREAM_INFO))                     \
730     {                                                                                    \
731         TR_FILL_PARAM(__VA_ARGS__);                                                      \
732         TR_WRITE_PARAM(MosUtilities::MosTraceEvent, usId, usType);                       \
733     }
734 #define MOS_TraceDecodeBitStream(usId, usType, ...)                                \
735     if (MosUtilities::TraceKeyEnabled(TR_KEY_DECODE_BITSTREAM))                    \
736     {                                                                              \
737         TR_FILL_PARAM(__VA_ARGS__);                                                \
738         TR_WRITE_PARAM(MosUtilities::MosTraceEvent, usId, usType);                 \
739     }
740 #define MOS_TraceDecodeInternal(usId, usType, ...)                                 \
741     if (MosUtilities::TraceKeyEnabled(TR_KEY_DECODE_INTERNAL))                     \
742     {                                                                              \
743         TR_FILL_PARAM(__VA_ARGS__);                                                \
744         TR_WRITE_PARAM(MosUtilities::MosTraceEvent, usId, usType);                 \
745     }
746 #define MOS_TraceDecodeCommand(usId, usType, ...)                                  \
747     if (MosUtilities::TraceKeyEnabled(TR_KEY_DECODE_COMMAND))                      \
748     {                                                                              \
749         TR_FILL_PARAM(__VA_ARGS__);                                                \
750         TR_WRITE_PARAM(MosUtilities::MosTraceEvent, usId, usType);                 \
751     }
752 #define MOS_TraceDecodeDstYuv(usId, usType, ...)                                   \
753     if (MosUtilities::TraceKeyEnabled(TR_KEY_DECODE_DSTYUV))                       \
754     {                                                                              \
755         TR_FILL_PARAM(__VA_ARGS__);                                                \
756         TR_WRITE_PARAM(MosUtilities::MosTraceEvent, usId, usType);                 \
757     }
758 #define MOS_TraceDecodeRefYuv(usId, usType, ...)                                   \
759     if (MosUtilities::TraceKeyEnabled(TR_KEY_DECODE_REFYUV))                       \
760     {                                                                              \
761         TR_FILL_PARAM(__VA_ARGS__);                                                \
762         TR_WRITE_PARAM(MosUtilities::MosTraceEvent, usId, usType);                 \
763     }
764 
765 #define MT_LOG(id, lvl)                                                     \
766     {                                                                       \
767         int32_t _head[] = {id, lvl};                                         \
768         MosUtilities::MosTraceEvent(EVENT_MEDIA_LOG, 0, _head, sizeof(_head), nullptr, 0); \
769     }
770 
771 #define MT_LOG1(id, lvl, p1, v1)                                                      \
772     {                                                                                 \
773         int32_t   _head[] = {id, lvl};                                                 \
774         MT_PARAM  _param[] = {p1, v1};                                                  \
775         MosUtilities::MosTraceEvent(EVENT_MEDIA_LOG, 1, _head, sizeof(_head), _param, sizeof(_param)); \
776     }
777 
778 #define MT_LOG2(id, lvl, p1, v1, p2, v2)                                              \
779     {                                                                                 \
780         int32_t   _head[] = {id, lvl};                                                 \
781         MT_PARAM  _param[] = {{p1, v1}, {p2, v2}};                                      \
782         MosUtilities::MosTraceEvent(EVENT_MEDIA_LOG, 2, _head, sizeof(_head), _param, sizeof(_param)); \
783     }
784 
785 #define MT_LOG3(id, lvl, p1, v1, p2, v2, p3, v3)                                      \
786     {                                                                                 \
787         int32_t   _head[] = {id, lvl};                                                 \
788         MT_PARAM  _param[] = {{p1, v1}, {p2, v2}, {p3, v3}};                            \
789         MosUtilities::MosTraceEvent(EVENT_MEDIA_LOG, 3, _head, sizeof(_head), _param, sizeof(_param)); \
790     }
791 
792 #define MT_LOG4(id, lvl, p1, v1, p2, v2, p3, v3, p4, v4)                              \
793     {                                                                                 \
794         int32_t   _head[] = {id, lvl};                                                 \
795         MT_PARAM  _param[] = {{p1, v1}, {p2, v2}, {p3, v3}, {p4, v4}};                  \
796         MosUtilities::MosTraceEvent(EVENT_MEDIA_LOG, 4, _head, sizeof(_head), _param, sizeof(_param)); \
797     }
798 
799 #define MT_LOG5(id, lvl, p1, v1, p2, v2, p3, v3, p4, v4, p5, v5)                                   \
800     {                                                                                              \
801         int32_t   _head[] = {id, lvl};                                                              \
802         MT_PARAM  _param[] = {{p1, v1}, {p2, v2}, {p3, v3}, {p4, v4}, {p5, v5}};                     \
803         MosUtilities::MosTraceEvent(EVENT_MEDIA_LOG, 5, _head, sizeof(_head), _param, sizeof(_param)); \
804     }
805 
806 #define MT_LOG6(id, lvl, p1, v1, p2, v2, p3, v3, p4, v4, p5, v5, p6, v6)                           \
807     {                                                                                              \
808         int32_t   _head[] = {id, lvl};                                                              \
809         MT_PARAM  _param[] = {{p1, v1}, {p2, v2}, {p3, v3}, {p4, v4}, {p5, v5}, {p6, v6}};           \
810         MosUtilities::MosTraceEvent(EVENT_MEDIA_LOG, 6, _head, sizeof(_head), _param, sizeof(_param)); \
811     }
812 
813 #define MT_LOG7(id, lvl, p1, v1, p2, v2, p3, v3, p4, v4, p5, v5, p6, v6, p7, v7)                   \
814     {                                                                                              \
815         int32_t   _head[] = {id, lvl};                                                              \
816         MT_PARAM  _param[] = {{p1, v1}, {p2, v2}, {p3, v3}, {p4, v4}, {p5, v5}, {p6, v6}, {p7, v7}}; \
817         MosUtilities::MosTraceEvent(EVENT_MEDIA_LOG, 7, _head, sizeof(_head), _param, sizeof(_param)); \
818     }
819 
820 #define MT_ERR(id)                                                          \
821     {                                                                       \
822         int32_t _head[] = {id};                                              \
823         MosUtilities::MosTraceEvent(EVENT_MEDIA_ERR, 0, _head, sizeof(_head), nullptr, 0); \
824     }
825 
826 #define MT_ERR1(id, p1, v1)                                                           \
827     {                                                                                 \
828         int32_t   _head[] = {id};                                                      \
829         MT_PARAM  _param[] = {p1, v1};                                                  \
830         MosUtilities::MosTraceEvent(EVENT_MEDIA_ERR, 1, _head, sizeof(_head), _param, sizeof(_param)); \
831     }
832 
833 #define MT_ERR2(id, p1, v1, p2, v2)                                                   \
834     {                                                                                 \
835         int32_t   _head[] = {id};                                                      \
836         MT_PARAM  _param[] = {{p1, v1}, {p2, v2}};                                      \
837         MosUtilities::MosTraceEvent(EVENT_MEDIA_ERR, 2, _head, sizeof(_head), _param, sizeof(_param)); \
838     }
839 
840 #define MT_ERR3(id, p1, v1, p2, v2, p3, v3)                                           \
841     {                                                                                 \
842         int32_t   _head[] = {id};                                                      \
843         MT_PARAM  _param[] = {{p1, v1}, {p2, v2}, {p3, v3}};                            \
844         MosUtilities::MosTraceEvent(EVENT_MEDIA_ERR, 3, _head, sizeof(_head), _param, sizeof(_param)); \
845     }
846 
847 #else // !MOS_MESSAGES_ENABLED
848 
849 #define MOS_FLUSH_HLT_MESSAGE
850 #define MOS_IS_MEMORY_FOOT_PRINT_ENABLED() 0
851 
852 //!
853 //! \brief   The two methods below are used only for debug or release internal drivers
854 //!            but are called in release drivers too.
855 //!
856 #define MOS_TraceEventExt(...)
857 #define MOS_TraceDumpExt(...)
858 #define MOS_TraceDataExt0(usId, usType)
859 #define MOS_TraceDataExt(usId, usType, ...)
860 #define MOS_TraceDecodePicParam(usId, usType, ...)
861 #define MOS_TraceDecodeSliceParam(usId, usType, ...)
862 #define MOS_TraceDecodeTileParam(usId, usType, ...)
863 #define MOS_TraceDecodeQMatrix(usId, usType, ...)
864 #define MOS_TraceDecodeBitStreamInfo(usId, usType, ...)
865 #define MOS_TraceDecodeBitStream(usId, usType, ...)
866 #define MOS_TraceDecodeInternal(usId, usType, ...)
867 #define MOS_TraceDecodeCommand(usId, usType, ...)
868 #define MOS_TraceDecodeDstYuv(usId, usType, ...)
869 #define MOS_TraceDecodeRefYuv(usId, usType, ...)
870 #define MT_LOG(id, lvl)
871 #define MT_LOG1(id, lvl, p1, v1)
872 #define MT_LOG2(id, lvl, p1, v1, p2, v2)
873 #define MT_LOG3(id, lvl, p1, v1, p2, v2, p3, v3)
874 #define MT_LOG4(id, lvl, p1, v1, p2, v2, p3, v3, p4, v4)
875 #define MT_LOG5(id, lvl, p1, v1, p2, v2, p3, v3, p4, v4, p5, v5)
876 #define MT_LOG6(id, lvl, p1, v1, p2, v2, p3, v3, p4, v4, p5, v5, p6, v6)
877 #define MT_LOG7(id, lvl, p1, v1, p2, v2, p3, v3, p4, v4, p5, v5, p6, v6, p7, v7)
878 #define MT_ERR(id)
879 #define MT_ERR1(id, p1, v1)
880 #define MT_ERR2(id, p1, v1, p2, v2)
881 #define MT_ERR3(id, p1, v1, p2, v2, p3, v3)
882 
883 #define MOS_FUNCTION_ENTER(_compID, _subCompID)
884 #define MOS_FUNCTION_EXIT(_compID, _subCompID, hr)
885 #define MOS_FUNCTION_ENTER_VERBOSE(_compID, _subCompID)
886 #define MOS_ASSERTMESSAGE(_compID, _subCompID, _message, ...)
887 #define MOS_NORMALMESSAGE(_compID, _subCompID, _message, ...)
888 #define MOS_VERBOSEMESSAGE(_compID, _subCompID, _message, ...)
889 #define MOS_CRITICALMESSAGE(_compID, _subCompID, _message, ...)
890 #define MOS_DEBUGMESSAGE_IF(_cond, _level, _compID, _subCompID, _message, ...)
891 #define MOS_DEBUGMESSAGE(_compID, _subCompID, _message, ...)
892 #define MOS_MEMNINJAMESSAGE(_compID, _subCompID, _message, ...)
893 
894 #endif // MOS_MESSAGES_ENABLED
895 
896 //------------------------------------------------------------------------------
897 // Generic Macros for use by all components.
898 //------------------------------------------------------------------------------
899 
900 //!
901 //! \def MOS_CHK_STATUS_RETURN(_compID, _subCompID, _stmt)
902 //!  Check MOS_STATUS \a _stmt, assert and return an error for failure
903 //!
904 #define MOS_CHK_STATUS_RETURN(_compID, _subCompID, _stmt)                                           \
905 {                                                                                                   \
906     MOS_STATUS stmtStatus = (MOS_STATUS)(_stmt);                                                    \
907     if (stmtStatus != MOS_STATUS_SUCCESS)                                                           \
908     {                                                                                               \
909         MOS_ASSERTMESSAGE(_compID, _subCompID, "MOS returned error, eStatus = 0x%x", stmtStatus);   \
910         MT_ERR3(MT_ERR_MOS_STATUS_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID, MT_ERROR_CODE, stmtStatus); \
911         return stmtStatus;                                                                          \
912     }                                                                                               \
913 }
914 
915 //!
916 //! \def MOS_CHK_STATUS_BREAK(_compID, _subCompID, _stmt)
917 //!  Check MOS_STATUS \a _stmt, assert and break out of current loop
918 //!
919 #define MOS_CHK_STATUS_BREAK(_compID, _subCompID, _stmt)                                       \
920 {                                                                                              \
921     eStatus = (MOS_STATUS)(_stmt);                                                             \
922     if (eStatus != MOS_STATUS_SUCCESS)                                                         \
923     {                                                                                          \
924         MOS_ASSERTMESSAGE(_compID, _subCompID, "MOS returned error, eStatus = 0x%x", eStatus); \
925         MT_ERR3(MT_ERR_MOS_STATUS_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID, MT_ERROR_CODE, eStatus); \
926         break;                                                                                 \
927     }                                                                                          \
928 }
929 
930 //!
931 //! \def MOS_CHK_STATUS_MESSAGE_RETURN(_compID, _subCompID, _stmt, _message, ...)
932 //!  Check MOS_STATUS \a _stmt, assert and return an error for failure, and print message
933 //!
934 #define MOS_CHK_STATUS_MESSAGE_RETURN(_compID, _subCompID, _stmt, _message, ...)\
935 {                                                                               \
936     MOS_STATUS stmtStatus = (MOS_STATUS)(_stmt);                                \
937     if (stmtStatus != MOS_STATUS_SUCCESS)                                       \
938     {                                                                           \
939         MOS_ASSERTMESSAGE(_compID, _subCompID, _message, ##__VA_ARGS__);        \
940         MT_ERR3(MT_ERR_MOS_STATUS_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID, MT_ERROR_CODE, stmtStatus); \
941         return stmtStatus;                                                      \
942     }                                                                           \
943 }
944 
945 //!
946 //! \def MOS_CHK_NULL_RETURN(_compID, _subCompID, _ptr)
947 //!  Check if \a _ptr == nullptr, if so assert and return an error
948 //!
949 #define MOS_CHK_NULL_RETURN(_compID, _subCompID, _ptr)                      \
950 {                                                                           \
951     if ((_ptr) == nullptr)                                                  \
952     {                                                                       \
953         MOS_ASSERTMESSAGE(_compID, _subCompID, "Invalid (nullptr) Pointer.");  \
954         MT_ERR2(MT_ERR_NULL_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID); \
955         return MOS_STATUS_NULL_POINTER;                                     \
956     }                                                                       \
957 }
958 
959 //!
960 //! \def MOS_CHK_NULL_RETURN(_compID, _subCompID, _ptr)
961 //!  Check if \a _ptr == nullptr, if so assert and return an error
962 //!
963 #define MOS_CHK_NULL_MESSAGE_RETURN(_compID, _subCompID, _ptr, _message, ...)       \
964     {                                                                               \
965         if ((_ptr) == nullptr)                                                      \
966         {                                                                           \
967             MOS_ASSERTMESSAGE(_compID, _subCompID, _message, ##__VA_ARGS__);        \
968             MT_ERR2(MT_ERR_NULL_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID); \
969             return MOS_STATUS_NULL_POINTER;                                         \
970         }                                                                           \
971     }
972 
973 
974 //!
975 //! \def MOS_CHK_STATUS(_compID, _subCompID, _stmt)
976 //!  Check MOS_STATUS \a _stmt, assert and return an error for failure
977 //!
978 #define MOS_CHK_STATUS(_compID, _subCompID, _stmt)                                             \
979 {                                                                                              \
980     eStatus = (MOS_STATUS)(_stmt);                                                             \
981     if (eStatus != MOS_STATUS_SUCCESS)                                                         \
982     {                                                                                          \
983         MOS_ASSERTMESSAGE(_compID, _subCompID, "MOS returned error, eStatus = 0x%x", eStatus); \
984         MT_ERR2(MT_ERR_MOS_STATUS_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID); \
985         goto finish;                                                                           \
986     }                                                                                          \
987 }
988 
989 //!
990 //! \def MOS_CHK_STATUS_MESSAGE(_compID, _subCompID, _stmt, _message, ...)
991 //!  Check MOS_STATUS \a _stmt, assert and return an error for failure, and print message
992 //!
993 #define MOS_CHK_STATUS_MESSAGE(_compID, _subCompID, _stmt, _message, ...)                   \
994 {                                                                                           \
995     eStatus = (MOS_STATUS)(_stmt);                                                          \
996     if (eStatus != MOS_STATUS_SUCCESS)                                                      \
997     {                                                                                       \
998         MT_ERR2(MT_ERR_MOS_STATUS_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID); \
999         MOS_ASSERTMESSAGE(_compID, _subCompID, _message, ##__VA_ARGS__);                    \
1000         goto finish;                                                                        \
1001     }                                                                                       \
1002 }
1003 
1004 //!
1005 //! \def MOS_CHK_STATUS_NO_STATUS_RETURN(_compID, _subCompID, _stmt)
1006 //!  Check MOS_STATUS \a _stmt, return void
1007 //!
1008 #define MOS_CHK_STATUS_NO_STATUS_RETURN(_compID, _subCompID, _stmt)                         \
1009 {                                                                                           \
1010     MOS_STATUS stmtStatus = (MOS_STATUS)(_stmt);                                                          \
1011     if (stmtStatus != MOS_STATUS_SUCCESS)                                                      \
1012     {                                                                                       \
1013         MT_ERR3(MT_ERR_MOS_STATUS_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID, MT_ERROR_CODE, stmtStatus); \
1014         MOS_ASSERTMESSAGE(_compID, _subCompID, "MOS returned error, eStatus = 0x%x", stmtStatus);\
1015         return;                                                                             \
1016     }                                                                                       \
1017 }
1018 
1019 //!
1020 //! \def MOS_CHK_STATUS_SAFE(_stmt)
1021 //!  Check MOS_STATUS \a _stmt, return for failure
1022 //!
1023 #define MOS_CHK_STATUS_SAFE(_stmt)                                                          \
1024 {                                                                                           \
1025     eStatus = (MOS_STATUS)(_stmt);                                                          \
1026     if (eStatus != MOS_STATUS_SUCCESS)                                                      \
1027     {                                                                                       \
1028         goto finish;                                                                        \
1029     }                                                                                       \
1030 }
1031 
1032 //!
1033 //! \def MOS_CHK_NULL(_compID, _subCompID, _ptr)
1034 //!  Check if \a _ptr == nullptr, if so assert and return an error
1035 //!
1036 #define MOS_CHK_NULL(_compID, _subCompID, _ptr)                                             \
1037 {                                                                                           \
1038     if ((_ptr) == nullptr)                                                                  \
1039     {                                                                                       \
1040         MOS_ASSERTMESSAGE(_compID, _subCompID, "Invalid (nullptr) Pointer.");               \
1041         MT_ERR2(MT_ERR_NULL_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID);   \
1042         eStatus = MOS_STATUS_NULL_POINTER;                                                  \
1043         goto finish;                                                                        \
1044     }                                                                                       \
1045 }
1046 
1047 //!
1048 //! \def MOS_CHK_NULL_NO_STATUS(_compID, _subCompID, _ptr)
1049 //!  Assert and print a message if \a _ptr == nullptr, but not set an error
1050 //!
1051 #define MOS_CHK_NULL_NO_STATUS(_compID, _subCompID, _ptr)                                   \
1052 {                                                                                           \
1053     if ((_ptr) == nullptr)                                                                  \
1054     {                                                                                       \
1055         MOS_ASSERTMESSAGE(_compID, _subCompID, "Invalid (nullptr) Pointer.");               \
1056         MT_ERR2(MT_ERR_NULL_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID);   \
1057         goto finish;                                                                        \
1058     }                                                                                       \
1059 }
1060 
1061 //!
1062 //! \def MOS_CHK_NULL_NO_STATUS_RETURN(_compID, _subCompID, _ptr)
1063 //!  Assert and print a message if \a _ptr == nullptr, but not set an error
1064 //!
1065 #define MOS_CHK_NULL_NO_STATUS_RETURN(_compID, _subCompID, _ptr)                            \
1066 {                                                                                           \
1067     if ((_ptr) == nullptr)                                                                  \
1068     {                                                                                       \
1069         MOS_ASSERTMESSAGE(_compID, _subCompID, "Invalid (nullptr) Pointer.");               \
1070         MT_ERR2(MT_ERR_NULL_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID);   \
1071         return;                                                                             \
1072     }                                                                                       \
1073 }
1074 
1075 //!
1076 //! \def MOS_CHK_COND(_compID, _subCompID, _condition, _str)
1077 //!  Check if \a _condition is true, if so assert and return an error
1078 //!
1079 #define MOS_CHK_COND(_compID, _subCompID, _condition,  _message, ...)                       \
1080 {                                                                                           \
1081     if (_condition)                                                                         \
1082     {                                                                                       \
1083         MOS_ASSERTMESSAGE(_compID, _subCompID,  _message, ##__VA_ARGS__);                   \
1084         MT_ERR2(MT_ERR_CONDITION_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID); \
1085         eStatus = MOS_STATUS_INVALID_PARAMETER;                                             \
1086         goto finish;                                                                        \
1087     }                                                                                       \
1088 }
1089 
1090 //!
1091 //! \def MOS_CHK_COND_RETURN(_compID, _subCompID, _condition, _str)
1092 //!  Check if \a _condition is true, if so assert and return an error
1093 //!
1094 #define MOS_CHK_COND_RETURN(_compID, _subCompID, _condition,  _message, ...)                \
1095 {                                                                                           \
1096     if (_condition)                                                                         \
1097     {                                                                                       \
1098         MOS_ASSERTMESSAGE(_compID, _subCompID,  _message, ##__VA_ARGS__);                   \
1099         MT_ERR2(MT_ERR_CONDITION_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID); \
1100         return MOS_STATUS_INVALID_PARAMETER;                                                \
1101     }                                                                                       \
1102 }
1103 
1104 //!
1105 //! \def MOS_CHK_COND_RETURN_VALUE(_compID, _subCompID, _condition, retVal, _str)
1106 //!  Check if \a _condition is true, if so assert and return \a retVal
1107 //!
1108 #define MOS_CHK_COND_RETURN_VALUE(_compID, _subCompID, _condition, retVal,  _message, ...)  \
1109 {                                                                                           \
1110     if (_condition)                                                                         \
1111     {                                                                                       \
1112         MT_ERR2(MT_ERR_CONDITION_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID); \
1113         MOS_ASSERTMESSAGE(_compID, _subCompID,  _message, ##__VA_ARGS__);                   \
1114         return retVal;                                                                      \
1115     }                                                                                       \
1116 }
1117 
1118 //!
1119 //! \def MOS_CHK_COND_WITH_DESTROY_RETURN_VALUE(_compID, _subCompID, _condition, destroyFunction, retVal, _message)
1120 //!  Check if \a _condition is true, if so assert, call destroy function and return \a retVal
1121 //!
1122 #define MOS_CHK_COND_WITH_DESTROY_RETURN_VALUE(_compID, _subCompID, _condition, destroyFunction, retVal, _message, ...)  \
1123 {                                                                                                                        \
1124     if (_condition)                                                                                                      \
1125     {                                                                                                                    \
1126         destroyFunction();                                                                                               \
1127         MT_ERR2(MT_ERR_CONDITION_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID);                            \
1128         MOS_ASSERTMESSAGE(_compID, _subCompID, _message, ##__VA_ARGS__);                                                 \
1129         return retVal;                                                                                                   \
1130     }                                                                                                                    \
1131 }
1132 
1133 //!
1134 //! The following HR macros are temporary until MOS switches to MOS_STATUS. When that happens,
1135 //! and therefore these macros will be moved to an OS specific file.
1136 //!
1137 
1138 //!
1139 //! \def MOS_CHK_HR(_compID, _subCompID, _stmt)
1140 //!  Check _stmt, assert and return an error for failure
1141 //!
1142 #define MOS_CHK_HR(_compID, _subCompID, _stmt)                                              \
1143 {                                                                                           \
1144     hr = (_stmt);                                                                           \
1145     if (hr != MOS_STATUS_SUCCESS)                                                           \
1146     {                                                                                       \
1147         MOS_ASSERTMESSAGE(_compID, _subCompID, "hr check failed.");                         \
1148         MT_ERR3(MT_ERR_HR_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID, MT_ERROR_CODE, hr);    \
1149         goto finish;                                                                        \
1150     }                                                                                       \
1151 }
1152 
1153 //!
1154 //! \def MOS_CHK_HR_NO_STATUS_RETURN(_compID, _subCompID, _stmt)
1155 //!  Check _stmt, assert and return void
1156 //!
1157 #define MOS_CHK_HR_NO_STATUS_RETURN(_compID, _subCompID, _stmt)                             \
1158 {                                                                                           \
1159     hr = (_stmt);                                                                           \
1160     if (hr != MOS_STATUS_SUCCESS)                                                           \
1161     {                                                                                       \
1162         MOS_ASSERTMESSAGE(_compID, _subCompID, "MOS returned error, hr = 0x%x", hr);        \
1163         MT_ERR3(MT_ERR_HR_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID, MT_ERROR_CODE, hr);    \
1164         return;                                                                             \
1165     }                                                                                       \
1166 }
1167 
1168 //!
1169 //! \def MOS_CHK_STATUS_MESSAGE(_compID, _subCompID, _stmt, _message, ...)
1170 //!  Check MOS_STATUS \a _stmt, assert and return an error for failure, and print message
1171 //!
1172 #define MOS_CHK_HR_MESSAGE(_compID, _subCompID, _stmt, _message, ...)                       \
1173 {                                                                                           \
1174     hr = (_stmt);                                                                           \
1175     if (hr != MOS_STATUS_SUCCESS)                                                           \
1176     {                                                                                       \
1177         MOS_ASSERTMESSAGE(_compID, _subCompID, _message, ##__VA_ARGS__);                    \
1178         MT_ERR3(MT_ERR_HR_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID, MT_ERROR_CODE, hr);    \
1179         goto finish;                                                                        \
1180     }                                                                                       \
1181 }
1182 
1183 //!
1184 //! \def MOS_CHECK_CONDITION(_compID, _subCompID, _condition, _str, _ret)
1185 //!  Check if \a _condition is true, if so assert and print the error message _str
1186 //!  and then return the specified value _ret
1187 //!
1188 #define MOS_CHECK_CONDITION(_compID, _subCompID, _condition, _str, _ret)                    \
1189 {                                                                                           \
1190     if (_condition)                                                                         \
1191     {                                                                                       \
1192         MOS_ASSERTMESSAGE(_compID, _subCompID, _str);                                       \
1193         return _ret;                                                                        \
1194     }                                                                                       \
1195 }
1196 
1197 //------------------------------------------------------------------------------
1198 // Macros for debug message and Assert defined for ease of use within MOS files.
1199 //------------------------------------------------------------------------------
1200 
1201 //!
1202 //! \def MOS_OS_CHK_STATUS(_stmt)
1203 //!  MOS_CHK_STATUS \a _stmt with MOS utility comp/subcomp info
1204 //!
1205 #define MOS_OS_CHK_STATUS(_stmt)                                                            \
1206     MOS_CHK_STATUS(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _stmt)
1207 
1208 //!
1209 //! \def MOS_OS_CHK_NULL(_ptr)
1210 //!  MOS_CHK_NULL \a _ptr with MOS utility comp/subcomp info
1211 //!
1212 #define MOS_OS_CHK_NULL(_ptr)                                                               \
1213     MOS_CHK_NULL(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr)
1214 
1215 //!
1216 //! \def MOS_OS_CHK_NULL_NO_STATUS(_ptr)
1217 //!  MOS_CHK_NULL \a _ptr with MOS utility comp/subcomp info without returning a status
1218 //!
1219 #define MOS_OS_CHK_NULL_NO_STATUS(_ptr)                                                               \
1220     MOS_CHK_NULL_NO_STATUS(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr)
1221 
1222 //!
1223 //! \def MOS_OS_CHK_NULL_NO_STATUS_RETURN(_ptr)
1224 //!  MOS_ASSERTMESSAGE \a _ptr with MOS utility comp/subcomp info without returning a status
1225 //!
1226 #define MOS_OS_CHK_NULL_NO_STATUS_RETURN(_ptr)                                                               \
1227     MOS_CHK_NULL_NO_STATUS_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr)
1228 
1229 //!
1230 //! \def MOS_OS_CHK_STATUS_MESSAGE(_ptr)
1231 //!  MOS_CHK_STATUS_MESSAGE \a _ptr with MOS utility comp/subcomp info
1232 //!
1233 #define MOS_OS_CHK_STATUS_MESSAGE(_ptr, _message, ...)                                          \
1234     MOS_CHK_STATUS_MESSAGE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr, _message, ##__VA_ARGS__)
1235 
1236 //!
1237 //! \def MOS_OS_CHK_NULL_RETURN(_ptr)
1238 //!  MOS_CHK_NULL \a _ptr with MOS utility comp/subcomp info
1239 //!
1240 #define MOS_OS_CHK_NULL_RETURN(_ptr)                                                               \
1241     MOS_CHK_NULL_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr)
1242 
1243 //!
1244 //! \def MOS_OS_CHK_NULL_MESSAGE_RETURN(_ptr)
1245 //!  MOS_CHK_NULL \a _ptr with MOS utility comp/subcomp info
1246 //!
1247 #define MOS_OS_CHK_NULL_MESSAGE_RETURN(_ptr, _message, ...) \
1248     MOS_CHK_NULL_MESSAGE_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr, _message,  ##__VA_ARGS__)
1249 
1250 //!
1251 //! \def MOS_OS_CHK_HR(_ptr)
1252 //!  MOS_CHK_HR \a _ptr with MOS utility comp/subcomp info
1253 //!
1254 #define MOS_OS_CHK_HR(_ptr)                                                                 \
1255     MOS_CHK_HR(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr)
1256 
1257 //!
1258 //! \def MOS_OS_CHK_HR_MESSAGE(_ptr)
1259 //!  MOS_CHK_HR_MESSAGE \a _ptr with MOS utility comp/subcomp info
1260 //!
1261 #define MOS_OS_CHK_HR_MESSAGE(_ptr, _message, ...)                                          \
1262     MOS_CHK_HR_MESSAGE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr, _message, ##__VA_ARGS__)
1263 
1264 //!
1265 //! \def MOS_OS_CHK_NULL_WITH_HR(_ptr)
1266 //!  MOS_CHK_NULL_WITH_HR \a _ptr with MOS utility comp/subcomp info
1267 //!
1268 #define MOS_OS_CHK_NULL_WITH_HR(_ptr)                                                       \
1269     MOS_CHK_NULL_WITH_HR(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr)
1270 
1271 //!
1272 //! \def MOS_OS_CHK_NULL_WITH_HR_RETURN(_ptr)
1273 //!  MOS_CHK_NULL_WITH_HR \a _ptr with MOS utility comp/subcomp info
1274 //!
1275 #define MOS_OS_CHK_NULL_WITH_HR_RETURN(_ptr) \
1276     MOS_CHK_NULL_WITH_HR_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr)
1277 
1278 //!
1279 //! \def MOS_OS_CHECK_CONDITION(_condition, _str, _ret)
1280 //!  MOS_CHECK_CONDITION \a _condition with MOS utility comp/subcomp info
1281 //!
1282 #define MOS_OS_CHECK_CONDITION(_condition, _str, _ret)                                      \
1283    MOS_CHECK_CONDITION(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _condition, _str, _ret)
1284 
1285 //!
1286 //! \def MOS_OS_ASSERT(_expr)
1287 //!  MOS_ASSERT \a _expr with MOS Utility comp/subcomp info
1288 //!
1289 #define MOS_OS_ASSERT(_expr)                                                                \
1290     MOS_ASSERT(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _expr)
1291 
1292 //!
1293 //! \def MOS_OS_CHK_NULL_RETURN(_ptr)
1294 //!  MOS_CHK_NULL_RETURN \a _ptr with MOS utility comp/subcomp info
1295 //!
1296 #define MOS_OS_CHK_NULL_RETURN(_ptr)                                                               \
1297     MOS_CHK_NULL_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr)
1298 
1299 //!
1300 //! \def MOS_OS_CHK_STATUS(_stmt)
1301 //!  MOS_CHK_STATUS \a _stmt with MOS utility comp/subcomp info
1302 //!
1303 #define MOS_OS_CHK_STATUS_RETURN(_stmt)                                                            \
1304     MOS_CHK_STATUS_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _stmt)
1305 
1306 //!
1307 //! \def MOS_OS_CHK_STATUS_MESSAGE_RETURN(_stmt, _message, ......)
1308 //!  MOS_CHK_STATUS \a _stmt with MOS utility comp/subcomp info
1309 //!
1310 #define MOS_OS_CHK_STATUS_MESSAGE_RETURN(_stmt, _message, ...)                                  \
1311     MOS_CHK_STATUS_MESSAGE_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _stmt, _message, ##__VA_ARGS__)
1312 
1313 //!
1314 //! \def MOS_OS_CHK_NULL_RETURN_VALUE(_ptr, retVal)
1315 //!  MOS_CHK_COND_RETURN_VALUE \a _ptr with MOS utility comp/subcomp info
1316 //!
1317 #define MOS_OS_CHK_NULL_RETURN_VALUE(_ptr, retVal)                                         \
1318     MOS_CHK_COND_RETURN_VALUE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, (_ptr == nullptr), retVal, "Invalid (nullptr) Pointer.")
1319 
1320 //!
1321 //! \def MOS_OS_ASSERTMESSAGE(_message, ...)
1322 //!  MOS_ASSERTMESSAGE \a _message with MOS Utility comp/subcomp info
1323 //!
1324 #define MOS_OS_ASSERTMESSAGE(_message, ...)                                                 \
1325     MOS_ASSERTMESSAGE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
1326 
1327 //!
1328 //! \def MOS_OS_CRITICALMESSAGE(_message, ...)
1329 //!  MOS_CRITICALMESSAGE \a _message with MOS Utility comp/subcomp info
1330 //!
1331 #define MOS_OS_CRITICALMESSAGE(_message, ...)                                                 \
1332     MOS_CRITICALMESSAGE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
1333 
1334 //!
1335 //! \def MOS_OS_NORMALMESSAGE(_message, ...)
1336 //!  MOS_UTIL_NORMALMESSAGE \a _message with MOS Utility comp/subcomp info
1337 //!
1338 #define MOS_OS_NORMALMESSAGE(_message, ...)                                                 \
1339     MOS_NORMALMESSAGE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
1340 
1341 //!
1342 //! \def MOS_OS_VERBOSEMESSAGE(_message, ...)
1343 //!  MOS_VERBOSEMESSAGE \a _message with MOS Utility comp/subcomp info
1344 //!
1345 #define MOS_OS_VERBOSEMESSAGE(_message, ...)                                                \
1346     MOS_VERBOSEMESSAGE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
1347 
1348 //!
1349 //! \def MOS_OS_FUNCTION_ENTER
1350 //!  Output ENTRY message with MOS Utility comp/subcomp info
1351 //!
1352 #define MOS_OS_FUNCTION_ENTER                                                               \
1353     MOS_FUNCTION_ENTER(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF)
1354 
1355 //!
1356 //! \def MOS_OS_MEMNINJAMESSAGE(_message, ...)
1357 //!  MOS_MEMNINJAMESSAGE \a _message with MOS Utility comp/subcomp info
1358 //!
1359 #define MOS_OS_MEMNINJAMESSAGE(_message, ...)                                               \
1360     MOS_MEMNINJAMESSAGE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
1361 
1362 #define MOS_OS_FUNCTION_TRACE()                                                             \
1363     MOS_FUNCTION_TRACE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF)
1364 
1365 #include "mos_util_debug_specific.h"
1366 
1367 #if MOS_MESSAGES_ENABLED
1368 
1369 class FunctionTrace
1370 {
1371 public:
FunctionTrace(MOS_COMPONENT_ID compID,uint8_t subCompID,const char * name)1372     FunctionTrace(MOS_COMPONENT_ID compID, uint8_t subCompID, const char* name) :
1373         m_compID(compID),
1374         m_subCompID(subCompID),
1375         m_name(name)
1376     {
1377         MOS_VERBOSEMESSAGE(m_compID, m_subCompID, "Enter Function:%s\r\n", m_name);
1378     }
1379 
~FunctionTrace()1380     virtual ~FunctionTrace()
1381     {
1382         MOS_VERBOSEMESSAGE(m_compID, m_subCompID, "Exit Function:%s\r\n", m_name);
1383     }
1384 
1385 protected:
1386     MOS_COMPONENT_ID m_compID    = MOS_COMPONENT_COUNT;
1387     uint8_t          m_subCompID = 0;
1388     const char       *m_name     = nullptr;
1389 };
1390 
1391 #define MOS_FUNCTION_TRACE(_compID, _subCompID) FunctionTrace trace(_compID, _subCompID, __FUNCTION__);
1392 
1393 #else
1394 
1395 #define MOS_FUNCTION_TRACE(_compID, _subCompID)
1396 
1397 #endif // #if MOS_MESSAGES_ENABLED
1398 #endif // __MOS_UTIL_DEBUG_H__
1399