Skip to content

fix(rog-platform): select the dGPU by PCI vendor in telemetry fallbacks - #274

Closed
NB-Group wants to merge 1 commit into
OpenGamingCollective:mainfrom
NB-Group:rogcc-fix-dgpu-selection
Closed

fix(rog-platform): select the dGPU by PCI vendor in telemetry fallbacks#274
NB-Group wants to merge 1 commit into
OpenGamingCollective:mainfrom
NB-Group:rogcc-fix-dgpu-selection

Conversation

@NB-Group

@NB-Group NB-Group commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

When NVML isn't available, get_gpu_usage_pct and get_gpu_temp scanned sysfs for the first node that matched, without checking which GPU it came from. On a hybrid laptop with an AMD APU alongside the NVIDIA dGPU, that first match is the APU, so the values shown as dGPU were really the integrated GPU.

This adds two helpers on top of the existing Device::find() (which already picks the dGPU by PCI vendor and whether it drives a display) and points both fallbacks at the dGPU's own drm card and hwmon directories. The iGPU helpers already filtered by vendor; the dGPU ones now match that.

On a box where NVML fails and the closed NVIDIA driver exposes no sysfs nodes, these still read nothing. That's a driver or userspace mismatch, not something the code can work around.

The two dGPU readouts (get_gpu_usage_pct, get_gpu_temp) go through NVML first and only fall back to sysfs when NVML is unavailable, which is exactly when the wrong card gets reported. The fallbacks scanned /sys/class/drm and /sys/class/hwmon and grabbed the first matching node, with no vendor or device pinning. On a hybrid laptop that first node is the iGPU: amdgpu sits on card0 and exposes gpu_busy_percent and temp1_input, so an NVML failure (a common driver/library mismatch on rolling-release distros) silently turned the home page GPU tile into an iGPU readout.

Pin the dGPU with the existing Device::find() helper, which already does the PCI vendor plus connected-panel check, and read these nodes from the dGPU's own DRM card and hwmon directory. The iGPU counterparts (get_igpu_usage_pct, get_igpu_temp) already filtered by vendor; this brings the dGPU side in line with them.
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 023bfc3f-afa1-4918-9347-675d7c43b338

📥 Commits

Reviewing files that changed from the base of the PR and between d23d0cc and 72b02fb.

📒 Files selected for processing (1)
  • rog-platform/src/gpu_pci.rs
📜 Recent review details
🔇 Additional comments (3)
rog-platform/src/gpu_pci.rs (3)

621-653: LGTM!


712-719: LGTM!


734-741: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved GPU temperature detection by selecting the dedicated graphics processor’s sensor data.
    • Improved GPU utilization reporting by reading usage metrics from the correct graphics processor.
    • Reduced the risk of displaying inaccurate readings when multiple graphics devices are present.

Walkthrough

The dGPU PCI device now identifies its dedicated DRM card and hwmon directories. GPU temperature and utilization fallbacks use those directories instead of the first matching system entries.

Changes

dGPU metric fallback

Layer / File(s) Summary
dGPU path discovery
rog-platform/src/gpu_pci.rs
Private helpers identify the dGPU and locate its DRM card and hwmon directories.
Targeted fallback metric reads
rog-platform/src/gpu_pci.rs
Temperature reads temp1_input from the dGPU hwmon directory. Utilization reads gpu_busy_percent from the dGPU DRM card directory.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: rog-platform, fix

Suggested reviewers: ghoul4500, scardracs, neroreflex

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the bug and implementation, but it omits the required hardware, environment, issue, and verification details. Add the tested laptop model, Linux distribution, kernel version, issue reference, and completed verification checklist.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: selecting the dGPU by PCI vendor for telemetry fallbacks.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added fix Fix a bug or an issue rog-platform GPU Switching / Armoury / WMI labels Aug 7, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Aug 7, 2026
5 tasks
@Ghoul4500

Copy link
Copy Markdown
Member

Superseded by #294

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Fix a bug or an issue rog-platform GPU Switching / Armoury / WMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants