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>
This commit is contained in:
manascb1344 2026-03-25 03:36:17 +05:30 committed by GitHub
parent 4597822df4
commit 7dc9530a3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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<String> {
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);
}