Debian Codegraph @

third_party/aub_stream/aubstream/aubstream.h

raw
1 /*
2 * Copyright (C) 2022-2025 Intel Corporation
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 */
7
8 #pragma once
9 #include <string>
10 #include <cstdint>
11 #include <ostream>
12 #include <vector>
13 #include <type_traits>
14
15 namespace aub_stream {
16
17 struct SurfaceInfo {
18 uint64_t address;
19 uint32_t width;
20 uint32_t height;
21 uint32_t pitch;
22 uint32_t format;
23 uint32_t surftype;
24 uint32_t tilingType;
25 bool compressed;
26 uint32_t dumpType;
27 bool useClearValue;
28 uint32_t clearColorType;
29 uint32_t auxEncodingFormat;
30 uint32_t auxSurfaceWidth;
31 uint32_t auxSurfaceHeight;
32 uint32_t auxSurfacePitch;
33 uint32_t auxSurfaceQPitch;
34 uint32_t auxSurfaceTilingType;
35 uint64_t clearColorAddress;
36 uint64_t auxSurfaceAddress;
37 };
38
39 namespace surftype {
40 constexpr uint32_t image1D = 0;
41 constexpr uint32_t image2D = 1;
42 constexpr uint32_t image3D = 2;
43 constexpr uint32_t buffer = 4;
44 } // namespace surftype
45
46 namespace tilingType {
47 constexpr uint32_t linear = 0;
48 constexpr uint32_t xmajor = 2;
49 constexpr uint32_t ymajor = 3;
50 } // namespace tilingType
51
52 namespace dumpType {
53 constexpr uint32_t bmp = 0;
54 constexpr uint32_t bin = 1;
55 constexpr uint32_t tre = 3;
56 } // namespace dumpType
57
58 namespace mode {
59 constexpr uint32_t aubFile = 0;
60 constexpr uint32_t tbx = 1;
61 constexpr uint32_t aubFileAndTbx = 2;
62 constexpr uint32_t tbxShm = 3;
63 constexpr uint32_t tbxShm3 = 4;
64 constexpr uint32_t tbxShm4 = 5;
65 constexpr uint32_t null = 6;
66 constexpr uint32_t aubFileAndShm = 7;
67 constexpr uint32_t aubFileAndShm4 = 8;
68 } // namespace mode
69
70 namespace clearColorType {
71 constexpr uint32_t immediate = 0;
72 constexpr uint32_t address = 1;
73 } // namespace clearColorType
74
75 using MMIOPair = std::pair<uint32_t, uint32_t>;
76 using MMIOList = std::vector<MMIOPair>;
77
78 extern "C" void injectMMIOList(MMIOList mmioList);
79 extern "C" void setTbxServerPort(uint16_t port);
80 extern "C" void setTbxServerIp(std::string server);
81 extern "C" void setTbxFrontdoorMode(bool frontdoor);
82 extern "C" void setAubStreamCaller(uint32_t caller);
83
84 extern "C" void injectMMIOListLegacy(MMIOList mmioList);
85 extern "C" void setTbxServerIpLegacy(std::string server);
86
87 namespace caller {
88 constexpr uint32_t neo = 0;
89 constexpr uint32_t rlr = 1;
90 constexpr uint32_t rlc = 2;
91 constexpr uint32_t rll = 3;
92 constexpr uint32_t rl = 4;
93 } // namespace caller
94
95 namespace hardwareContextFlags {
96 constexpr uint32_t contextGroup = 1 << 15;
97 constexpr uint32_t highPriority = 1 << 14;
98 constexpr uint32_t lowPriority = 1 << 13;
99 constexpr uint32_t runAlone = 1 << 0;
100 } // namespace hardwareContextFlags
101
102 namespace hardwareContextId {
103 constexpr uint32_t invalidContextId = -1;
104 }
105
106 struct CreateHardwareContext2Params {
107 uint32_t contextId;
108 uint32_t primaryContextId = hardwareContextId::invalidContextId;
109 };
110
111 struct HardwareContextParamsHeader {
112 uint32_t version = 1;
113 uint32_t size = 0;
114 };
115
116 struct CreateHardwareContext3Params {
117 HardwareContextParamsHeader header;
118 uint32_t device;
119 uint32_t engine;
120 uint32_t flags;
121 uint32_t contextId;
122 uint32_t primaryContextId = hardwareContextId::invalidContextId;
123 uint32_t priority;
124 };
125
126 static_assert(std::is_standard_layout_v<SurfaceInfo> && std::is_trivial_v<SurfaceInfo> && std::is_trivially_copyable_v<SurfaceInfo>, "SurfaceInfo is not POD type");
127 static_assert(std::is_standard_layout_v<CreateHardwareContext2Params>, "CreateHardwareContext2Params is not standard layout type");
128 static_assert(std::is_standard_layout_v<CreateHardwareContext3Params>, "CreateHardwareContext3Params is not standard layout type");
129
130 } // namespace aub_stream