Repository navigation
fix(linux): allow NvFBC direct capture to attach after startup - #6199
Open
medialaxis wants to merge 1 commit into
Open
medialaxis wants to merge 1 commit into
medialaxis wants to merge 1 commit into
Conversation
Remove the startup probe in cuda::nvfbc::display_t::reinit() that ran three immediate NOWAIT grabs and disabled bAllowDirectCapture and bPushModel whenever bDirectCapture was false. That probe failed both when no fullscreen application was active at session startup and when consecutive NOWAIT grabs completed before a new frame arrived, permanently preventing direct capture for the rest of the session. Per NvFBC.h, NvFBC automatically attaches and detaches from suitable fullscreen applications while direct capture remains enabled and falls back to X driver desktop frames in between.
Author
|
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Remove the 3-frame
NVFBC_TOCUDA_GRAB_FLAGS_NOWAITstartup probe incuda::nvfbc::display_t::reinit()that disabledbAllowDirectCaptureandbPushModel(and recreated the capture session) whenevergrab_info.bDirectCapturewas not immediately true.That probe prevented NvFBC direct capture in two common cases when cursor capture is disabled:
NOWAITgrabs can execute within the same millisecond—returning one initial non-direct frame followed by twoNo new frameresults before the application presents—triggering an immediate fallback to non-direct desktop capture.bAllowDirectCapturefor the rest of the session and NvFBC can never attach once a fullscreen application starts.Per
third-party/nvfbc/NvFBC.h, whenbAllowDirectCaptureandbPushModelremain enabled (withbWithCursor = NVFBC_FALSE), the NVIDIA X driver automatically attaches to a qualifying fullscreen unoccluded application and transparently resumes X-driver desktop frame generation when it detaches.Trade-off: when cursor capture is disabled and direct capture is not attached,
bPushModelstaysNVFBC_TRUE(a prerequisite forbAllowDirectCapture), so the NVIDIA X driver generates desktop frames on X damage events rather than atdwSamplingRateMs. Sunshine's capture/encode loop remains paced at the configured stream framerate, and the default path (cursor == true) is unchanged.Screenshot
Issues Fixed or Closed
Roadmap Issues
Testing
cuda::nvfbc::display_t::reinit()is thin NvFBC driver glue and the change only deletes the startup probe; verifying automaticbDirectCaptureattach/detach transitions requires a real NVIDIA X11 driver and fullscreen application. Happy to extract a testable ops seam forreinit()if preferred.grab_info.bDirectCapture(removed from this PR), confirmed automatic transitionsNo(desktop) →Yes(fullscreenframe_lab) →No(windowed) repeating across multiple fullscreen toggles without reconnecting or toggling cursor capture (__GL_SHOW_GRAPHICS_OSD=1also switchedBLIT↔FLIP).uv run --locked --no-sync lb-update-clang-format— no changes.clang-format --dry-run --Werror src/platform/linux/cuda.cpp— passed.master;test_sunshinewas not re-run locally after the rebase.Type of Change
Checklist
AI Usage
See our AI usage policy.