About Social Code
aboutsummaryrefslogtreecommitdiff
path: root/src/gallium/frontends/mediafoundation/wpptrace.h
blob: ea7538c1a7f4aec05cdfa09b602e0a87011bc3a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
 * Copyright © Microsoft Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

#pragma once

#include <windows.h>

#include <TraceLoggingProvider.h>

#if VIDEO_CODEC_H264ENC
#define DEFINE_MFE_WPP_GUID ( 264, 0dc9, 401d, b9b8, 05e4eca4977e )
#elif VIDEO_CODEC_H265ENC
#define DEFINE_MFE_WPP_GUID ( 265, 0dc9, 401d, b9b8, 05e4eca4977e )
#elif VIDEO_CODEC_AV1ENC
#define DEFINE_MFE_WPP_GUID ( aa1, 0dc9, 401d, b9b8, 05e4eca4977e )
#else
#error VIDEO_CODEC_xxx must be defined
#endif

#define WPP_CONTROL_GUIDS WPP_DEFINE_CONTROL_GUID( CTRLGUID_MFE, DEFINE_MFE_WPP_GUID, WPP_DEFINE_BIT( MFE_ALL ) )

#define WPP_FLAG_LEVEL_LOGGER( flag, level ) WPP_LEVEL_LOGGER( flag )

#define WPP_FLAG_LEVEL_ENABLED( flag, level ) ( WPP_LEVEL_ENABLED( flag ) && WPP_CONTROL( WPP_BIT_##flag ).Level >= level )

#define WPP_LEVEL_FLAGS_LOGGER( lvl, flags ) WPP_LEVEL_LOGGER( flags )

#define WPP_LEVEL_FLAGS_ENABLED( lvl, flags ) ( WPP_LEVEL_ENABLED( flags ) && WPP_CONTROL( WPP_BIT_##flags ).Level >= lvl )


// begin_wpp config
//
// FUNC MFE_INFO{FLAG=MFE_ALL,LEVEL=TRACE_LEVEL_INFORMATION}(MSG, ...);
// FUNC MFE_ERROR{FLAG=MFE_ALL,LEVEL=TRACE_LEVEL_ERROR}(MSG, ...);
// FUNC MFE_WARNING{FLAG=MFE_ALL,LEVEL=TRACE_LEVEL_WARNING}(MSG, ...);
// FUNC MFE_VERBOSE{FLAG=MFE_ALL,LEVEL=TRACE_LEVEL_VERBOSE}(MSG, ...);
//
// end_wpp

//
// TraceLogging ETW
//

TRACELOGGING_DECLARE_PROVIDER( g_hEtwProvider );


#if VIDEO_CODEC_H264ENC

#define ETW_MODULE_STR "H264Enc"

#elif VIDEO_CODEC_H265ENC

#define ETW_MODULE_STR "H265Enc"

#elif VIDEO_CODEC_AV1ENC

#define ETW_MODULE_STR "AV1Enc"

#else
#error VIDEO_CODEC_xxx must be defined
#endif

#define HMFT_ETW_EVENT_START( EventId, this )                                                                                      \
   if( g_hEtwProvider )                                                                                                            \
   {                                                                                                                               \
      TraceLoggingWrite( g_hEtwProvider,                                                                                           \
                         EventId,                                                                                                  \
                         TraceLoggingOpcode( EVENT_TRACE_TYPE_START ),                                                             \
                         TraceLoggingPointer( this, ETW_MODULE_STR ) );                                                            \
   }

#define HMFT_ETW_EVENT_STOP( EventId, this )                                                                                       \
   if( g_hEtwProvider )                                                                                                            \
   {                                                                                                                               \
      TraceLoggingWrite( g_hEtwProvider,                                                                                           \
                         EventId,                                                                                                  \
                         TraceLoggingOpcode( EVENT_TRACE_TYPE_STOP ),                                                              \
                         TraceLoggingPointer( this, ETW_MODULE_STR ) );                                                            \
   }

#define HMFT_ETW_EVENT_INFO( EventId, this )                                                                                       \
   if( g_hEtwProvider )                                                                                                            \
   {                                                                                                                               \
      TraceLoggingWrite( g_hEtwProvider,                                                                                           \
                         EventId,                                                                                                  \
                         TraceLoggingOpcode( EVENT_TRACE_TYPE_INFO ),                                                              \
                         TraceLoggingPointer( this, ETW_MODULE_STR ) );                                                            \
   }