mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
GPU: rename use-nvml
to driver-specific
Because we are supporting drivers other than NVML
This commit is contained in:
parent
4a1bbb6a03
commit
f8be6322df
@ -1191,8 +1191,8 @@
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"useNvml": {
|
||||
"description": "Use nvml (NVIDIA Management Library) to detect more detailed GPU information (memory usage, CUDA core count, etc)",
|
||||
"driverSpecific": {
|
||||
"description": "Use driver specific method to detect more detailed GPU information (memory usage, core count, etc)",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
|
@ -1082,9 +1082,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "gpu-use-nvml",
|
||||
"desc": "Use nvml (NVIDIA Management Library) to detect more detailed GPU information",
|
||||
"remark": "Detects memory usage, CUDA core count, etc. Requires NVIDIA proprietary driver installed",
|
||||
"long": "gpu-driver-specific",
|
||||
"desc": "Use driver specific method to detect more detailed GPU information (memory usage, core count, etc)",
|
||||
"remark": "Correctly NVML (NVIDIA) and IGCL (Intel, Windows only) are supported. Both require the latest proprietary driver to be installed",
|
||||
"arg": {
|
||||
"type": "bool",
|
||||
"optional": true,
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -133,9 +133,9 @@ bool ffParseGPUCommandOptions(FFGPUOptions* options, const char* key, const char
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "use-nvml"))
|
||||
if (ffStrEqualsIgnCase(subKey, "driver-specific"))
|
||||
{
|
||||
options->useNvml = ffOptionParseBoolean(value);
|
||||
options->driverSpecific = ffOptionParseBoolean(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -183,9 +183,9 @@ void ffParseGPUJsonObject(FFGPUOptions* options, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "useNvml"))
|
||||
if (ffStrEqualsIgnCase(key, "driverSpecific"))
|
||||
{
|
||||
options->useNvml = yyjson_get_bool(val);
|
||||
options->driverSpecific = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -222,8 +222,8 @@ void ffGenerateGPUJsonConfig(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_
|
||||
|
||||
ffJsonConfigGenerateModuleArgsConfig(doc, module, &defaultOptions.moduleArgs, &options->moduleArgs);
|
||||
|
||||
if (options->useNvml != defaultOptions.useNvml)
|
||||
yyjson_mut_obj_add_bool(doc, module, "useNvml", options->useNvml);
|
||||
if (options->driverSpecific != defaultOptions.driverSpecific)
|
||||
yyjson_mut_obj_add_bool(doc, module, "driverSpecific", options->driverSpecific);
|
||||
|
||||
if (options->forceVulkan != defaultOptions.forceVulkan)
|
||||
yyjson_mut_obj_add_bool(doc, module, "forceVulkan", options->forceVulkan);
|
||||
@ -354,7 +354,7 @@ void ffInitGPUOptions(FFGPUOptions* options)
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
options->useNvml = false;
|
||||
options->driverSpecific = false;
|
||||
options->forceVulkan = false;
|
||||
options->temp = false;
|
||||
options->hideType = FF_GPU_TYPE_UNKNOWN;
|
||||
|
@ -18,6 +18,6 @@ typedef struct FFGPUOptions
|
||||
|
||||
FFGPUType hideType;
|
||||
bool temp;
|
||||
bool useNvml;
|
||||
bool driverSpecific;
|
||||
bool forceVulkan;
|
||||
} FFGPUOptions;
|
||||
|
Loading…
x
Reference in New Issue
Block a user