From 0d56db3b6cd28083f4dfd19815fef2730668a78f Mon Sep 17 00:00:00 2001 From: Bilal Özel <112190455+Shinobu420@users.noreply.github.com> Date: Mon, 9 Mar 2026 15:33:33 +0100 Subject: systemusage: improve GPU detection for AMD RX series GPU (#1246) * SystemUsage:improve GPU-Detection for AMD RX series GPU updated the gpuNameDetect command with glxinfo to fix gpu name detection * SystemUsage: adjust lspci command to detect graphics card better * SystemUsage: adjust regex to extract name out of last bracket * clean less * no need xargs --------- Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> --- services/SystemUsage.qml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'services') diff --git a/services/SystemUsage.qml b/services/SystemUsage.qml index 1144932..ce62017 100644 --- a/services/SystemUsage.qml +++ b/services/SystemUsage.qml @@ -49,7 +49,7 @@ Singleton { } function cleanGpuName(name: string): string { - return name.replace(/NVIDIA GeForce /gi, "").replace(/NVIDIA /gi, "").replace(/AMD Radeon /gi, "").replace(/AMD /gi, "").replace(/Intel /gi, "").replace(/\(R\)/gi, "").replace(/\(TM\)/gi, "").replace(/Graphics/gi, "").replace(/\s+/g, " ").trim(); + return name.replace(/\(R\)/gi, "").replace(/\(TM\)/gi, "").replace(/Graphics/gi, "").replace(/\s+/g, " ").trim(); } function formatKib(kib: real): var { @@ -232,7 +232,7 @@ Singleton { id: gpuNameDetect running: true - command: ["sh", "-c", "nvidia-smi --query-gpu=name --format=csv,noheader 2>/dev/null || lspci 2>/dev/null | grep -i 'vga\\|3d\\|display' | head -1"] + command: ["sh", "-c", "nvidia-smi --query-gpu=name --format=csv,noheader 2>/dev/null || glxinfo -B 2>/dev/null | grep 'Device:' | cut -d':' -f2 | cut -d'(' -f1 || lspci 2>/dev/null | grep -i 'vga\\|3d controller\\|display' | head -1"] stdout: StdioCollector { onStreamFinished: { const output = text.trim(); @@ -242,9 +242,12 @@ Singleton { // Check if it's from nvidia-smi (clean GPU name) if (output.toLowerCase().includes("nvidia") || output.toLowerCase().includes("geforce") || output.toLowerCase().includes("rtx") || output.toLowerCase().includes("gtx")) { root.gpuName = root.cleanGpuName(output); + } else if (output.toLowerCase().includes("rx")) { + root.gpuName = root.cleanGpuName(output); } else { // Parse lspci output: extract name from brackets or after colon - const bracketMatch = output.match(/\[([^\]]+)\]/); + // Handles cases like [AMD/ATI] Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] (rev c0) + const bracketMatch = output.match(/\[([^\]]+)\][^\[]*$/); if (bracketMatch) { root.gpuName = root.cleanGpuName(bracketMatch[1]); } else { -- cgit v1.2.3-freya