Repository navigation
Conversation
0262c5d to
2bcea4f
Compare
|
I also have a follow-up fix that makes GBM allocation work on headless NVIDIA by trying relaxed usage flags (removing The change is small (two files):
Tested on RTX 4060 Ti headless (TrueNAS, no monitor) — GBM succeeds with Should I add this to this PR or open a separate one? |
I think it can be included here if we make the PR title more generic. |
|
Added the GBM resilience fix in e54a35d. Updated the PR title and description to cover both changes. |
e54a35d to
641ee40
Compare
|
What if the user gives a different adapter name in the config, there will be a mismatch, and this will fail |
|
@Clutchnp could you clarify? The code path changed here (cuda.cpp) finds the DRM node by pci bus ID from the CUDA device - it doesn't read config.adapter_name (that's used by VAAPI/Vulkan encoders in vaapi.cpp / vulkan_encode.cpp, which are unchanged). So there shouldn't be a mismatch with any config value. |
|
Suppose you have 2 gpus in the system one being AMD and other being NVIDIA, the display is running on AMD , here while you have selected one, in wayland.cpp, selection maybe sth else entirely. This would as far as I understand result in a conflict Sunshine/src/platform/linux/wayland.cpp Lines 224 to 261 in 3527320 |
|
Thanks for pushing back on this - it made me re-audit the change and I found a real (separate) bug in my own patch that I just fixed: the renderD* loop was returning open()'s result directly, so if open() failed (e.g. EACCES, device busy) the function returned -1 without trying the card* fallback. The fix logs a warning and continues to the next node. |
|
|
Maybe due to lack of my understanding, can the drm device that is opened in cuda.cpp be different from the one that is opened in wayland.cpp? |
|
Can you fix the conflicts? |
|
Hi — heads-up from related work: I'm authoring #5873 (wlgrab RAM bridge + LINEAR path for cross-GPU capture, currently in review), which touches the same regions ( I read the two designs as complementary rungs of one ladder rather than competing approaches: gated selection first, your SHM fallback as the last resort after allocation failures. Flagging it here mainly to coordinate ordering and avoid clobbering each other's fallback logic — #5873 is further along in review, so one natural path is landing it first and rebasing the SHM rung on top, but I'm open to thoughts. (Also noting both PRs show the same |
|
Hi there |
|
Hello again |
f5aecba to
96aea0f
Compare
|
Rebased onto current master and resolved the conflicts. I have found some issues during hardware testing. I also caught and fixed a fallback regression in 96aea0f: DMA-BUF creation could succeed but the subsequent screencopy fail, leaving the stream black in a reinitialization loop. |
buffer_done() logged "SHM capture not implemented" and gave up whenever DMA-BUF was unavailable. Bind wl_shm, copy frames through a memfd-backed pool, and drop the VRAM path to RAM capture once DMA-BUF is known to fail.
GBM only needs rendering, and headless containers are frequently given renderD* without a matching card*. Fall back to the primary node when no render node opens.
2c57853 to
a8fd6ba
Compare
|







Description
Two improvements for Wayland capture on headless NVIDIA setups (no physical display connected):
1. SHM capture fallback
On headless NVIDIA, GBM buffer allocation can fail because the driver cannot create GBM buffers without an active DRM output. The existing code logged
"SHM capture not implemented"and gave up.This PR implements the SHM fallback:
wl_shminterface from the Wayland registrymemfd-backedwl_shm_pooland copies frames via SHMgbm_failedflag to avoid retrying every framewlr_ram_tcan operate in SHM-only mode2. Resilient GBM allocation for headless NVIDIA
Even on headless NVIDIA, GBM can work if we relax the usage flags. This change:
RENDERING|LINEAR→RENDERING→LINEAR→ nonerenderD*) over primary nodes (card*) — primary nodes require DRM master which is unavailable headlessWith both changes, the capture priority is:
The DMA-BUF path is completely unchanged when GBM succeeds with default flags.
Tested on
WLR_BACKENDS=headlessRENDERINGflag, VRAM capture path works end-to-endScreenshot
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage