Skip to content

Commit 7dc9530

Browse files
authored
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 <zephop76593@gmail.com>
1 parent 4597822 commit 7dc9530

File tree

1 file changed

+10
-2
lines changed
  • cosmic-settings/src/pages/system

1 file changed

+10
-2
lines changed

cosmic-settings/src/pages/system/info.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ pub struct Info {
2222
}
2323

2424
impl Info {
25+
/// OpenGL backend reports GPU names with renderer suffixes like "/PCIe/SSE2".
26+
/// We strip these to match against Vulkan backend's clean name.
27+
fn normalize_gpu_name(name: &str) -> String {
28+
name.split('/').next().unwrap_or(name).trim().to_string()
29+
}
30+
2531
#[cfg(feature = "wgpu")]
2632
fn wgpu_graphics() -> Vec<String> {
2733
let mut graphics = Vec::new();
@@ -104,14 +110,16 @@ impl Info {
104110
continue;
105111
}
106112

107-
if adapter_info.device == 0 && seen_names.contains(&gpu_name) {
113+
let normalized_gpu_name = Self::normalize_gpu_name(&gpu_name);
114+
115+
if adapter_info.device == 0 && seen_names.contains(&normalized_gpu_name) {
108116
continue;
109117
}
110118

111119
if adapter_info.device != 0 {
112120
seen_devices.insert(device_key);
113121
}
114-
seen_names.insert(gpu_name.clone());
122+
seen_names.insert(normalized_gpu_name);
115123
graphics.push(gpu_name);
116124
}
117125

0 commit comments

Comments
 (0)