Skip to content

Backends/DRM: add --prefer-drm (independent scanout device) for hybrid/eGPU#11

Open
relil wants to merge 1 commit into
bazzite-org:gamescope-bafrom
relil:prefer-drm
Open

Backends/DRM: add --prefer-drm (independent scanout device) for hybrid/eGPU#11
relil wants to merge 1 commit into
bazzite-org:gamescope-bafrom
relil:prefer-drm

Conversation

@relil

@relil relil commented Jun 16, 2026

Copy link
Copy Markdown

Carries the --prefer-drm option in the Bazzite gamescope fork so hybrid / eGPU / headless-render setups work in Game Mode.

Problem: init_drm() derives the KMS/scanout device from the selected Vulkan device (vulkan_primary_dev_id()DRM_NODE_PRIMARY). So --prefer-vk-device (e.g. a headless render GPU) also forces scanout onto that GPU → '/dev/dri/cardX' is not a KMS device → black screen, with no way to render on GPU A and scan out on display GPU B.

Change: adds --prefer-drm <device> to choose the DRM/KMS scanout device independently of --prefer-vk-device, plus a GAMESCOPE_PREFER_DRM env fallback so the session can set it without per-game launch options. Accepts /dev/dri/cardX, cardX, and /dev/dri/by-path/…-card. Validated by device number up-front in main() (not open(), which the compositor can't do for a primary node under seatd/logind); drmIsKMS() still runs. No behaviour change without the flag/env.

This pairs with Bazzite's export-gpu (VULKAN_ADAPTER = render GPU): set GAMESCOPE_PREFER_DRM to the display GPU's by-path and the UI/games render on the fast GPU while output goes through the iGPU.

Tested on Bazzite + CachyOS Game Mode (Intel iGPU + AMD BC-160): compositor on BC-160, scanout via Intel HDMI; Steam Big Picture and Cyberpunk 2077 work, no atomic/dmabuf errors.

Also submitted upstream: ValveSoftware#2220 (this carries it for Bazzite until it lands upstream). Upstream request: ValveSoftware#1004.

Decouple the DRM/KMS scanout device from the Vulkan render device. init_drm()
derives the KMS node from the chosen Vulkan physical device
(vulkan_primary_dev_id -> DRM_NODE_PRIMARY), so on hybrid/eGPU/muxless setups
selecting a headless render GPU via --prefer-vk-device also forces scanout onto
that GPU, which has no connectors -> black screen.

--prefer-drm picks the KMS device explicitly while --prefer-vk-device keeps
choosing the render GPU and -O selects the connector within it. Accepts
/dev/dri/cardX, the short cardX form, and /dev/dri/by-path/...-card symlinks.
Also read from $GAMESCOPE_PREFER_DRM when the flag is absent, so a session can
configure a split setup without per-game options. The node is validated by
device number (primary minors 0-63) up-front in main(), not by open() (which the
compositor cannot do for a primary node under seatd/logind); drmIsKMS() still
runs later. Default behavior is unchanged when neither is set.

Also submitted upstream: ValveSoftware#2220.
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