This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
forked from GPUOpen-Drivers/pal
-
Notifications
You must be signed in to change notification settings - Fork 2
/
palSystemEvent.h
118 lines (108 loc) · 4.79 KB
/
palSystemEvent.h
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
109
110
111
112
113
114
115
116
117
118
/*
***********************************************************************************************************************
*
* Copyright (c) 2018-2021 Advanced Micro Devices, Inc. All Rights Reserved.
*
* 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 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.
*
**********************************************************************************************************************/
/**
***********************************************************************************************************************
* @file palSystemEvent.h
* @brief Defines PAL system event functionality.
***********************************************************************************************************************
*/
#pragma once
//Include AutoGenerated header with definitions of SystemEventID and Reasons
//These are needed by the client to be able to call an event
//Currently only works with DX build will have else for other builds eventually
#include "palUtil.h"
#include "palDbgPrint.h"
#include "palAssert.h"
#include <stdarg.h>
namespace Util
{
/// Specifies the event log mode: disabled, print to debugger, or emit OS event
enum class SystemEventMode : uint32
{
Disable, ///< System event is ignored.
Print, ///< System event is routed to the debug window or stdout.
OsEvent ///< System event is routed to OS event output.
};
/// The SystemEventClientId is the 8 bit value used for clientId in SystemEventId below.
/// This is used to identify which event group/pool the event is from.
/// PAL and PAL clients will have different IDs.
/// For example, clientId = SystemEventClientId::Pal and eventId = 1 may be a
/// completely different event (name and payload)
/// than clientId = SystemEventClientId::Vulkan and eventId = 1.
enum class SystemEventClientId : uint8
{
Pal = 0,
Reserved,
Llpc,
Vulkan,
Dxcp,
Mantle,
Dx9p,
Dxxp,
Ocl,
Count,
};
/// Sets the System event log mode (output to debugger, emit OS event, or disabled).
///
/// Probably controlled by a setting and set during initialization.
///
/// @param [in] clientId Client ID to apply the output mode to. From SystemEventClientId enum.
/// @param [in] mode New mode to be used for this event (print to file, etc.).
extern void SetSystemEventOutputMode(
SystemEventClientId clientId,
SystemEventMode mode);
/// The SystemEventId is used to specify which client ID and event ID to be emitted when logging an event.
/// For example, clientId = SystemEventClientId::Pal and eventId = 1 may be a completely different event (name
/// and payload) than clientId = SystemEventClientId::Vulkan and eventId = 1.
union SystemEventId
{
struct
{
SystemEventClientId clientId : 8; ///< Client ID
uint32 eventId : 24; ///< Event ID that is client ID relative.
};
uint32 u32All; ///< packed 32-bits containing clientId and eventId.
};
/// Log system Event function to be used when the caller want to control
/// if the output is routed to debug print or OS event.
/// Clients should use the PAL_LOG_EVENT macro instead of calling this
/// function directly.
/// This function has one OS independent implementation.
/// This function basically checks the output mode and either drops the event,
/// prints the event via Util::DbgPrintf(),
/// or calls EmitOsSystemEvent() to emit the event in an OS specific form.
/// When printing, it will get the DPF format string,
/// from a script generated table.
///
///
/// @param [in] clientID is used to specify which client to be emitted when logging an event.
/// @param [in] eventId is used to specify which event to be emitted when logging an event.
extern void LogSystemEvent(
SystemEventClientId clientId,
uint32 eventId,
...);
} // Util
/// System event macro.
#define PAL_LOG_EVENT(...) ((void)0)