-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(linux): Add Vulkan video encoder for Linux #4603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Add FFmpeg Vulkan encoder with zero-copy DMA-BUF/EGL interop - Add kms_vblank option for vblank-synchronized capture - Fix KMS framebuffer scaling for HiDPI displays - Add Vulkan encoder settings to web UI - Add documentation for vulkan encoder and kms_vblank options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a preliminary review. On top of the comments below, I think these files will probably need updates.
update dependencies:
- https://github.com/LizardByte/Sunshine/blob/master/scripts/linux_build.sh
- https://github.com/LizardByte/Sunshine/blob/master/packaging/sunshine.rb
- https://github.com/LizardByte/Sunshine/blob/master/packaging/linux/Arch/PKGBUILD
- https://github.com/LizardByte/Sunshine/blob/master/packaging/linux/copr/Sunshine.spec
- https://github.com/LizardByte/Sunshine/blob/master/.github/workflows/ci-freebsd.yml
- and maybe the flatpak
|
I will convert this to draft for now, please change it back when you're ready for a full review. Thanks! |
|
Its ready |
|
I know this PR is about encoding, but I saw changes to capture as well. Do you know if this could support variable framerate capture, similar to how capture works on Windows? In my limited experience Linux always captures at the stream framerate. The ideal capture process would be capturing only when the image has changed (with duplicated frames subject to minimum_fps_target), as well as capturing using a frame interval timer requested by the client or based on the framerate. For example, an Xbox client works best if frames are captured on a timer with an interval of 59.94fps (60000/1001), a desktop client could just use a 60fps interval. One thing you do not want to do is base anything on the host's vsync interval. |
I left a bunch of review comments. |
- Add Vulkan headers and loader dependencies to all packaging files - Fix cmake to use SUNSHINE_ENABLE_VULKAN option (ON by default) - Use SUNSHINE_DEFINITIONS list for compile definition - Remove unnecessary ifdef around vulkan_encode.h include - Simplify vulkan encoder docs description - Remove vulkan/kms translations from non-English locales (CrowdIn handles these)
Yes, the kms_vblank option already behaves this way with variable frame rate similarly to Windows. It encodes that many frames that are generated by a game. It also respects fps frame rate which are set by a client (if the clients sets 60, it won't generate more than 60 fps with some minimal margin) |
|
@ReenigneArcher I made proposed changes. I also added a tiling fix for RNDA 4 when Gnome DE is used. Would be helpful if somebody with Nvidia and Intel GPUs could test the new encoder |
|




Description
This PR adds Vulkan video encoding support for Linux KMS capture, providing an alternative to VAAPI encoding. AI agent was used heavily for code generation, following the existing VAAPI encoder implementation as the reference pattern.
Changes:
h264_vulkan,hevc_vulkan,av1_vulkan) with zero-copy DMA-BUF import via EGL interop - no GPU-to-CPU copies in the capture-encode pipelinefb->width/fb->height) instead of logical viewport dimensions, fixing capture on HiDPI displaysvulkanencoder andkms_vblankoptions indocs/configuration.mdDependencies:
Requires corresponding PR in LizardByte/build-deps (
ffmpeg-vulkanbranch) to enableBUILD_FFMPEG_VULKANoption, which adds--enable-vulkanand Vulkan encoder support to FFmpeg builds.Testing:
vulkan-headersandvulkan-icd-loaderpackages to be installed (or similar on another distros).Screenshot
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage