mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-08 14:10:11 +01:00
GPU: detect current pcie link speed
This commit is contained in:
@@ -17,6 +17,7 @@ struct FFIgclData {
|
||||
FF_LIBRARY_SYMBOL(ctlEnumFrequencyDomains)
|
||||
FF_LIBRARY_SYMBOL(ctlFrequencyGetProperties)
|
||||
FF_LIBRARY_SYMBOL(ctlPciGetProperties)
|
||||
FF_LIBRARY_SYMBOL(ctlPciGetState)
|
||||
|
||||
bool inited;
|
||||
ctl_api_handle_t apiHandle;
|
||||
@@ -45,6 +46,7 @@ const char* ffDetectIntelGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverRe
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libigcl, igclData, ctlEnumFrequencyDomains)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libigcl, igclData, ctlFrequencyGetProperties)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libigcl, igclData, ctlPciGetProperties)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libigcl, igclData, ctlPciGetState)
|
||||
|
||||
if (ffctlInit(&(ctl_init_args_t) {
|
||||
.AppVersion = CTL_IMPL_VERSION,
|
||||
@@ -229,14 +231,25 @@ const char* ffDetectIntelGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverRe
|
||||
ffStrbufSetS(result.name, properties.name);
|
||||
}
|
||||
|
||||
if (result.pcieGen || result.pcieLanes) {
|
||||
if (result.psMax) {
|
||||
ctl_pci_properties_t pciProps = { .Size = sizeof(pciProps), .Version = 0 };
|
||||
if (igclData.ffctlPciGetProperties(device, &pciProps) == CTL_RESULT_SUCCESS) {
|
||||
if (result.pcieGen && pciProps.maxSpeed.gen > 0) {
|
||||
*result.pcieGen = (uint16_t) pciProps.maxSpeed.gen;
|
||||
if (pciProps.maxSpeed.gen > 0) {
|
||||
result.psMax->gen = (uint16_t) pciProps.maxSpeed.gen;
|
||||
}
|
||||
if (result.pcieLanes && pciProps.maxSpeed.width > 0) {
|
||||
*result.pcieLanes = (uint16_t) pciProps.maxSpeed.width;
|
||||
if (pciProps.maxSpeed.width > 0) {
|
||||
result.psMax->lanes = (uint16_t) pciProps.maxSpeed.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result.psCurr) {
|
||||
ctl_pci_state_t pciState = { .Size = sizeof(pciState), .Version = 0 };
|
||||
if (igclData.ffctlPciGetState(device, &pciState) == CTL_RESULT_SUCCESS) {
|
||||
if (pciState.speed.gen > 0) {
|
||||
result.psMax->gen = (uint16_t) pciState.speed.gen;
|
||||
}
|
||||
if (pciState.speed.width > 0) {
|
||||
result.psMax->lanes = (uint16_t) pciState.speed.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user