Skip to content

fix(kms): consider all connected connectors when picking primary gpu - #2647

Open
techywilbur wants to merge 1 commit into
pop-os:masterfrom
techywilbur:fix/kms-primary-gpu-check-all-connectors-3751
Open

fix(kms): consider all connected connectors when picking primary gpu#2647
techywilbur wants to merge 1 commit into
pop-os:masterfrom
techywilbur:fix/kms-primary-gpu-check-all-connectors-3751

Conversation

@techywilbur

@techywilbur techywilbur commented Jul 27, 2026

Copy link
Copy Markdown

determine_primary_gpu looked for a built-in laptop panel (eDP/LVDS/DSI) by scanning only connectors that already had a Surface (dev.inner.surfaces.values()). At startup a connector may not have been turned into a Surface yet, or its Surface creation may have transiently failed, so the internal panel could be missed and the wrong render GPU selected on a hybrid (e.g. Intel + NVIDIA) laptop when an external display is connected at boot.

Instead, enumerate every connector via resource_handles() and treat a device as holding the built-in panel only when an internal-interface connector reports ConnectorState::Connected. A device that fails to report resource handles is skipped rather than aborting selection for all devices. Preserves the existing COSMIC_RENDER_DEVICE, boot-gpu and first-device fallbacks unchanged.

Adds trace/info logging of which connectors were considered and why a GPU was chosen, plus a unit test for the internal-panel predicate.

This mirrors the approach of the upstream branch
fix-check-all-connectors_noble (9c95ebf, Victoria Brekenfeld); it is a candidate for pop-os/cosmic-comp issue #3751 and does not claim to resolve every report in that issue (a single-GPU report is unlikely to be affected by primary-gpu selection).

  • I have disclosed use of any AI generated code in my commit messages.
    • If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
    • In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.

`determine_primary_gpu` looked for a built-in laptop panel (eDP/LVDS/DSI)
by scanning only connectors that already had a `Surface`
(`dev.inner.surfaces.values()`). At startup a connector may not have been
turned into a `Surface` yet, or its `Surface` creation may have transiently
failed, so the internal panel could be missed and the wrong render GPU
selected on a hybrid (e.g. Intel + NVIDIA) laptop when an external display
is connected at boot.

Instead, enumerate every connector via `resource_handles()` and treat a
device as holding the built-in panel only when an internal-interface
connector reports `ConnectorState::Connected`. A device that fails to
report resource handles is skipped rather than aborting selection for all
devices. Preserves the existing `COSMIC_RENDER_DEVICE`, boot-gpu and
first-device fallbacks unchanged.

Adds trace/info logging of which connectors were considered and why a GPU
was chosen, plus a unit test for the internal-panel predicate.

This mirrors the approach of the upstream branch
`fix-check-all-connectors_noble` (9c95ebf, Victoria Brekenfeld); it is a
candidate for pop-os/cosmic-comp issue #3751 and does not claim to resolve
every report in that issue (a single-GPU report is unlikely to be affected
by primary-gpu selection).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Drakulix

Copy link
Copy Markdown
Member

See

#2621
and #2624

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.

2 participants