fix(linux): auto-detect GPU with connected display for VAAPI and Vulkan#4961
Conversation
a0b3617 to
1e54ff0
Compare
Bundle ReportBundle size has no change ✅ |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4961 +/- ##
=========================================
Coverage ? 18.03%
=========================================
Files ? 108
Lines ? 23464
Branches ? 10363
=========================================
Hits ? 4232
Misses ? 15095
Partials ? 4137
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
1e54ff0 to
17e6e0a
Compare
17e6e0a to
34591e7
Compare
34591e7 to
abc2166
Compare
|
instead of using |
Good point! Done — added platf::resolve_render_device() that resolves it once (user config -> auto-detect -> /dev/dri/renderD128 fallback). All call sites now use it. Went with render_device as the common concept since that's what both VAAPI and the config (adapter_name on Linux is a render device path) naturally work with. Vulkan just has an extra step to map it to a device index. I also changed the description by adding support for VAAPI too. |
|
False sonarqubecloud notification. There isn't sopen for linux |
…renderD128 On multi-GPU systems the Vulkan encoder defaulted to /dev/dri/renderD128 which may not be the GPU driving the display. This caused encode failures or unnecessary cross-GPU copies. Add platf::find_render_node_with_display() which scans DRM connectors to find the GPU with a connected monitor and returns its render node path. Use this as the default when adapter_name is not configured. Fallback chain: user config > auto-detected GPU > renderD128 > FFmpeg default.
…nder_device() Replace duplicated adapter_name → render_device resolution logic across video.cpp, vaapi.cpp, and vulkan_encode.cpp with a single platf::resolve_render_device() function. The resolution order is: 1. config::video.adapter_name if set by user 2. Auto-detected GPU with connected display (find_render_node_with_display) 3. /dev/dri/renderD128 fallback find_render_node_with_display() is now internal to linux/misc.cpp, removed from the public platf:: API and platform stubs.
768975f to
d56679d
Compare
|
…an (LizardByte#4961) fix wrong render_node selection in linux



Description
On multi-GPU Linux systems, both VAAPI and Vulkan encoders hardcoded
/dev/dri/renderD128(or passednullptrfor FFmpeg auto-detect) as the default render device whenadapter_namewas not configured. This caused the encoder to use the wrong GPU (e.g. Intel iGPU instead of the Nvidia dGPU driving the display), leading to encode failures or unnecessary cross-GPU copies.This PR introduces
platf::resolve_render_device()which centralizes render device resolution:adapter_nameconfig → used as-is/dev/dri/renderD128if detection failsThe DRM detection logic (
find_render_node_with_display()) scans card devices for a connector inDRM_MODE_CONNECTEDstate and returns the corresponding render node viadrmGetRenderDeviceNameFromFd(). This is kept internal tolinux/misc.cpp.All Linux encoder paths now use
platf::resolve_render_device()consistently:video.cpp— VAAPI and Vulkan hardware input buffer initvaapi.cpp— encode device creation and error reportingvulkan_encode.cpp— Vulkan hardware device creationPreviously the
adapter_name → render_deviceresolution logic was duplicated across these files. Now it lives in one place, avoiding potential mismatches.Screenshot
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage