Repository navigation
obs-gpu-status: Resolve the render node's PCI device (Linux) - #1194
Merged
Merged
Conversation
3 of 6 tasks
Every GPU utilization source (obs-rust#1021 NVML, obs-rust#1023 fdinfo, obs-rust#1024 amdgpu) must measure the GPU OBS renders on, not any GPU. On Linux, EGL names the render node of the display's device (adapter 0 in gl_egl_enum_adapters, "/Software" without one); sysfs maps the node to its PCI device. render_adapter() is a stub that returns Unknown, so the fixture cases fail: two identical cards (10de:2504) on different PCI addresses, one card without a render node, and no node with two cards (Ambiguous, never a guess). Refs obs-rust#1020 Co-Authored-By: Claude Opus 5.5 <[email protected]>
render_adapter() maps the render node that EGL reports for the display (/dev/dri/renderD128) to its PCI address through the node's sysfs `device` link (../../../0000:2b:00.0). Without a render node, one PCI card is the answer and two or more are Ambiguous. "/Software", other names and non-PCI devices are Unknown. platform::render_adapter() runs it against "/" on Linux. Windows (DXGI LUID) and macOS (Metal registryID) return Unknown until their parts of obs-rust#1020 land. The probe example prints the result for a given node. Refs obs-rust#1020 Co-Authored-By: Claude Opus 5.5 <[email protected]>
vpacher
force-pushed
the
feat/gpu-render-adapter-pci
branch
from
October 17, 2026 07:39
a5aba93 to
726d4fd
Compare
Member
Author
|
Force-pushed (10447b9, 726d4fd): the Windows clippy failure was mine. The sysfs fixture helpers ( Separate from this PR: the "CI Pre / Cache Janitor" job fails on fork PRs with |
This was referenced Oct 17, 2026
1 task
3 of 6 tasks
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.
Refs #1020 (Linux part; Windows DXGI LUID and macOS Metal
registryIDstay open)What and why
Every GPU utilization source (#1021 NVML, #1023 fdinfo, #1024 amdgpu) must measure the GPU that OBS renders on. On a machine with two identical cards, the vendor and device IDs do not tell them apart; the PCI address does.
On Linux, EGL names the render node of the display's device.
gl_egl_enum_adapters()already reports it as adapter 0 (/dev/dri/renderD128, or/Softwarewithout one). This PR adds the resolution from that node to its PCI device:render_adapter(root, render_node)inrust/obs-gpu-statusreads the node's sysfsdevicelink (/sys/class/drm/renderD128/device→../../../0000:2b:00.0) and returnsRenderAdapter::Pci("0000:2b:00.0").EGL_EXT_device_drm_render_node), one PCI card is the answer. Two or more giveRenderAdapter::Ambiguous; the function never guesses./Software, names that are notrenderD<n>(also..paths), non-PCI devices (Arm platform GPUs) and a missing sysfs giveRenderAdapter::Unknown.platform::render_adapter()runs it against/on Linux. On Windows and macOS it returnsUnknownuntil their parts of obs-gpu-status: Identify the render adapter's PCI bus ID on every platform #1020 land.probeexample prints the result for a node given as its argument.The frontend does not call it yet. The first consumer, #1021, passes adapter 0's name from
gs_enum_adapters(); no libobs-opengl change is needed for that.RED → GREEN
tests/gpu_status/render_adapter.rs(7 cases) with a stub that returnsUnknown. The fixture builds sysfs as the kernel does:class/drm/<node>links into the PCI device, and the node'sdevicelink points back up. 3 of 7 fail (two identical 10de:2504 cards on0000:2b:00.0and0000:2c:00.0, one card without a node, two cards without a node); the 4Unknowncases pass with the stub.-D warningsclean on macOS, Linux and forx86_64-pc-windows-msvc; rustfmt clean./sys/class/drm/renderD128/device→../../../0000:2b:00.0.probe /dev/dri/renderD128printsPci("0000:2b:00.0");probewithout a node prints the same (one card);probe /SoftwareprintsUnknown../lintpasses on Linux (fmt, clippy-D warnings, dylint,ci/test_*.py).Checklist
master(or the description starts with a Stacked: note)-W..., ratchets): built with scripting ON (a flag change under cmake/ or build-aux/ runs the full builds) and cross-checked with clang and MSVC (not applicable: no flag changes)🤖 Generated with Claude Code