From 7dc9530a3e3d804b36a0d78a75e39efdcf72bbba Mon Sep 17 00:00:00 2001 From: manascb1344 <122693801+manascb1344@users.noreply.github.com> Date: Wed, 25 Mar 2026 03:36:17 +0530 Subject: [PATCH] fix(about): deduplicate OpenGL GPU name variants in About page (#1906) Fixes #1814 ## Problem When a system has an NVIDIA GPU, wgpu enumerates it twice: - Via Vulkan backend: `"NVIDIA GeForce RTX 3080 Ti Laptop GPU"` - Via OpenGL backend: `"NVIDIA GeForce RTX 3080 Ti Laptop GPU/PCIe/SSE2"` The OpenGL variant includes a renderer suffix (`/PCIe/SSE2`) which causes the name-based deduplication to fail, resulting in duplicate GPU entries in Settings -> System -> About. ## Solution Add `normalize_gpu_name()` helper that strips OpenGL renderer suffixes (everything after `/`) before comparing names for deduplication. This ensures both Vulkan and OpenGL representations of the same GPU are correctly identified as duplicates. ## Changes - `cosmic-settings/src/pages/system/info.rs`: - Added `normalize_gpu_name()` function with doc comment - Modified `wgpu_graphics()` to use normalized names for `seen_names` HashSet ## Testing - [x] `cargo fmt --check` passes - [x] `cargo clippy --all-features` passes (no new warnings) - [x] `cargo test --all-features` passes (3/3 tests) - [x] `just check-features` passes - [x] Manual testing: Verified on system with NVIDIA GPU that duplicate entries no longer appear ## Checklist - [x] I have disclosed use of any AI generated code in my commit messages. - [x] I understand these changes in full and will be able to respond to review comments. - [x] My change is accurately described in the commit message. - [x] My contribution is tested and working as described. - [x] I have read the Developer Certificate of Origin and certify my contribution under its conditions. Signed-off-by: manascb1344 --- cosmic-settings/src/pages/system/info.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cosmic-settings/src/pages/system/info.rs b/cosmic-settings/src/pages/system/info.rs index 97a96a9..656ef23 100644 --- a/cosmic-settings/src/pages/system/info.rs +++ b/cosmic-settings/src/pages/system/info.rs @@ -22,6 +22,12 @@ pub struct Info { } impl Info { + /// OpenGL backend reports GPU names with renderer suffixes like "/PCIe/SSE2". + /// We strip these to match against Vulkan backend's clean name. + fn normalize_gpu_name(name: &str) -> String { + name.split('/').next().unwrap_or(name).trim().to_string() + } + #[cfg(feature = "wgpu")] fn wgpu_graphics() -> Vec { let mut graphics = Vec::new(); @@ -104,14 +110,16 @@ impl Info { continue; } - if adapter_info.device == 0 && seen_names.contains(&gpu_name) { + let normalized_gpu_name = Self::normalize_gpu_name(&gpu_name); + + if adapter_info.device == 0 && seen_names.contains(&normalized_gpu_name) { continue; } if adapter_info.device != 0 { seen_devices.insert(device_key); } - seen_names.insert(gpu_name.clone()); + seen_names.insert(normalized_gpu_name); graphics.push(gpu_name); }