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 11:28:16 +0300
committerJens Peters <jp7677@gmail.com>2022-06-25 01:53:54 +0300
commit9f816b79825bafad4a5c445001c9bc7e9321c12c (patch)
tree63d479bd45c7f7152898108a4d75caf7cdd121bd
parent90e7ead58fe498fab2ecf900cb70cca2e627b19a (diff)
nvapi-gpu: Reimplement NvAPI_GPU_GetBusType using nvmlDeviceGetBusType
-rw-r--r--src/nvapi_gpu.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/nvapi_gpu.cpp b/src/nvapi_gpu.cpp
index 5f02734..c5893be 100644
--- a/src/nvapi_gpu.cpp
+++ b/src/nvapi_gpu.cpp
@@ -115,6 +115,32 @@ extern "C" {
if (!nvapiAdapterRegistry->IsAdapter(adapter))
return ExpectedPhysicalGpuHandle(n);
+ if (adapter->HasNvmlDevice()) {
+ nvmlBusType_t busType;
+ auto result = adapter->GetNvmlDeviceBusType(&busType);
+ if (result == NVML_SUCCESS) {
+ switch (busType) {
+ case NVML_BUS_TYPE_PCI:
+ *pBusType = NVAPI_GPU_BUS_TYPE_PCI;
+ break;
+ case NVML_BUS_TYPE_PCIE:
+ *pBusType = NVAPI_GPU_BUS_TYPE_PCI_EXPRESS;
+ break;
+ case NVML_BUS_TYPE_FPCI:
+ *pBusType = NVAPI_GPU_BUS_TYPE_FPCI;
+ break;
+ case NVML_BUS_TYPE_AGP:
+ *pBusType = NVAPI_GPU_BUS_TYPE_AGP;
+ break;
+ default:
+ *pBusType = NVAPI_GPU_BUS_TYPE_UNDEFINED;
+ break;
+ }
+
+ return Ok(n);
+ }
+ }
+
if (adapter->GetArchitectureId() >= NV_GPU_ARCHITECTURE_GM200)
*pBusType = NVAPI_GPU_BUS_TYPE_PCI_EXPRESS; // Assume PCIe on Maxwell like generation and newer
else