Skip to content

fix(wgc): report adapter LUIDs, because the descriptions can be identical - #342

Merged
EtienneLescot merged 2 commits into
mainfrom
fix/adapter-luid
Aug 11, 2026
Merged

fix(wgc): report adapter LUIDs, because the descriptions can be identical#342
EtienneLescot merged 2 commits into
mainfrom
fix/adapter-luid

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

The capture-adapter diagnostic from #332 compared adapters by LUID and printed only their descriptions. On the exact configuration it exists to catch, those two descriptions are the same string.

Measured on a rented multi-adapter VM:

adapter[0]  NVIDIA Quadro RTX 4000   LUID 0:24084      -> \.\DISPLAY1
adapter[1]  NVIDIA Quadro RTX 4000   LUID 0:12889146   -> the Parsec IDD

An IddCx virtual display driver renders through the physical GPU and inherits its description string, while being a separate DXGI adapter with its own LUID. QueryDisplayConfig confirmed the virtual monitor sits under 0:12889146.

So a machine that actually has the divergence would have printed:

{"deviceAdapter":"NVIDIA Quadro RTX 4000","monitorAdapter":"NVIDIA Quadro RTX 4000","sameAdapter":false}

Two identical names next to sameAdapter:false — which reads as a bug in the reporting rather than as the finding it is, and would most likely have been dismissed as one. The comparison was never wrong. The output was unreadable at the only moment it matters, and we were days away from asking four reporters to run it.

What changed

  • deviceLuid and monitorLuid on the event, formatted HighPart:LowPart to match QueryDisplayConfig traces so a LUID from a bug report greps straight against one
  • one [adapters] line per enumerated adapter on stderr, with its LUID and its outputs, marking the captured one

The stderr dump matters for the negative case too: an adapter with no output is how an inactive virtual display presents, and that is exactly why the rented box reported sameAdapter:true despite having a virtual display driver installed. Having one is not enough — it has to be driving the captured display.

Not in scope

Making createD3DDevice select the adapter that owns the captured HMONITOR instead of taking the default. That is a real correctness gap — nothing in DXGI promises adapter 0 drives the display, and nothing in the code checks — but it is a behaviour change and belongs in its own PR. This one only makes the existing diagnostic legible.

Refs #252, #292, #327.

Summary by CodeRabbit

  • New Features

    • Added enhanced Windows capture diagnostics, including capture and display GPU identifiers.
    • Startup logs now list all detected graphics adapters and their connected displays.
    • Added indicators for the captured monitor and adapters without outputs.
    • Added cross-adapter detection when graphics adapters have identical descriptions.
    • Updated diagnostic event data to version 2 and preserved empty monitor values when no match is found.
  • Documentation

    • Updated Windows helper documentation to explain the new adapter diagnostics and cross-adapter detection.

…ical

The `capture-adapter` diagnostic compared adapters by LUID and printed only
their descriptions. On the exact configuration it exists to catch, those two
descriptions are the same string.

An IddCx virtual display driver renders through the physical GPU and inherits
its description while being a separate DXGI adapter with its own LUID. Measured
on a rented multi-adapter box:

    adapter[0]  NVIDIA Quadro RTX 4000   LUID 0:24084      -> \.\DISPLAY1
    adapter[1]  NVIDIA Quadro RTX 4000   LUID 0:12889146   -> the Parsec IDD

So a machine with the divergence would have reported two identical names beside
`sameAdapter:false` — which reads as a bug in the reporting rather than as the
finding it is, and would most likely have been dismissed as one. The comparison
was never wrong; the output was unreadable at the only moment it matters.

Adds `deviceLuid` and `monitorLuid` to the event, and one `[adapters]` line per
enumerated adapter on stderr with its LUID and its outputs, marking the captured
one. Two adapters sharing a description is something a reader has to see before
they will believe `sameAdapter` over the names, and an adapter with no output at
all is how an inactive virtual display presents -- which is why the rented box
reported `sameAdapter:true` despite having a virtual display driver installed.

Formatted HighPart:LowPart to match QueryDisplayConfig traces, so a LUID from a
bug report can be grepped straight against one.
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8a23448c-4f07-4b63-ad63-745612d6c929

📥 Commits

Reviewing files that changed from the base of the PR and between ab650e1 and da85749.

📒 Files selected for processing (2)
  • electron/native/README.md
  • electron/native/wgc-capture/src/main.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • electron/native/README.md

📝 Walkthrough

Walkthrough

The Windows capture helper now reports capture and monitor adapter LUIDs, distinguishes monitor lookup states, enumerates DXGI adapters and outputs at startup, and documents cross-adapter diagnostics.

Changes

GPU adapter diagnostics

Layer / File(s) Summary
Adapter identity reporting
electron/native/wgc-capture/src/main.cpp, electron/native/README.md
The helper formats adapter LUIDs, adds device and monitor LUIDs to the version 2 capture-adapter output, distinguishes monitor lookup states, enumerates adapters and outputs on stderr, and documents the diagnostics.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: my-denia

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description clearly explains the change and scope, but it omits the required template sections and explicit type, release impact, platform, and testing details. Add the template headings and complete the Type of change, Release impact, Desktop impact, and Testing sections; record the related issues using the specified format.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: reporting adapter LUIDs because adapter descriptions can match.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/adapter-luid

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@electron/native/wgc-capture/src/main.cpp`:
- Around line 307-311: Update the DXGI monitor/output enumeration loops in main
so they stop only when the enumeration call returns DXGI_ERROR_NOT_FOUND; treat
DXGI_ERROR_NOT_CURRENTLY_AVAILABLE as an indeterminate enumeration failure and
report that distinct status instead of emitting monitorLuid:null or
outputs=none. Preserve the existing no-output handling for genuinely completed
enumeration, and run the WGC smoke test on a real Windows system.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 472a463e-0f04-4098-8c6a-86f2b70a5cc8

📥 Commits

Reviewing files that changed from the base of the PR and between a6795d2 and ab650e1.

📒 Files selected for processing (2)
  • electron/native/README.md
  • electron/native/wgc-capture/src/main.cpp

Comment thread electron/native/wgc-capture/src/main.cpp Outdated
DXGI_ERROR_NOT_CURRENTLY_AVAILABLE is not the end of an enumeration. It is what
EnumOutputs answers a process in session 0, and it means the outputs were never
inspected rather than that the adapter has none. Both were being folded into the
same FAILED() test, so a machine we could not look at reported exactly what a
machine with an active virtual display reports: monitorAdapter null.

That value is one this diagnostic tells its readers to act on -- the briefing
sent to an operator said null meant a purely virtual display. It would have sent
them down the wrong path, and it is the same class of defect this PR was opened
to fix for the descriptions: an ambiguity that reads as a finding.

The event now carries monitorLookup: ok, no-output-claims-it, or unavailable, so
the absence of a monitor adapter is never reported without saying whether anyone
actually looked. The stderr dump says outputs=unavailable rather than
outputs=none for the same reason.

Unreachable from the app, which spawns the helper from the user's session -- but
the helper is run standalone by hand during exactly this investigation, and that
is where session 0 gets reached.
@EtienneLescot
EtienneLescot merged commit 7d9e5d5 into main Aug 11, 2026
16 checks passed
@EtienneLescot
EtienneLescot deleted the fix/adapter-luid branch August 11, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant