backend/kms: fix primary GPU selection on hybrid laptops where the dGPU enumerates first - #2621
backend/kms: fix primary GPU selection on hybrid laptops where the dGPU enumerates first#2621petegee wants to merge 1 commit into
Conversation
|
Yeah this isn't right. On hybrid systems with mux switches we absolutely can have multiple gpus with internal connectors and we want the one, that is actually connected. Try this please: #2624 Also please provide the output of |
|
my drm_info - hope this helps?: pete@pop-os:~$ cat drm.info |
This output just contains a single gpu (your integrated AMD one). Can you also list the output of |
|
Tue Jul 28 09:05:14 2026 +-----------------------------------------------------------------------------------------+ |
|
00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 1507 |
|
Why are you running gnome-shell on Xorg. Are you sure you even have the nvidia-drm driver with |
|
Ah, yes, i do apologise. Im running my POP 24 off a Nvme enclosure/SSD, while my main OS on the laptop is 22. I grabbed the info for you from my 22 OS - rookie mistake... Here are the correct info from pop 24 00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 1507 Wed Jul 29 10:59:41 2026 +-----------------------------------------------------------------------------------------+ |
NOTE THIS IS GENERATED BY FABLE/AI
Im raising this as a draft only to hopefully help shed some light on the issue that is plaguing me on my ProArt P16 POP24 - I Understand the AI stance, and im not a rust dev, nor know much about compositors. However, im hoping that this may help someone?
See:
#2149
Problem
On hybrid laptops where the discrete GPU sits at a lower PCI address than the
integrated GPU and/or is flagged as
boot_vga(e.g. ASUS GA605W / ProArt P16:NVIDIA RTX 4070 Max-Q at
65:00.0, AMD Radeon 880M/890M behind it — see #913and https://gitlab.freedesktop.org/drm/amd/-/issues/3673), cosmic-comp can
select the NVIDIA dGPU as the primary render device. This prevents the dGPU
from ever entering runtime suspend (pop-os/cosmic-epoch#2994) and forces the
multi-GPU copy path for the whole session.
determine_primary_gpu()already prefers a device with a builtin display, butthe check iterates
dev.inner.surfaces— only connectors that already have anactive CRTC/surface. If the internal panel has no surface at selection time
(lid closed at boot, internal output disabled in config, no free CRTC, or
surface init failure), the rule silently misses and selection falls through to
the boot GPU — the dGPU on this hardware. Mutter and KWin both solved this
class of bug by keying off the internal panel connector rather than
boot_vga/PCI order; this PR closes the remaining gap to that behaviour.
Separately,
COSMIC_RENDER_DEVICE=/dev/dri/renderD128— the most naturalvalue to try, and the form circulating in #913 as the recommended workaround —
silently fails because
dev_varresolves bare names relative to/dev/dri/(#2232), with no visible warning.
Changes
Commit 1 — detect builtin displays via connectors, not active surfaces
has_builtin_display()scans all connectors reported by the DRM device(
resource_handles()) forEmbeddedDisplayPort | LVDS | DSI, skippingsoftware devices.
disconnected on some firmware, while desktop GPUs essentially never expose
these interfaces — presence alone is the robust signal (and matches the
intent of the existing code, which also didn't check state).
debug!logging of which rule selected the primary GPU(
COSMIC_RENDER_DEVICE/ builtin display / boot gpu), so wrong selectionsare diagnosable from
journalctl _COMM=cosmic-comp.Commit 2 — accept absolute paths in
COSMIC_RENDER_DEVICE, warn on no matchDrmNode::from_pathand normalized to therender node before matching; bare-name handling via
dev_varis unchanged.warn!fires whenever the variable is set but doesn't resolve to a usabledevice, instead of silently falling back.
Testing
Hardware: ASUS ProArt P16 (Ryzen AI 9 HX 370 / Radeon 890M iGPU + RTX 4070
dGPU, no MUX; NVIDIA is
boot_vga=1on kernels without the vgaarb fix),Pop!_OS 24.04, COSMIC session.
"device has builtin display";
fuser -v /dev/dri/render*shows cosmic-compon the AMD node; NVIDIA
power/runtime_statusreachessuspendedat idle.selected (previously fell through to boot GPU).
COSMIC_RENDER_DEVICE=/dev/dri/renderD128: honored.COSMIC_RENDER_DEVICE=renderD128: still honored (unchanged).COSMIC_RENDER_DEVICE=/dev/dri/renderD999: prominent warning, automaticselection proceeds.
Out of scope
(
init_udevonly re-selects whenprimary_nodeisNone) — changing thatinvalidates live renderers and deserves its own discussion.
bug on gfx115x and isn't fixed by compositor changes — but selecting the
correct single GPU avoids the multi-GPU import path that currently
exercises it, which is why
COSMIC_RENDER_DEVICE=renderD128has beenreported as stabilizing these systems in Incorrect GPU selection for session #913.
Closes #913
Closes #2232