Commit Graph

862 Commits

Author SHA1 Message Date
Cameron Gutman a20d429bc1 Remove usage of deprecated Metal API 2025-10-11 11:41:28 -05:00
armin-25689 1fd545ae1f build: fix no <linux/dma-buf.h> for BSDs 2025-08-31 15:05:03 -05:00
Cameron Gutman bf51577787 Fix macOS build 2025-02-18 19:52:33 -06:00
Cameron Gutman 4c5bcee8dc Give up immediately if the backend fails to initialize 2025-02-18 19:46:29 -06:00
Cameron Gutman fd70865026 Avoid retrying renderer init if we know the error was not transient 2025-02-18 19:02:12 -06:00
Cameron Gutman 351aaa6759 Add an enum type for each renderer 2025-02-18 18:58:04 -06:00
Cameron Gutman dd2a99a96b Prepare for SDL3 support 2025-01-25 16:20:20 -06:00
Cameron Gutman 4af9623727 Replace C++ VLAs with std::vector 2024-10-15 22:41:21 -05:00
Cameron Gutman 9936085aee Fix incorrect selection if pix_fmt is overridden before ffGetFormat()
The DRM renderer does this for the out-of-tree v4l2m2m patches to ensure
we get NV12 buffers, but it ends up clobbering our own preference for
DRM_PRIME frames in the process.
2024-10-03 20:28:51 -05:00
Cameron Gutman 3531fe0a4f Fix typo in version check for new Vulkan queue API 2024-10-02 00:37:22 -05:00
Cameron Gutman 6ce02616f0 Use new Vulkan queue API in FFmpeg 7.1 2024-09-29 23:04:23 -05:00
Cameron Gutman 13880353d8 Use new avcodec_get_supported_config() API in FFmpeg 7.1 2024-09-29 22:23:37 -05:00
Cameron Gutman 901cbd255c Disable Vulkan debug layers by default
The vast majority of Vulkan code running in Moonlight
is part of FFmpeg or libplacebo, so the debug layers
really just slow things down without finding any bugs
in our code.

Additionally, there are some overzealous checks firing
constantly on libplacebo and FFmpeg with certain Vulkan
drivers that we can't do anything about.
2024-09-28 00:05:17 -05:00
Cameron Gutman 023b6b2772 Fix DRM FD leak with Vulkan windows 2024-09-21 21:41:43 -05:00
Cameron Gutman 6f39d120cb Unify handling of DRM devices between DRM and VAAPI
SDL may not be able to give us a DRM FD for Vulkan windows.
2024-09-21 20:46:11 -05:00
Cameron Gutman 6b11f43302 Don't set the output rect until after modesetting
It's possible that modesetting will also change the resolution
not just the refresh rate. This can happen in cases where the
CRTC is currently set to 4K 30 Hz and we choose 1080p 60 Hz as
a better mode match for displaying a 1080p 60 FPS stream.
2024-09-19 22:43:34 -05:00
Matt Tannahill 76deafbd7b Fix build for Xcode < 14 2024-09-18 22:12:04 -05:00
Cameron Gutman f786e94c7b Fix excessive latency with Vulkan video decoding on Nvidia
For yet unknown reasons, high frame queue delay leads to massive decode latency.
2024-09-16 21:59:17 -05:00
Cameron Gutman 4838a75c58 Suppress spammy libplacebo messages
Streaming 10-bit content on Nvidia GPUs spams the log with the following for every rendered frame:
Masking `blit_src` from wrapped texture because the corresponding format 'rx10' does not support PL_FMT_CAP_BLITTABLE
Masking `blit_src` from wrapped texture because the corresponding format 'rxgx10' does not support PL_FMT_CAP_BLITTABLE
2024-09-15 22:01:39 -05:00
Cameron Gutman c5ec8c0fdb Add libplacebo prefix to log messages 2024-09-15 21:58:19 -05:00
Cameron Gutman b266f61ba6 Disable direct rendering of YUV444 using vaPutSurface()
It doesn't work as of libva 2.21 + iHD 24.2.5 despite the fact that
the VAEntrypointVideoProc advertises VA_RT_FORMAT_YUV444.
2024-09-15 21:03:00 -05:00
Cameron Gutman 96fb6ee5e9 Share SDL's EGL display with EGLRenderer
Fixes #1396
2024-09-12 22:37:25 -05:00
Cameron Gutman 92ee4a3046 Don't use the bind path for UMA GPUs
It turns out to be very marginally slower on RDNA2 iGPUs.
2024-09-12 21:32:36 -05:00
Cameron Gutman 6ec0c79899 Revert "Remove FL 11.0 restriction for D3D11VA"
Even with a fix for the Intel IVB rendering issue, there are still problems on
other older cards that make it not really worth it to enable D3D11VA.

