mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 00:03:58 +01:00
GPU: detects max PCI gen & link width
This commit is contained in:
@@ -139,6 +139,11 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
||||
}
|
||||
}
|
||||
|
||||
char pcieSpeed[32] = "";
|
||||
if (gpu->pcieGen != FF_GPU_PCI_INFO_UNSET && gpu->pcieLanes != FF_GPU_PCI_INFO_UNSET) {
|
||||
snprintf(pcieSpeed, sizeof(pcieSpeed), "PCI Gen %d x%d", gpu->pcieGen, gpu->pcieLanes);
|
||||
}
|
||||
|
||||
FF_PRINT_FORMAT_CHECKED(FF_GPU_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||
FF_ARG(gpu->vendor, "vendor"),
|
||||
FF_ARG(gpu->name, "name"),
|
||||
@@ -160,6 +165,7 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
||||
FF_ARG(coreUsageNum, "core-usage-num"),
|
||||
FF_ARG(coreUsageBar, "core-usage-bar"),
|
||||
FF_ARG(gpu->memoryType, "memory-type"),
|
||||
FF_ARG(pcieSpeed, "pcie-speed"),
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -420,6 +426,22 @@ bool ffGenerateGPUJsonResult(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_
|
||||
}
|
||||
|
||||
yyjson_mut_obj_add_uint(doc, obj, "deviceId", gpu->deviceId);
|
||||
|
||||
if (gpu->pcieGen != FF_GPU_PCI_INFO_UNSET || gpu->pcieLanes != FF_GPU_PCI_INFO_UNSET) {
|
||||
yyjson_mut_val* pcieSpeed = yyjson_mut_obj_add_obj(doc, obj, "pcieSpeed");
|
||||
if (gpu->pcieGen != FF_GPU_PCI_INFO_UNSET) {
|
||||
yyjson_mut_obj_add_uint(doc, pcieSpeed, "gen", gpu->pcieGen);
|
||||
} else {
|
||||
yyjson_mut_obj_add_null(doc, pcieSpeed, "gen");
|
||||
}
|
||||
if (gpu->pcieLanes != FF_GPU_PCI_INFO_UNSET) {
|
||||
yyjson_mut_obj_add_uint(doc, pcieSpeed, "lanes", gpu->pcieLanes);
|
||||
} else {
|
||||
yyjson_mut_obj_add_null(doc, pcieSpeed, "lanes");
|
||||
}
|
||||
} else {
|
||||
yyjson_mut_obj_add_null(doc, obj, "pcieSpeed");
|
||||
}
|
||||
}
|
||||
|
||||
FF_LIST_FOR_EACH (FFGPUResult, gpu, gpus) {
|
||||
@@ -484,5 +506,6 @@ FFModuleBaseInfo ffGPUModuleInfo = {
|
||||
{ "Core usage percentage num", "core-usage-num" },
|
||||
{ "Core usage percentage bar", "core-usage-bar" },
|
||||
{ "Memory type (Windows only)", "memory-type" },
|
||||
{ "Maximum PCIe speed in gen and lanes", "pcie-speed" },
|
||||
})),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user