Skip to content

Commit

Permalink
fix(config): handle none direct gpu name
Browse files Browse the repository at this point in the history
fix #85
  • Loading branch information
orblazer committed May 30, 2024
1 parent 8163691 commit b5e8896
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions package/contents/ui/config/AvailableGraphProxy.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,43 @@ ListModel {
}
let deviceName = data(topLeft, Qt.Value);

// Special case for non NVIDIA graphic card (eg. in AMD the name look like "Navi 21 [Radeon RX 6950 XT]")
const nameMatch = deviceName.match(gpuNameRegex);
if (nameMatch) {
if (nameMatch[1].startsWith("Radeon")) {
deviceName = "AMD ";
} else {
deviceName = "Intel ";
// Prevent case when name is not retrieved
if (deviceName === "") {
cache.nameRetry += 1;
_cache.set(sensorId, cache);
if (cache.nameRetry < 3) {
return;
}
deviceName += nameMatch[1];
}

// Fallback to unknown name
deviceName = cache.device + ": UNKNOWN";
} else {
// Special case for non NVIDIA graphic card (eg. in AMD the name look like "Navi 21 [Radeon RX 6950 XT]")
const nameMatch = deviceName.match(gpuNameRegex);
if (nameMatch) {
if (nameMatch[1].startsWith("Radeon")) {
deviceName = "AMD ";
} else {
deviceName = "Intel ";
}
deviceName += nameMatch[1];
}
}
root.set(cache.index, GraphFns.getDisplayInfo("gpu", i18nc, cache.section, cache.device, deviceName));

// Clean things
_cache.delete(sensorId);
if (_cache.size === 0) {
enabled = false
enabled = false;
}
}

function fetch(sensorId, index, section, device) {
_cache.set(sensorId, {
index,
section,
device
device,
nameRetry: 0
});
sensors.push(sensorId);
sensors = sensors; // hack to update sensors
Expand Down Expand Up @@ -133,7 +145,6 @@ ListModel {
} else if (type === "gpu") {
// GPU name need to be fetched by sensor
root._gpuNameFetcher.fetch(sensorId, i + _lastCount, section, device);
return;
} else {
deviceName = device;
}
Expand Down

0 comments on commit b5e8896

Please sign in to comment.