Repository navigation
obs-gpu-status: Classify GPU acceleration for the status light (1/4 of #846) - #890
Merged
Merged
Conversation
…dia-smi (GREEN) classify() returns green for a hardware adapter, yellow for a software renderer while a GPU is present, and red for software rendering with no GPU, a failed graphics init, or a median frame time over budget. GPUs come from /sys/class/drm (render node needs /dev/dri too) and nvidia-smi. Refs #846
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of the four PRs planned in the claim on #846: a pure Rust core with no UI, logging or protocol changes yet.
What it adds
rust/obs-gpu-status:classify(adapter, devices, frames): green when the adapter is a hardware GPU. Yellow when it is a software renderer (llvmpipe, softpipe, Microsoft Basic Render Driver, SwiftShader) while an NVIDIA, AMD or Intel GPU is present. Red for software rendering with no GPU, a failed graphics init, or a median frame time over the frame interval.detect_devices(root): reads<root>/sys/class/drm/card*. A device counts as having a render node only when/dev/dri/renderD*also exists, which covers the sandbox case in frontend: GPU acceleration status light (green/yellow/red) in the status bar #846.parse_nvidia_smi/query_nvidia_smi: a second presence signal fromnvidia-smi --query-gpu=name,pci.device_id --format=csv,noheader, which also fills in GPU names.platform::system_devices()is the only host-specific code: sysfs plus nvidia-smi on Linux, nvidia-smi only elsewhere. DXGI enumeration on Windows comes in a follow-up.Tests
todo!()stubs, 0 passed / 12 failed../lintis ok.cargo run --example probelists the RTX 3060 and RTX 2080 Ti with names and render nodes.Refs #846