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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
use status::NvAPI_Status;
use handles::NvPhysicalGpuHandle;
use types;
pub mod cooler;
pub mod pstate;
pub mod clock;
pub mod thermal;
pub mod power;
pub mod display;
nvapi! {
pub type EnumPhysicalGPUsFn = extern "C" fn(nvGPUHandle: *mut [NvPhysicalGpuHandle; types::NVAPI_MAX_PHYSICAL_GPUS], pGpuCount: *mut u32) -> NvAPI_Status;
pub unsafe fn NvAPI_EnumPhysicalGPUs;
}
nvapi! {
pub type GPU_GetFullNameFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, szName: *mut types::NvAPI_ShortString) -> NvAPI_Status;
pub unsafe fn NvAPI_GPU_GetFullName;
}
nvapi! {
pub type GPU_GetPhysicalFrameBufferSizeFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pSize: *mut u32) -> NvAPI_Status;
pub unsafe fn NvAPI_GPU_GetPhysicalFrameBufferSize;
}
nvapi! {
pub type GPU_GetVbiosVersionStringFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, szBiosRevision: *mut types::NvAPI_ShortString) -> NvAPI_Status;
pub unsafe fn NvAPI_GPU_GetVbiosVersionString;
}
nvapi! {
pub type GPU_GetPCIIdentifiersFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pDeviceId: *mut u32, pSubSystemId: *mut u32, pRevisionId: *mut u32, pExtDeviceId: *mut u32) -> NvAPI_Status;
pub unsafe fn NvAPI_GPU_GetPCIIdentifiers;
}
nvenum! {
pub enum NV_SYSTEM_TYPE / SystemType {
NV_SYSTEM_TYPE_UNKNOWN / Unknown = 0,
NV_SYSTEM_TYPE_LAPTOP / Laptop = 1,
NV_SYSTEM_TYPE_DESKTOP / Desktop = 2,
}
}
nvenum_display! {
SystemType => _
}
nvapi! {
pub type GPU_GetSystemTypeFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pSystemType: *mut NV_SYSTEM_TYPE) -> NvAPI_Status;
pub unsafe fn NvAPI_GPU_GetSystemType;
}
nvapi! {
pub type GPU_GetShaderSubPipeCountFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pCount: *mut u32) -> NvAPI_Status;
pub unsafe fn NvAPI_GPU_GetShaderSubPipeCount;
}
nvapi! {
pub type GPU_GetGpuCoreCountFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pCount: *mut u32) -> NvAPI_Status;
pub unsafe fn NvAPI_GPU_GetGpuCoreCount;
}
nvbits! {
pub enum NVAPI_GPU_PERF_DECREASE / PerformanceDecreaseReason {
NV_GPU_PERF_DECREASE_NONE / NONE = 0x00,
NV_GPU_PERF_DECREASE_REASON_THERMAL_PROTECTION / THERMAL_PROTECTION = 0x01,
NV_GPU_PERF_DECREASE_REASON_POWER_CONTROL / POWER_CONTROL = 0x02,
NV_GPU_PERF_DECREASE_REASON_AC_BATT / AC_BATTERY = 0x04,
NV_GPU_PERF_DECREASE_REASON_API_TRIGGERED / API_TRIGGERED = 0x08,
NV_GPU_PERF_DECREASE_REASON_INSUFFICIENT_POWER / INSUFFICIENT_POWER = 0x10,
NV_GPU_PERF_DECREASE_REASON_UNKNOWN / UNKNOWN = 0x00,
}
}
nvapi! {
pub unsafe fn NvAPI_GPU_GetPerfDecreaseInfo(hPhysicalGpu: NvPhysicalGpuHandle, pPerfDecrInfo: *mut NVAPI_GPU_PERF_DECREASE) -> NvAPI_Status;
}
pub mod private {
use status::NvAPI_Status;
use handles::NvPhysicalGpuHandle;
use types;
pub const NVAPI_MAX_PROCESSES: usize = 128;
nvapi! {
pub type GPU_GetShaderPipeCountFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pCount: *mut u32) -> NvAPI_Status;
pub unsafe fn NvAPI_GPU_GetShaderPipeCount;
}
nvenum! {
pub enum NV_GPU_RAM_TYPE / RamType {
NV_GPU_RAM_UNKNOWN / Unknown = 0,
NV_GPU_RAM_SDRAM / SDRAM = 1,
NV_GPU_RAM_DDR1 / DDR1 = 2,
NV_GPU_RAM_DDR2 / DDR2 = 3,
NV_GPU_RAM_GDDR2 / GDDR2 = 4,
NV_GPU_RAM_GDDR3 / GDDR3 = 5,
NV_GPU_RAM_GDDR4 / GDDR4 = 6,
NV_GPU_RAM_DDR3 / DDR3 = 7,
NV_GPU_RAM_GDDR5 / GDDR5 = 8,
NV_GPU_RAM_LPDDR2 / LPDDR2 = 9,
NV_GPU_RAM_GDDR5X / GDDR5X = 10,
}
}
nvenum_display! {
RamType => _
}
nvapi! {
pub type GPU_GetRamTypeFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pMemType: *mut NV_GPU_RAM_TYPE) -> NvAPI_Status;
pub unsafe fn NvAPI_GPU_GetRamType;
}
nvenum! {
pub enum NV_GPU_RAM_MAKER / RamMaker {
NV_GPU_RAM_MAKER_UNKNOWN / Unknown = 0,
NV_GPU_RAM_MAKER_SAMSUNG / Samsung = 1,
NV_GPU_RAM_MAKER_QIMONDA / Qimonda = 2,
NV_GPU_RAM_MAKER_ELPIDA / Elpida = 3,
NV_GPU_RAM_MAKER_ETRON / Etron = 4,
NV_GPU_RAM_MAKER_NANYA / Nanya = 5,
NV_GPU_RAM_MAKER_HYNIX / Hynix = 6,
NV_GPU_RAM_MAKER_MOSEL / Mosel = 7,
NV_GPU_RAM_MAKER_WINBOND / Winbond = 8,
NV_GPU_RAM_MAKER_ELITE / Elite = 9,
NV_GPU_RAM_MAKER_MICRON / Micron = 10,
}
}
nvenum_display! {
RamMaker => _
}
nvapi! {
pub type GPU_GetRamMakerFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pRamMaker: *mut NV_GPU_RAM_MAKER) -> NvAPI_Status;
pub unsafe fn NvAPI_GPU_GetRamMaker;
}
nvapi! {
pub type GPU_GetRamBusWidthFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pRamBusWidth: *mut u32) -> NvAPI_Status;
pub unsafe fn NvAPI_GPU_GetRamBusWidth;
}
nvapi! {
pub type GPU_GetRamBankCountFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pRamBankCount: *mut u32) -> NvAPI_Status;
pub unsafe fn NvAPI_GPU_GetRamBankCount;
}
nvenum! {
pub enum NV_GPU_FOUNDRY / Foundry {
NV_GPU_FOUNDRY_UNKNOWN / Unknown = 0,
NV_GPU_FOUNDRY_TSMC / TSMC = 1,
NV_GPU_FOUNDRY_UMC / UMC = 2,
NV_GPU_FOUNDRY_IBM / IBM = 3,
NV_GPU_FOUNDRY_SMIC / SMIC = 4,
NV_GPU_FOUNDRY_CSM / CSM = 5,
NV_GPU_FOUNDRY_TOSHIBA / Toshiba = 6,
}
}
nvenum_display! {
Foundry => {
TSMC = "Taiwan Semiconductor Manufacturing Company (TSMC)",
UMC = "United Microelectronics Corporation (UMC)",
IBM = "IBM Microelectronics",
SMIC = "Semiconductor Manufacturing International Corporation (SMIC)",
CSM = "Chartered Semiconductor Manufacturing (CSM)",
Toshiba = "Toshiba Corporation",
_ = _,
}
}
nvapi! {
pub type GPU_GetFoundryFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pFoundry: *mut NV_GPU_FOUNDRY) -> NvAPI_Status;
pub unsafe fn NvAPI_GPU_GetFoundry;
}
nvapi! {
pub unsafe fn NvAPI_GPU_GetFBWidthAndLocation(hPhysicalGpu: NvPhysicalGpuHandle, pWidth: *mut u32, pLocation: *mut u32) -> NvAPI_Status;
}
nvenum! {
pub enum NV_GPU_VENDOR / VendorId {
NV_GPU_VENDOR_UNKNOWN / Unknown = 0,
NV_GPU_VENDOR_ASUS / ASUS = 0x1043,
NV_GPU_VENDOR_ELSA / Elsa = 0x1048,
NV_GPU_VENDOR_LEADTEK / Leadtek = 0x107d,
NV_GPU_VENDOR_GAINWARD / Gainward = 0x10b0,
NV_GPU_VENDOR_NVIDIA / NVIDIA = 0x10de,
NV_GPU_VENDOR_GIGABYTE / Gigabyte = 0x1458,
NV_GPU_VENDOR_MSI / MSI = 0x1462,
NV_GPU_VENDOR_PNY_ / PNY_ = 0x154b,
NV_GPU_VENDOR_PALIT / Palit = 0x1569,
NV_GPU_VENDOR_XFX / XFX = 0x1682,
NV_GPU_VENDOR_CLUB3D / Club3D = 0x196d,
NV_GPU_VENDOR_PNY / PNY = 0x196e,
NV_GPU_VENDOR_ZOTAC / Zotac = 0x19da,
NV_GPU_VENDOR_BFG / BFG = 0x19f1,
NV_GPU_VENDOR_POV / PoV = 0x1acc,
NV_GPU_VENDOR_GALAX / Galax = 0x1b4c,
NV_GPU_VENDOR_EVGA / EVGA = 0x3842,
NV_GPU_VENDOR_COLORFUL / Colorful = 0x7377,
}
}
nvenum_display! {
VendorId => {
ASUS = "ASUSTeK Computer Inc.",
Gigabyte = "Gigabyte Technology",
MSI = "Micro-Star International",
PNY_ = "PNY",
Galax = "Galax / KFA2",
_ = _,
}
}
nvapi! {
pub unsafe fn NvAPI_GetGPUIDFromPhysicalGPU(hPhysicalGpu: NvPhysicalGpuHandle, gpuid: *mut u32) -> NvAPI_Status;
}
nvapi! {
pub unsafe fn NvAPI_GPU_GetShortName(hPhysicalGpu: NvPhysicalGpuHandle, pName: *mut types::NvAPI_ShortString) -> NvAPI_Status;
}
nvapi! {
pub unsafe fn NvAPI_GPU_GetPartitionCount(hPhysicalGpu: NvPhysicalGpuHandle, pPartitionCount: *mut u32) -> NvAPI_Status;
}
nvapi! {
pub unsafe fn NvAPI_GetDriverModel(hPhysicalGpu: NvPhysicalGpuHandle, pDriverModel: *mut u32) -> NvAPI_Status;
}
}