mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 09:33:39 +01:00
GPU: rename use-nvml to driver-specific
Because we are supporting drivers other than NVML
This commit is contained in:
@@ -241,22 +241,22 @@ static void pciHandleDevice(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
|
||||
gpu->temperature = FF_GPU_TEMP_UNSET;
|
||||
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
|
||||
|
||||
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA && (options->temp || options->useNvml))
|
||||
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA && (options->temp || options->driverSpecific))
|
||||
{
|
||||
ffDetectNvidiaGpuInfo(&(FFGpuDriverCondition) {
|
||||
.type = FF_GPU_DRIVER_CONDITION_TYPE_BUS_ID,
|
||||
.pciDeviceId = {
|
||||
.domain = device->domain,
|
||||
.pciBusId = {
|
||||
.domain = (uint32_t) device->domain,
|
||||
.bus = device->bus,
|
||||
.device = device->dev,
|
||||
.func = device->func,
|
||||
},
|
||||
}, (FFGpuNvidiaResult) {
|
||||
}, (FFGpuDriverResult) {
|
||||
.temp = options->temp ? &gpu->temperature : NULL,
|
||||
.memory = options->useNvml ? &gpu->dedicated : NULL,
|
||||
.coreCount = options->useNvml ? (uint32_t*) &gpu->coreCount : NULL,
|
||||
.type = options->useNvml ? (uint32_t*) &gpu->type : NULL,
|
||||
.frequency = options->useNvml ? &gpu->frequency : NULL,
|
||||
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
|
||||
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
|
||||
.type = options->driverSpecific ? &gpu->type : NULL,
|
||||
.frequency = options->driverSpecific ? &gpu->frequency : NULL,
|
||||
}, "libnvidia-ml.so");
|
||||
|
||||
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET)
|
||||
|
||||
@@ -90,7 +90,7 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
|
||||
}
|
||||
|
||||
if ((gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA || gpu->vendor.chars == FF_GPU_VENDOR_NAME_INTEL) &&
|
||||
(options->temp || options->useNvml))
|
||||
(options->temp || options->driverSpecific))
|
||||
{
|
||||
uint32_t vendorId, deviceId, subSystemId, revId;
|
||||
// See: https://download.nvidia.com/XFree86/Linux-x86_64/545.23.06/README/supportedchips.html
|
||||
@@ -108,10 +108,10 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
|
||||
},
|
||||
}, (FFGpuDriverResult) {
|
||||
.temp = options->temp ? &gpu->temperature : NULL,
|
||||
.memory = options->useNvml ? &gpu->dedicated : NULL,
|
||||
.coreCount = options->useNvml ? (uint32_t*) &gpu->coreCount : NULL,
|
||||
.type = options->useNvml ? (uint32_t*) &gpu->type : NULL,
|
||||
.frequency = options->useNvml ? &gpu->frequency : NULL,
|
||||
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
|
||||
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
|
||||
.type = options->driverSpecific ? &gpu->type : NULL,
|
||||
.frequency = options->driverSpecific ? &gpu->frequency : NULL,
|
||||
}, gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA ? "nvml.dll" :
|
||||
#ifdef _WIN64
|
||||
"ControlLib.dll"
|
||||
|
||||
@@ -14,6 +14,8 @@ extern "C" {
|
||||
#include <utility>
|
||||
#include <cinttypes>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
|
||||
template <typename Fn>
|
||||
struct on_scope_exit {
|
||||
on_scope_exit(Fn &&fn): _fn(std::move(fn)) {}
|
||||
@@ -96,9 +98,9 @@ const char* ffGPUDetectByDirectX(FF_MAYBE_UNUSED const FFGPUOptions* options, FF
|
||||
const char* vendorStr = ffGetGPUVendorString((unsigned) hardwareId.vendorID);
|
||||
ffStrbufSetStatic(&gpu->vendor, vendorStr);
|
||||
|
||||
if (vendorStr == FF_GPU_VENDOR_NAME_NVIDIA && options->useNvml)
|
||||
if (vendorStr == FF_GPU_VENDOR_NAME_NVIDIA && options->driverSpecific)
|
||||
{
|
||||
ffDetectNvidiaGpuInfo(&(FFGpuDriverCondition) {
|
||||
FFGpuDriverCondition cond = {
|
||||
.type = FF_GPU_DRIVER_CONDITION_TYPE_DEVICE_ID,
|
||||
.pciDeviceId = {
|
||||
.deviceId = hardwareId.deviceID,
|
||||
@@ -106,12 +108,13 @@ const char* ffGPUDetectByDirectX(FF_MAYBE_UNUSED const FFGPUOptions* options, FF
|
||||
.subSystemId = hardwareId.subSysID,
|
||||
.revId = hardwareId.revision,
|
||||
},
|
||||
}, (FFGpuNvidiaResult) {
|
||||
};
|
||||
ffDetectNvidiaGpuInfo(&cond, (FFGpuDriverResult) {
|
||||
.temp = options->temp ? &gpu->temperature : NULL,
|
||||
.memory = options->useNvml ? &gpu->dedicated : NULL,
|
||||
.coreCount = options->useNvml ? (uint32_t*) &gpu->coreCount : NULL,
|
||||
.type = options->useNvml ? (uint32_t*) &gpu->type : NULL,
|
||||
.frequency = options->useNvml ? &gpu->frequency : NULL,
|
||||
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
|
||||
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
|
||||
.type = options->driverSpecific ? &gpu->type : NULL,
|
||||
.frequency = options->driverSpecific ? &gpu->frequency : NULL,
|
||||
}, "/usr/lib/wsl/lib/libnvidia-ml.so");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user