Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jp7677/dxvk-nvapi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Bogacki <krzysztof.bogacki@leancode.pl>2022-06-06 03:52:54 +0300
committerJens Peters <jp7677@gmail.com>2022-06-25 01:53:54 +0300
commitbb58f18b36f1ad7e3beffdbbfaad26ce1087066a (patch)
tree6a7be81794c8aa4cceae000ac09b729abc14e2b0
parent7e73fbaa1824aebad8ecc3ade4d05f854e34c86f (diff)
nvml: Allow some NVML functions to be missing
-rw-r--r--src/nvapi_gpu.cpp11
-rw-r--r--src/sysinfo/nvml.cpp32
2 files changed, 30 insertions, 13 deletions
diff --git a/src/nvapi_gpu.cpp b/src/nvapi_gpu.cpp
index 31c2e6a..91f0968 100644
--- a/src/nvapi_gpu.cpp
+++ b/src/nvapi_gpu.cpp
@@ -307,6 +307,9 @@ extern "C" {
case NVML_SUCCESS:
str::tonvss(szBiosRevision, version);
return Ok(n);
+ case NVML_ERROR_FUNCTION_NOT_FOUND:
+ str::tonvss(szBiosRevision, "N/A");
+ return Ok(n);
case NVML_ERROR_NOT_SUPPORTED:
return NotSupported(n);
case NVML_ERROR_GPU_IS_LOST:
@@ -358,6 +361,8 @@ extern "C" {
pDynamicPstatesInfoEx->utilization[i].bIsPresent = 0;
return Ok(n, alreadyLoggedOk);
+ case NVML_ERROR_FUNCTION_NOT_FOUND:
+ return NoImplementation(n, alreadyLoggedNoNvml);
case NVML_ERROR_NOT_SUPPORTED:
pDynamicPstatesInfoEx->flags = 0;
for (auto& util : pDynamicPstatesInfoEx->utilization)
@@ -428,6 +433,8 @@ extern "C" {
return Error(n); // Unreachable, but just to be sure
}
return Ok(n, alreadyLoggedOk);
+ case NVML_ERROR_FUNCTION_NOT_FOUND:
+ return NoImplementation(n, alreadyLoggedNoNvml);
case NVML_ERROR_NOT_SUPPORTED:
switch (pThermalSettings->version) {
case NV_GPU_THERMAL_SETTINGS_VER_1: {
@@ -477,6 +484,8 @@ extern "C" {
case NVML_SUCCESS:
*pCurrentPstate = static_cast<NV_GPU_PERF_PSTATE_ID>(pState);
return Ok(n, alreadyLoggedOk);
+ case NVML_ERROR_FUNCTION_NOT_FOUND:
+ return NoImplementation(n, alreadyLoggedNoNvml);
case NVML_ERROR_NOT_SUPPORTED:
return NotSupported(n);
case NVML_ERROR_GPU_IS_LOST:
@@ -545,6 +554,8 @@ extern "C" {
return Error(n); // Unreachable, but just to be sure
}
break;
+ case NVML_ERROR_FUNCTION_NOT_FOUND:
+ return NoImplementation(n, alreadyLoggedNoNvml);
case NVML_ERROR_NOT_SUPPORTED:
break;
case NVML_ERROR_GPU_IS_LOST:
diff --git a/src/sysinfo/nvml.cpp b/src/sysinfo/nvml.cpp
index e1ef64a..a4f1034 100644
--- a/src/sysinfo/nvml.cpp
+++ b/src/sysinfo/nvml.cpp
@@ -32,13 +32,7 @@ namespace dxvk {
if (m_nvmlInit_v2 == nullptr
|| m_nvmlShutdown == nullptr
|| m_nvmlErrorString == nullptr
- || m_nvmlDeviceGetHandleByPciBusId_v2 == nullptr
- || m_nvmlDeviceGetPciInfo_v3 == nullptr
- || m_nvmlDeviceGetTemperature == nullptr
- || m_nvmlDeviceGetUtilizationRates == nullptr
- || m_nvmlDeviceGetVbiosVersion == nullptr
- || m_nvmlDeviceGetPerformanceState == nullptr
- || m_nvmlDeviceGetClockInfo == nullptr)
+ || m_nvmlDeviceGetHandleByPciBusId_v2 == nullptr)
log::write(str::format("NVML loaded but initialization failed"));
else {
auto result = m_nvmlInit_v2();
@@ -74,27 +68,39 @@ namespace dxvk {
}
nvmlReturn_t Nvml::DeviceGetPciInfo_v3(nvmlDevice_t device, nvmlPciInfo_t* pci) const {
- return m_nvmlDeviceGetPciInfo_v3(device, pci);
+ return m_nvmlDeviceGetPciInfo_v3
+ ? m_nvmlDeviceGetPciInfo_v3(device, pci)
+ : NVML_ERROR_FUNCTION_NOT_FOUND;
}
nvmlReturn_t Nvml::DeviceGetTemperature(nvmlDevice_t device, nvmlTemperatureSensors_t sensorType, unsigned int* temp) const {
- return m_nvmlDeviceGetTemperature(device, sensorType, temp);
+ return m_nvmlDeviceGetTemperature
+ ? m_nvmlDeviceGetTemperature(device, sensorType, temp)
+ : NVML_ERROR_FUNCTION_NOT_FOUND;
}
nvmlReturn_t Nvml::DeviceGetUtilizationRates(nvmlDevice_t device, nvmlUtilization_t* utilization) const {
- return m_nvmlDeviceGetUtilizationRates(device, utilization);
+ return m_nvmlDeviceGetUtilizationRates
+ ? m_nvmlDeviceGetUtilizationRates(device, utilization)
+ : NVML_ERROR_FUNCTION_NOT_FOUND;
}
nvmlReturn_t Nvml::DeviceGetVbiosVersion(nvmlDevice_t device, char* version, unsigned int length) const {
- return m_nvmlDeviceGetVbiosVersion(device, version, length);
+ return m_nvmlDeviceGetVbiosVersion
+ ? m_nvmlDeviceGetVbiosVersion(device, version, length)
+ : NVML_ERROR_FUNCTION_NOT_FOUND;
}
nvmlReturn_t Nvml::DeviceGetPerformanceState(nvmlDevice_t device, nvmlPstates_t* pState) const {
- return m_nvmlDeviceGetPerformanceState(device, pState);
+ return m_nvmlDeviceGetPerformanceState
+ ? m_nvmlDeviceGetPerformanceState(device, pState)
+ : NVML_ERROR_FUNCTION_NOT_FOUND;
}
nvmlReturn_t Nvml::DeviceGetClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) const {
- return m_nvmlDeviceGetClockInfo(device, type, clock);
+ return m_nvmlDeviceGetClockInfo
+ ? m_nvmlDeviceGetClockInfo(device, type, clock)
+ : NVML_ERROR_FUNCTION_NOT_FOUND;
}
template <typename T>