nvapi_sys/
driverapi.rs

1use status::NvAPI_Status;
2use types::NvAPI_ShortString;
3use handles;
4
5nvapi! {
6    pub type SYS_GetDriverAndBranchVersionFn = extern "C" fn(pDriverVersion: *mut u32, szBuildBranchString: *mut NvAPI_ShortString) -> NvAPI_Status;
7
8    /// This API returns display driver version and driver-branch string.
9    pub unsafe fn NvAPI_SYS_GetDriverAndBranchVersion;
10}
11
12nvstruct! {
13    /// Used in NvAPI_GPU_GetMemoryInfo().
14    pub struct NV_DISPLAY_DRIVER_MEMORY_INFO_V1 {
15        /// Version info
16        pub version: u32,
17        /// Size(in kb) of the physical framebuffer.
18        pub dedicatedVideoMemory: u32,
19        /// Size(in kb) of the available physical framebuffer for allocating video memory surfaces.
20        pub availableDedicatedVideoMemory: u32,
21        /// Size(in kb) of system memory the driver allocates at load time.
22        pub systemVideoMemory: u32,
23        /// Size(in kb) of shared system memory that driver is allowed to commit for surfaces across all allocations.
24        pub sharedSystemMemory: u32,
25    }
26}
27
28nvstruct! {
29    /// Used in NvAPI_GPU_GetMemoryInfo().
30    pub struct NV_DISPLAY_DRIVER_MEMORY_INFO_V2 {
31        pub v1: NV_DISPLAY_DRIVER_MEMORY_INFO_V1,
32        /// Size(in kb) of the current available physical framebuffer for allocating video memory surfaces.
33        pub curAvailableDedicatedVideoMemory: u32,
34    }
35}
36nvinherit! { NV_DISPLAY_DRIVER_MEMORY_INFO_V2(v1: NV_DISPLAY_DRIVER_MEMORY_INFO_V1) }
37
38nvstruct! {
39    /// Used in NvAPI_GPU_GetMemoryInfo().
40    pub struct NV_DISPLAY_DRIVER_MEMORY_INFO_V3 {
41        pub v2: NV_DISPLAY_DRIVER_MEMORY_INFO_V2,
42        /// Size(in kb) of the total size of memory released as a result of the evictions.
43        pub dedicatedVideoMemoryEvictionsSize: u32,
44        /// Indicates the number of eviction events that caused an allocation to be removed from dedicated video memory to free GPU
45        /// video memory to make room for other allocations.
46        pub dedicatedVideoMemoryEvictionCount: u32,
47    }
48}
49nvinherit! { NV_DISPLAY_DRIVER_MEMORY_INFO_V3(v2: NV_DISPLAY_DRIVER_MEMORY_INFO_V2) }
50
51pub type NV_DISPLAY_DRIVER_MEMORY_INFO = NV_DISPLAY_DRIVER_MEMORY_INFO_V3;
52nvversion! { NV_DISPLAY_DRIVER_MEMORY_INFO_VER_1(NV_DISPLAY_DRIVER_MEMORY_INFO_V1 = 4 * 5, 1) }
53nvversion! { NV_DISPLAY_DRIVER_MEMORY_INFO_VER_2(NV_DISPLAY_DRIVER_MEMORY_INFO_V2 = 4 * 6, 2) }
54nvversion! { NV_DISPLAY_DRIVER_MEMORY_INFO_VER_3(NV_DISPLAY_DRIVER_MEMORY_INFO_V3 = 4 * 8, 3) }
55nvversion! { NV_DISPLAY_DRIVER_MEMORY_INFO_VER = NV_DISPLAY_DRIVER_MEMORY_INFO_VER_3 }
56
57nvapi! {
58    pub type GPU_GetMemoryInfoFn = extern "C" fn(hPhysicalGpu: handles::NvPhysicalGpuHandle, pMemoryInfo: *mut NV_DISPLAY_DRIVER_MEMORY_INFO) -> NvAPI_Status;
59
60    /// This function retrieves the available driver memory footprint for the specified GPU.
61    /// If the GPU is in TCC Mode, only dedicatedVideoMemory will be returned in pMemoryInfo (NV_DISPLAY_DRIVER_MEMORY_INFO).
62    pub unsafe fn NvAPI_GPU_GetMemoryInfo;
63}
64
65/// Undocumented API
66pub mod private {
67    use status::NvAPI_Status;
68    use handles;
69
70    nvapi! {
71        /// This has a different offset than the NvAPI_GPU_GetMemoryInfo function despite both returning the same struct
72        pub unsafe fn NvAPI_GetDisplayDriverMemoryInfo(hPhysicalGpu: handles::NvPhysicalGpuHandle, pMemoryInfo: *mut super::NV_DISPLAY_DRIVER_MEMORY_INFO) -> NvAPI_Status;
73    }
74}