Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sys/src/dispcontrol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::os::raw::c_char;
use crate::status::NvAPI_Status;
use crate::handles;

nvapi! {
nvapi_fn! {
pub type EnumNvidiaDisplayHandleFn = extern "C" fn(thisEnum: u32, pNvDispHandle: *mut handles::NvDisplayHandle) -> NvAPI_Status;

/// This function returns the handle of the NVIDIA display specified by the enum
Expand All @@ -14,7 +14,7 @@ nvapi! {
pub unsafe fn NvAPI_EnumNvidiaDisplayHandle;
}

nvapi! {
nvapi_fn! {
pub type EnumNvidiaUnAttachedDisplayHandleFn = extern "C" fn(thisEnum: u32, pNvUnAttachedDispHandle: *mut handles::NvUnAttachedDisplayHandle) -> NvAPI_Status;

/// This function returns the handle of the NVIDIA unattached display specified by the enum
Expand All @@ -26,15 +26,15 @@ nvapi! {
pub unsafe fn NvAPI_EnumNvidiaUnAttachedDisplayHandle;
}

nvapi! {
nvapi_fn! {
pub type GetAssociatedNvidiaDisplayHandleFn = extern "C" fn(szDisplayName: *const c_char, pNvDispHandle: *mut handles::NvDisplayHandle) -> NvAPI_Status;

/// This function returns the handle of the NVIDIA display that is associated
/// with the given display "name" (such as "\\.\DISPLAY1").
pub unsafe fn NvAPI_GetAssociatedNvidiaDisplayHandle;
}

nvapi! {
nvapi_fn! {
pub type DISP_GetAssociatedUnAttachedNvidiaDisplayHandleFn = extern "C" fn(szDisplayName: *const c_char, pNvUnAttachedDispHandle: *mut handles::NvDisplayHandle) -> NvAPI_Status;

/// This function returns the handle of an unattached NVIDIA display that is
Expand Down
6 changes: 3 additions & 3 deletions sys/src/driverapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::status::NvAPI_Status;
use crate::types::NvAPI_ShortString;
use crate::handles;

nvapi! {
nvapi_fn! {
pub type SYS_GetDriverAndBranchVersionFn = extern "C" fn(pDriverVersion: *mut u32, szBuildBranchString: *mut NvAPI_ShortString) -> NvAPI_Status;

/// This API returns display driver version and driver-branch string.
Expand Down Expand Up @@ -54,7 +54,7 @@ nvversion! { NV_DISPLAY_DRIVER_MEMORY_INFO_VER_2(NV_DISPLAY_DRIVER_MEMORY_INFO_V
nvversion! { NV_DISPLAY_DRIVER_MEMORY_INFO_VER_3(NV_DISPLAY_DRIVER_MEMORY_INFO_V3 = 4 * 8, 3) }
nvversion! { NV_DISPLAY_DRIVER_MEMORY_INFO_VER = NV_DISPLAY_DRIVER_MEMORY_INFO_VER_3 }

nvapi! {
nvapi_fn! {
pub type GPU_GetMemoryInfoFn = extern "C" fn(hPhysicalGpu: handles::NvPhysicalGpuHandle, pMemoryInfo: *mut NV_DISPLAY_DRIVER_MEMORY_INFO) -> NvAPI_Status;

/// This function retrieves the available driver memory footprint for the specified GPU.
Expand All @@ -67,7 +67,7 @@ pub mod private {
use crate::status::NvAPI_Status;
use crate::handles;

nvapi! {
nvapi_fn! {
/// This has a different offset than the NvAPI_GPU_GetMemoryInfo function despite both returning the same struct
pub unsafe fn NvAPI_GetDisplayDriverMemoryInfo(hPhysicalGpu: handles::NvPhysicalGpuHandle, pMemoryInfo: *mut super::NV_DISPLAY_DRIVER_MEMORY_INFO) -> NvAPI_Status;
}
Expand Down
2 changes: 1 addition & 1 deletion sys/src/dx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::status::NvAPI_Status;
nv_declare_handle! { NVDX_ObjectHandle }
pub const NVDX_OBJECT_NONE: NVDX_ObjectHandle = NVDX_ObjectHandle(0 as *const _);

nvapi! {
nvapi_fn! {
pub type D3D_GetObjectHandleForResourceFn = extern "C" fn(pDevice: *const IUnknown, pResource: *const IUnknown, pHandle: *mut NVDX_ObjectHandle) -> NvAPI_Status;

/// This API gets a handle to a resource.
Expand Down
18 changes: 9 additions & 9 deletions sys/src/gpu/clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ nvstruct! {
}
}

nvapi! {
nvapi_fn! {
pub type GPU_GetAllClockFrequenciesFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pClkFreqs: *mut NV_GPU_CLOCK_FREQUENCIES) -> NvAPI_Status;

/// This function retrieves the NV_GPU_CLOCK_FREQUENCIES structure for the specified physical GPU.
Expand Down Expand Up @@ -126,7 +126,7 @@ pub mod private {

pub type NV_USAGES_INFO = NV_USAGES_INFO_V1;

nvapi! {
nvapi_fn! {
pub type GPU_GetUsagesFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pUsagesInfo: *mut NV_USAGES_INFO) -> NvAPI_Status;

/// Undocumented function. Probably deprecated and replaced with NvAPI_GPU_GetDynamicPstatesInfoEx()
Expand All @@ -145,7 +145,7 @@ pub mod private {

pub type NV_CLOCKS_INFO = NV_CLOCKS_INFO_V1;

nvapi! {
nvapi_fn! {
pub type GPU_GetAllClocksFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pClocksInfo: *mut NV_CLOCKS_INFO) -> NvAPI_Status;

/// Undocumented function. Probably deprecated and replaced with NvAPI_GPU_GetAllClockFrequencies()
Expand Down Expand Up @@ -193,12 +193,12 @@ pub mod private {

pub type NV_GPU_CLOCK_CLIENT_CLK_VF_POINTS_CONTROL = NV_GPU_CLOCK_CLIENT_CLK_VF_POINTS_CONTROL_V1;

nvapi! {
nvapi_fn! {
/// Pascal only
pub unsafe fn NvAPI_GPU_ClockClientClkVfPointsGetControl(hPhysicalGPU: NvPhysicalGpuHandle, pClockTable: *mut NV_GPU_CLOCK_CLIENT_CLK_VF_POINTS_CONTROL) -> NvAPI_Status;
}

nvapi! {
nvapi_fn! {
/// Pascal only
pub unsafe fn NvAPI_GPU_ClockClientClkVfPointsSetControl(hPhysicalGPU: NvPhysicalGpuHandle, pClockTable: *const NV_GPU_CLOCK_CLIENT_CLK_VF_POINTS_CONTROL) -> NvAPI_Status;
}
Expand Down Expand Up @@ -240,7 +240,7 @@ pub mod private {

pub type NV_GPU_CLOCK_CLIENT_CLK_DOMAINS_INFO = NV_GPU_CLOCK_CLIENT_CLK_DOMAINS_INFO_V1;

nvapi! {
nvapi_fn! {
/// Pascal only
pub unsafe fn NvAPI_GPU_ClockClientClkDomainsGetInfo(hPhysicalGPU: NvPhysicalGpuHandle, pClockRanges: *mut NV_GPU_CLOCK_CLIENT_CLK_DOMAINS_INFO) -> NvAPI_Status;
}
Expand Down Expand Up @@ -271,7 +271,7 @@ pub mod private {

pub type NV_GPU_CLOCK_CLIENT_CLK_VF_POINTS_INFO = NV_GPU_CLOCK_CLIENT_CLK_VF_POINTS_INFO_V1;

nvapi! {
nvapi_fn! {
/// Pascal only
pub unsafe fn NvAPI_GPU_ClockClientClkVfPointsGetInfo(hPhysicalGPU: NvPhysicalGpuHandle, pClockMasks: *mut NV_GPU_CLOCK_CLIENT_CLK_VF_POINTS_INFO) -> NvAPI_Status;
}
Expand Down Expand Up @@ -309,12 +309,12 @@ pub mod private {
nvversion! { NV_GPU_PERF_CLIENT_LIMITS_VER_2(NV_GPU_PERF_CLIENT_LIMITS_V2 = 0x30c, 2) }
nvversion! { NV_GPU_PERF_CLIENT_LIMITS_VER = NV_GPU_PERF_CLIENT_LIMITS_VER_2 }

nvapi! {
nvapi_fn! {
/// Pascal only
pub unsafe fn NvAPI_GPU_PerfClientLimitsGetStatus(hPhysicalGPU: NvPhysicalGpuHandle, pClockLocks: *mut NV_GPU_PERF_CLIENT_LIMITS) -> NvAPI_Status;
}

nvapi! {
nvapi_fn! {
/// Pascal only
pub unsafe fn NvAPI_GPU_PerfClientLimitsSetStatus(hPhysicalGPU: NvPhysicalGpuHandle, pClockLocks: *const NV_GPU_PERF_CLIENT_LIMITS) -> NvAPI_Status;
}
Expand Down
14 changes: 7 additions & 7 deletions sys/src/gpu/cooler.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::status::NvAPI_Status;
use crate::handles::NvPhysicalGpuHandle;

nvapi! {
nvapi_fn! {
pub type GPU_GetTachReadingFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pValue: *mut u32) -> NvAPI_Status;

/// This API retrieves the fan speed tachometer reading for the specified physical GPU.
Expand Down Expand Up @@ -165,7 +165,7 @@ pub mod private {

pub type NV_GPU_COOLER_SETTINGS = NV_GPU_COOLER_SETTINGS_V1;

nvapi! {
nvapi_fn! {
pub type GPU_GetCoolerSettingsFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, coolerIndex: u32, pCoolerInfo: *mut NV_GPU_COOLER_SETTINGS) -> NvAPI_Status;

/// Undocumented function.
Expand Down Expand Up @@ -200,7 +200,7 @@ pub mod private {

pub type NV_GPU_SETCOOLER_LEVEL = NV_GPU_SETCOOLER_LEVEL_V1;

nvapi! {
nvapi_fn! {
pub type GPU_SetCoolerLevelsFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, coolerIndex: u32, pCoolerLevels: *const NV_GPU_SETCOOLER_LEVEL) -> NvAPI_Status;

/// Undocumented function.
Expand All @@ -218,7 +218,7 @@ pub mod private {
pub unsafe fn NvAPI_GPU_SetCoolerLevels;
}

nvapi! {
nvapi_fn! {
pub type GPU_RestoreCoolerSettingsFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, coolerIndex: *const u32, coolerCount: u32) -> NvAPI_Status;

/// Undocumented function.
Expand Down Expand Up @@ -258,15 +258,15 @@ pub mod private {

pub type NV_GPU_COOLER_POLICY_TABLE = NV_GPU_COOLER_POLICY_TABLE_V1;

nvapi! {
nvapi_fn! {
pub type GPU_GetCoolerPolicyTableFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, coolerIndex: u32, pCoolerTable: *mut NV_GPU_COOLER_POLICY_TABLE, count: *mut u32) -> NvAPI_Status;

/// Undocumented function.
/// Retrieves the table of cooler and policy levels for the selected policy. Supported only for NVAPI_COOLER_POLICY_PERF.
pub unsafe fn NvAPI_GPU_GetCoolerPolicyTable;
}

nvapi! {
nvapi_fn! {
pub type GPU_SetCoolerPolicyTableFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, coolerIndex: u32, pCoolerTable: *const NV_GPU_COOLER_POLICY_TABLE, count: u32) -> NvAPI_Status;

/// Undocumented function.
Expand All @@ -278,7 +278,7 @@ pub mod private {
pub unsafe fn NvAPI_GPU_SetCoolerPolicyTable;
}

nvapi! {
nvapi_fn! {
pub type GPU_RestoreCoolerPolicyTableFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, coolerIndex: *const u32, coolerCount: u32, policy: NV_COOLER_POLICY) -> NvAPI_Status;

/// Undocumented function.
Expand Down
4 changes: 2 additions & 2 deletions sys/src/gpu/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ nvversion! { NV_GPU_DISPLAYIDS_VER1(NV_GPU_DISPLAYIDS = 4 * 4, 1) }
nvversion! { NV_GPU_DISPLAYIDS_VER2(NV_GPU_DISPLAYIDS = 4 * 4, 3) }
nvversion! { NV_GPU_DISPLAYIDS_VER = NV_GPU_DISPLAYIDS_VER2 }

nvapi! {
nvapi_fn! {
pub type GPU_GetConnectedDisplayIds = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pDisplayIds: *mut NV_GPU_DISPLAYIDS, pDisplayIdCount: *mut u32, flags: NV_GPU_CONNECTED_IDS_FLAG) -> NvAPI_Status;

/// Due to space limitation NvAPI_GPU_GetConnectedOutputs can return maximum 32 devices, but
Expand All @@ -109,7 +109,7 @@ nvapi! {
pub unsafe fn NvAPI_GPU_GetConnectedDisplayIds;
}

nvapi! {
nvapi_fn! {
pub type GPU_GetAllDisplayIds = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pDisplayIds: *mut NV_GPU_DISPLAYIDS, pDisplayIdCount: *mut u32) -> NvAPI_Status;

/// This API returns display IDs for all possible outputs on the GPU.
Expand Down
42 changes: 21 additions & 21 deletions sys/src/gpu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub mod power;

pub mod display;

nvapi! {
nvapi_fn! {
pub type EnumPhysicalGPUsFn = extern "C" fn(nvGPUHandle: *mut [NvPhysicalGpuHandle; types::NVAPI_MAX_PHYSICAL_GPUS], pGpuCount: *mut u32) -> NvAPI_Status;

/// This function returns an array of physical GPU handles.
Expand All @@ -56,22 +56,22 @@ nvapi! {
pub unsafe fn NvAPI_EnumPhysicalGPUs;
}

nvapi! {
nvapi_fn! {
pub type GPU_GetFullNameFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, szName: *mut types::NvAPI_ShortString) -> NvAPI_Status;

/// This function retrieves the full GPU name as an ASCII string - for example, "Quadro FX 1400".
pub unsafe fn NvAPI_GPU_GetFullName;
}

nvapi! {
nvapi_fn! {
pub type GPU_GetPhysicalFrameBufferSizeFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pSize: *mut u32) -> NvAPI_Status;

/// This function returns the physical size of framebuffer in KB. This does NOT include any
/// system RAM that may be dedicated for use by the GPU.
pub unsafe fn NvAPI_GPU_GetPhysicalFrameBufferSize;
}

nvapi! {
nvapi_fn! {
pub type GPU_GetVbiosVersionStringFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, szBiosRevision: *mut types::NvAPI_ShortString) -> NvAPI_Status;

/// This function returns the full video BIOS version string in the form of xx.xx.xx.xx.yy where
Expand All @@ -80,7 +80,7 @@ nvapi! {
pub unsafe fn NvAPI_GPU_GetVbiosVersionString;
}

nvapi! {
nvapi_fn! {
pub type GPU_GetPCIIdentifiersFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pDeviceId: *mut u32, pSubSystemId: *mut u32, pRevisionId: *mut u32, pExtDeviceId: *mut u32) -> NvAPI_Status;

/// This function returns the PCI identifiers associated with this GPU.
Expand All @@ -100,22 +100,22 @@ nvenum_display! {
SystemType => _
}

nvapi! {
nvapi_fn! {
pub type GPU_GetSystemTypeFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pSystemType: *mut NV_SYSTEM_TYPE) -> NvAPI_Status;

/// This function identifies whether the GPU is a notebook GPU or a desktop GPU.
pub unsafe fn NvAPI_GPU_GetSystemType;
}

nvapi! {
nvapi_fn! {
pub type GPU_GetShaderSubPipeCountFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pCount: *mut u32) -> NvAPI_Status;

/// This function retrieves the number of Shader SubPipes on the GPU
/// On newer architectures, this corresponds to the number of SM units
pub unsafe fn NvAPI_GPU_GetShaderSubPipeCount;
}

nvapi! {
nvapi_fn! {
pub type GPU_GetGpuCoreCountFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pCount: *mut u32) -> NvAPI_Status;

/// Retrieves the total number of cores defined for a GPU.
Expand All @@ -137,7 +137,7 @@ nvversion! { NV_BOARD_INFO_VER = NV_BOARD_INFO_VER1 }

pub type NV_BOARD_INFO = NV_BOARD_INFO_V1;

nvapi! {
nvapi_fn! {
/// This API Retrieves the Board information (a unique GPU Board Serial Number) stored in the InfoROM.
pub unsafe fn NvAPI_GPU_GetBoardInfo(hPhysicalGpu: NvPhysicalGpuHandle, pBoardInfo: *mut NV_BOARD_INFO) -> NvAPI_Status;
}
Expand All @@ -157,7 +157,7 @@ nvbits! {
}
}

nvapi! {
nvapi_fn! {
/// This function retrieves reasons for the current performance decrease.
pub unsafe fn NvAPI_GPU_GetPerfDecreaseInfo(hPhysicalGpu: NvPhysicalGpuHandle, pPerfDecrInfo: *mut NVAPI_GPU_PERF_DECREASE) -> NvAPI_Status;
}
Expand All @@ -170,7 +170,7 @@ pub mod private {

pub const NVAPI_MAX_PROCESSES: usize = 128;

nvapi! {
nvapi_fn! {
pub type GPU_GetShaderPipeCountFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pCount: *mut u32) -> NvAPI_Status;

pub unsafe fn NvAPI_GPU_GetShaderPipeCount;
Expand All @@ -197,7 +197,7 @@ pub mod private {
RamType => _
}

nvapi! {
nvapi_fn! {
pub type GPU_GetRamTypeFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pMemType: *mut NV_GPU_RAM_TYPE) -> NvAPI_Status;

/// Undocumented function.
Expand Down Expand Up @@ -226,21 +226,21 @@ pub mod private {
RamMaker => _
}

nvapi! {
nvapi_fn! {
pub type GPU_GetRamMakerFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pRamMaker: *mut NV_GPU_RAM_MAKER) -> NvAPI_Status;

/// Undocumented function.
pub unsafe fn NvAPI_GPU_GetRamMaker;
}

nvapi! {
nvapi_fn! {
pub type GPU_GetRamBusWidthFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pRamBusWidth: *mut u32) -> NvAPI_Status;

/// Undocumented function.
pub unsafe fn NvAPI_GPU_GetRamBusWidth;
}

nvapi! {
nvapi_fn! {
pub type GPU_GetRamBankCountFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pRamBankCount: *mut u32) -> NvAPI_Status;

/// Undocumented function.
Expand Down Expand Up @@ -272,14 +272,14 @@ pub mod private {
}
}

nvapi! {
nvapi_fn! {
pub type GPU_GetFoundryFn = extern "C" fn(hPhysicalGPU: NvPhysicalGpuHandle, pFoundry: *mut NV_GPU_FOUNDRY) -> NvAPI_Status;

/// Undocumented function.
pub unsafe fn NvAPI_GPU_GetFoundry;
}

nvapi! {
nvapi_fn! {
pub unsafe fn NvAPI_GPU_GetFBWidthAndLocation(hPhysicalGpu: NvPhysicalGpuHandle, pWidth: *mut u32, pLocation: *mut u32) -> NvAPI_Status;
}

Expand Down Expand Up @@ -318,19 +318,19 @@ pub mod private {
}
}

nvapi! {
nvapi_fn! {
pub unsafe fn NvAPI_GetGPUIDFromPhysicalGPU(hPhysicalGpu: NvPhysicalGpuHandle, gpuid: *mut u32) -> NvAPI_Status;
}

nvapi! {
nvapi_fn! {
pub unsafe fn NvAPI_GPU_GetShortName(hPhysicalGpu: NvPhysicalGpuHandle, pName: *mut types::NvAPI_ShortString) -> NvAPI_Status;
}

nvapi! {
nvapi_fn! {
pub unsafe fn NvAPI_GPU_GetPartitionCount(hPhysicalGpu: NvPhysicalGpuHandle, pPartitionCount: *mut u32) -> NvAPI_Status;
}

nvapi! {
nvapi_fn! {
pub unsafe fn NvAPI_GetDriverModel(hPhysicalGpu: NvPhysicalGpuHandle, pDriverModel: *mut u32) -> NvAPI_Status;
}
}
Loading