mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-08 06:00:08 +01:00
GPU: detect current pcie link speed
This commit is contained in:
@@ -235,20 +235,34 @@ const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResu
|
||||
FF_DEBUG("Setting adapter name: %s; UDID: %s, Present: %d, Exist: %d", device->strAdapterName, device->strUDID, device->iPresent, device->iExist);
|
||||
}
|
||||
|
||||
if (result.pcieGen || result.pcieLanes) {
|
||||
if (result.psMax || result.psCurr) {
|
||||
ADLChipSetInfo chipSetInfo;
|
||||
int status = adlData.ffADL2_Adapter_ChipSetInfo_Get(adlData.apiHandle, device->iAdapterIndex, &chipSetInfo);
|
||||
FF_DEBUG("ADL2_Adapter_ChipSetInfo_Get returned %s (%d)", ffAdlStatusToString(status), status);
|
||||
|
||||
if (status == ADL_OK) {
|
||||
FF_DEBUG("Chipset info - Bus Type: %d, PCIe Lane Width: %d", chipSetInfo.iBusType, chipSetInfo.iMaxPCIELaneWidth);
|
||||
if (result.pcieGen && chipSetInfo.iBusType >= 2) {
|
||||
*result.pcieGen = (uint16_t) (chipSetInfo.iBusType - 2);
|
||||
FF_DEBUG("Got PCIe Gen: %u", *result.pcieGen);
|
||||
FF_DEBUG("Chipset info - iBusSpeedType: %d, iMaxPCIELaneWidth: %d", chipSetInfo.iBusSpeedType, chipSetInfo.iMaxPCIELaneWidth);
|
||||
if (result.psMax) {
|
||||
if (chipSetInfo.iBusSpeedType >= 2) {
|
||||
result.psMax->gen = (uint16_t) (chipSetInfo.iBusSpeedType - 2);
|
||||
FF_DEBUG("Got PCIe Max Gen: %u", result.psMax->gen);
|
||||
}
|
||||
if (chipSetInfo.iMaxPCIELaneWidth > 0) {
|
||||
result.psMax->lanes = (uint16_t) chipSetInfo.iMaxPCIELaneWidth;
|
||||
FF_DEBUG("Got PCIe Max Lanes: %u", result.psMax->lanes);
|
||||
}
|
||||
}
|
||||
if (result.pcieLanes && chipSetInfo.iMaxPCIELaneWidth > 0) {
|
||||
*result.pcieLanes = (uint16_t) chipSetInfo.iMaxPCIELaneWidth;
|
||||
FF_DEBUG("Got PCIe Lanes: %u", *result.pcieLanes);
|
||||
|
||||
FF_DEBUG("Chipset info - iBusType: %d, iCurrentPCIELaneWidth: %d", chipSetInfo.iBusType, chipSetInfo.iCurrentPCIELaneWidth);
|
||||
if (result.psCurr) {
|
||||
if (chipSetInfo.iBusType >= 2) {
|
||||
result.psCurr->gen = (uint16_t) (chipSetInfo.iBusType - 2);
|
||||
FF_DEBUG("Got PCIe Current Gen: %u", result.psCurr->gen);
|
||||
}
|
||||
if (chipSetInfo.iCurrentPCIELaneWidth > 0) {
|
||||
result.psCurr->lanes = (uint16_t) chipSetInfo.iCurrentPCIELaneWidth;
|
||||
FF_DEBUG("Got PCIe Current Lanes: %u", result.psCurr->lanes);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
FF_DEBUG("Failed to get chipset information");
|
||||
|
||||
Reference in New Issue
Block a user