The big benefit of D3D11VA is independent flip in windowed mode using
overlays and that isn't supported on those old cards anyway.

This reverts commit 7074463d0f.
2024-09-12 21:29:40 -05:00
Cameron Gutman 67e89d9e16 Add workaround for incorrect color range in AMF AV1 encoding output 2024-09-04 23:13:48 -05:00
Cameron Gutman 25132a1f7b Enable decoder texture binding for all FL11.1 iGPUs
Since those GPUs don't benefit from the fence hack, restrict that to Intel only.
2024-08-31 00:36:25 -05:00
Cameron Gutman 7074463d0f Remove FL 11.0 restriction for D3D11VA 2024-08-30 23:03:36 -05:00
Cameron Gutman 99311403fa Move dummy fence into renderVideo()
The workaround only seems to work with a new fence each time.
2024-08-30 22:42:53 -05:00
Cameron Gutman 8b50eea485 Wait on a dummy fence before using textures shared with the decoder 2024-08-30 22:22:30 -05:00
Cameron Gutman f756be87ff Fix YUV444 hardware decoding on Windows systems without an Intel GPU present 2024-08-30 16:31:58 -05:00
Cameron Gutman 4290a54ffa Log the chosen Metal device 2024-08-29 23:20:52 -05:00
Cameron Gutman caf322d934 Provide valid default preferred formats for YUV444 2024-08-29 01:03:39 -05:00
Cameron Gutman 76fd502262 Reintroduce support for FFmpeg 4
Some SBCs still depend on patched FFmpeg 4.x builds for hardware acceleration.
2024-08-24 16:50:27 -05:00
Cameron Gutman df814fef4a Implement support for HDR with software decoding on macOS 2024-08-22 00:05:26 -05:00
Cameron Gutman bed3a6ecd8 Print the friendly name of the unsupported AVPixelFormat in SDLRenderer 2024-08-19 20:58:45 -05:00
Cameron Gutman 5765c254cd Add software fallback for YUV444 using libswscale 2024-08-19 19:20:17 -05:00
Cameron Gutman ea724a05a6 Fix compilation with older FFmpeg versions 2024-08-19 01:03:03 -05:00
Cameron Gutman 369f614b59 Rewrite format handling in DRM renderer 2024-08-19 00:57:07 -05:00
Cameron Gutman 8606b2c95e Add support for VUYX and XV30LE for YUV 4:4:4 2024-08-18 23:45:26 -05:00
Cameron Gutman fafddddfe0 Fix size and pitch calculation for dumb buffer uploads 2024-08-18 23:08:20 -05:00
Cameron Gutman 1bb16be183 Allow DrmRenderer to act as a non-DRM hwaccel backend
This case basically works like a degenerate case of a DRM hwaccel
without DRM master where we just provide EGL export functionality
except that we don't even need a DRM FD in this case.

There are patches floating around the FFmpeg list for this:
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=12604
2024-08-17 17:04:30 -05:00
Cameron Gutman 8e2aa87c4f Avoid using D3D11VA on very old Intel GPUs
Fixes #1348
Fixes #1381
2024-08-16 00:32:46 -05:00
Cameron Gutman 665352ec95 Remove support for Intel's vendor-specific HEVC RExt profiles
These aren't supported upstream (and probably never will be) and recent
Intel drivers for Tiger Lake and later support the Microsoft standard
HEVC RExt profiles now.
2024-08-13 00:50:32 -05:00
Cameron Gutman ab791cf4c8 Add support for the official DXVA HEVC Rext GUIDs defined in the Win11 24H2 SDK 2024-08-02 21:22:43 -05:00
Cameron Gutman ef7dff32aa Don't use Vulkan Video on Intel GPUs on Windows
Intel's Windows drivers are either totally broken or just don't play nicely with FFmpeg currently.
2024-08-02 21:16:52 -05:00
Cameron Gutman 9227ebfec9 Fix compiler warnings introduced by ComPtr refactoring 2024-08-02 21:15:18 -05:00
Cameron Gutman f138827cdf Add handling for AV1 High profile in D3D11VA/DXVA2
This doesn't seem to be supported by FFmpeg or any actual hardware yet
2024-07-30 23:21:49 -05:00
Cameron Gutman e25919e0f9 Use for each loop to destroy objects in arrays
Also fixes incorrect release of m_VideoPixelShaders objects
2024-07-30 22:58:59 -05:00
Cameron Gutman 99749d4730 Use ComPtr for lifetime management in DXVA2 2024-07-30 22:41:29 -05:00
Cameron Gutman 9e811f54f1 Use ComPtr for lifetime management in D3D11VA 2024-07-30 22:29:38 -05:00