diff options
author | Krzysztof Bogacki <krzysztof.bogacki@leancode.pl> | 2022-06-06 11:27:27 +0300 |
---|---|---|
committer | Jens Peters <jp7677@gmail.com> | 2022-06-25 01:53:54 +0300 |
commit | 90e7ead58fe498fab2ecf900cb70cca2e627b19a (patch) | |
tree | ad7c98f22f6248d61ae71e908a90eec955b38aec | |
parent | c95cb5c8a03c672a880f1527485bb9f2683a4119 (diff) |
nvml: Load and expose nvmlDeviceGetBusType and nvmlDeviceGetDynamicPstatesInfo
-rw-r--r-- | src/sysinfo/nvapi_adapter.cpp | 8 | ||||
-rw-r--r-- | src/sysinfo/nvapi_adapter.h | 2 | ||||
-rw-r--r-- | src/sysinfo/nvml.cpp | 14 | ||||
-rw-r--r-- | src/sysinfo/nvml.h | 6 |
4 files changed, 30 insertions, 0 deletions
diff --git a/src/sysinfo/nvapi_adapter.cpp b/src/sysinfo/nvapi_adapter.cpp index 571a7bb..a2cf148 100644 --- a/src/sysinfo/nvapi_adapter.cpp +++ b/src/sysinfo/nvapi_adapter.cpp @@ -269,4 +269,12 @@ namespace dxvk { nvmlReturn_t NvapiAdapter::GetNvmlDeviceClockInfo(nvmlClockType_t type, unsigned int* clock) const { return m_nvml.DeviceGetClockInfo(m_nvmlDevice, type, clock); } + + nvmlReturn_t NvapiAdapter::GetNvmlDeviceBusType(nvmlBusType_t* type) const { + return m_nvml.DeviceGetBusType(m_nvmlDevice, type); + } + + nvmlReturn_t NvapiAdapter::GetNvmlDeviceDynamicPstatesInfo(nvmlGpuDynamicPstatesInfo_t* pDynamicPstatesInfo) const { + return m_nvml.DeviceGetDynamicPstatesInfo(m_nvmlDevice, pDynamicPstatesInfo); + } } diff --git a/src/sysinfo/nvapi_adapter.h b/src/sysinfo/nvapi_adapter.h index efc35aa..e22f0c8 100644 --- a/src/sysinfo/nvapi_adapter.h +++ b/src/sysinfo/nvapi_adapter.h @@ -36,6 +36,8 @@ namespace dxvk { [[nodiscard]] nvmlReturn_t GetNvmlDeviceVbiosVersion(char* version, unsigned int length) const; [[nodiscard]] nvmlReturn_t GetNvmlDevicePerformanceState(nvmlPstates_t* pState) const; [[nodiscard]] nvmlReturn_t GetNvmlDeviceClockInfo(nvmlClockType_t type, unsigned int* clock) const; + [[nodiscard]] nvmlReturn_t GetNvmlDeviceBusType(nvmlBusType_t* type) const; + [[nodiscard]] nvmlReturn_t GetNvmlDeviceDynamicPstatesInfo(nvmlGpuDynamicPstatesInfo_t* pDynamicPstatesInfo) const; private: Vulkan& m_vulkan; diff --git a/src/sysinfo/nvml.cpp b/src/sysinfo/nvml.cpp index a4f1034..4c3c0e4 100644 --- a/src/sysinfo/nvml.cpp +++ b/src/sysinfo/nvml.cpp @@ -26,6 +26,8 @@ namespace dxvk { GETPROCADDR(nvmlDeviceGetVbiosVersion); GETPROCADDR(nvmlDeviceGetPerformanceState); GETPROCADDR(nvmlDeviceGetClockInfo); + GETPROCADDR(nvmlDeviceGetBusType); + GETPROCADDR(nvmlDeviceGetDynamicPstatesInfo); #undef GETPROCADDR @@ -103,6 +105,18 @@ namespace dxvk { : NVML_ERROR_FUNCTION_NOT_FOUND; } + nvmlReturn_t Nvml::DeviceGetBusType(nvmlDevice_t device, nvmlBusType_t* type) const { + return m_nvmlDeviceGetBusType + ? m_nvmlDeviceGetBusType(device, type) + : NVML_ERROR_FUNCTION_NOT_FOUND; + } + + nvmlReturn_t Nvml::DeviceGetDynamicPstatesInfo(nvmlDevice_t device, nvmlGpuDynamicPstatesInfo_t* pDynamicPstatesInfo) const { + return m_nvmlDeviceGetDynamicPstatesInfo + ? m_nvmlDeviceGetDynamicPstatesInfo(device, pDynamicPstatesInfo) + : NVML_ERROR_FUNCTION_NOT_FOUND; + } + template <typename T> T Nvml::GetProcAddress(const char* name) { return reinterpret_cast<T>(reinterpret_cast<void*>(::GetProcAddress(m_nvmlModule, name))); diff --git a/src/sysinfo/nvml.h b/src/sysinfo/nvml.h index cc7e099..7ccf214 100644 --- a/src/sysinfo/nvml.h +++ b/src/sysinfo/nvml.h @@ -18,6 +18,8 @@ namespace dxvk { [[nodiscard]] virtual nvmlReturn_t DeviceGetVbiosVersion(nvmlDevice_t device, char* version, unsigned int length) const; [[nodiscard]] virtual nvmlReturn_t DeviceGetPerformanceState(nvmlDevice_t device, nvmlPstates_t* pState) const; [[nodiscard]] virtual nvmlReturn_t DeviceGetClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) const; + [[nodiscard]] virtual nvmlReturn_t DeviceGetBusType(nvmlDevice_t device, nvmlBusType_t* type) const; + [[nodiscard]] virtual nvmlReturn_t DeviceGetDynamicPstatesInfo(nvmlDevice_t device, nvmlGpuDynamicPstatesInfo_t* pDynamicPstatesInfo) const; private: typedef decltype(&nvmlInit_v2) PFN_nvmlInit_v2; @@ -30,6 +32,8 @@ namespace dxvk { typedef decltype(&nvmlDeviceGetVbiosVersion) PFN_nvmlDeviceGetVbiosVersion; typedef decltype(&nvmlDeviceGetPerformanceState) PFN_nvmlDeviceGetPerformanceState; typedef decltype(&nvmlDeviceGetClockInfo) PFN_nvmlDeviceGetClockInfo; + typedef decltype(&nvmlDeviceGetBusType) PFN_nvmlDeviceGetBusType; + typedef decltype(&nvmlDeviceGetDynamicPstatesInfo) PFN_nvmlDeviceGetDynamicPstatesInfo; HMODULE m_nvmlModule{}; PFN_nvmlInit_v2 m_nvmlInit_v2{}; @@ -42,6 +46,8 @@ namespace dxvk { PFN_nvmlDeviceGetVbiosVersion m_nvmlDeviceGetVbiosVersion{}; PFN_nvmlDeviceGetPerformanceState m_nvmlDeviceGetPerformanceState{}; PFN_nvmlDeviceGetClockInfo m_nvmlDeviceGetClockInfo{}; + PFN_nvmlDeviceGetBusType m_nvmlDeviceGetBusType{}; + PFN_nvmlDeviceGetDynamicPstatesInfo m_nvmlDeviceGetDynamicPstatesInfo{}; template <typename T> T GetProcAddress(const char* name); |