Commit graph

613 commits

Author SHA1 Message Date
Cameron Gutman
a2f23b7053 Fix automatic VA DRM driver selection with libva 2.20 2023-10-05 18:12:12 -05:00
Cameron Gutman
5974980aff Use BT.709 in DrmRenderer only on Starfive devices 2023-10-05 18:10:36 -05:00
Cameron Gutman
18130fd8de Use BT.601 for planes that lack COLOR_ENCODING properties 2023-09-29 18:30:39 -05:00
Cameron Gutman
b6d4f97e96 Check that the chosen plane supports the decoded frame pixel format 2023-09-29 17:22:49 -05:00
Cameron Gutman
0dd0112518 Don't export EGLImages for software frames 2023-09-29 17:20:50 -05:00
Cameron Gutman
5711e6064e Allow reuse of an active plane for devices with only one usable plane per CRTC 2023-09-29 17:19:44 -05:00
Cameron Gutman
517b684f85 Handle EGL driver returning no supported formats or modifiers for DMA-BUF import 2023-09-27 01:31:01 -05:00
Cameron Gutman
738813cbac Add fallback definition for EGLuint64KHR 2023-09-26 23:22:25 -05:00
Cameron Gutman
c2778e040a Build fix for old EGL headers 2023-09-26 23:16:22 -05:00
Cameron Gutman
1efdeeb9dc Export composed VA surface layers for EGL import if supported
Importing composed formats is more efficient and performant because it allows
tiled and/or compressed surfaces to be directly sampled by shaders without
requiring a conversion to a linear planar format first.
2023-09-26 22:58:13 -05:00
Cameron Gutman
b01dfea343 Refactor EGLImage creation into a separate shared class 2023-09-26 21:03:19 -05:00
Cameron Gutman
f420dc740a Set EGL_IMAGE_PRESERVED_KHR=EGL_TRUE on our EGLImages
They're mapped read-only and may be saved internally as reference frames,
so they must not be modified by the EGL implementation.
2023-09-26 02:38:46 -05:00
Cameron Gutman
dc556d3c9b Try to fix Windows build 2023-09-23 13:33:21 -04:00
Cameron Gutman
f7bb4611e9 Replace uses of strcpy() and sprintf() 2023-09-23 11:15:21 -04:00
Cameron Gutman
654be492a0 Avoid using LFS64 interfaces with Musl 2023-09-18 20:07:56 -05:00
Cameron Gutman
1df0da4d4a Also use test frame decoding parameters when creating a test renderer 2023-09-14 18:21:53 -05:00
Cameron Gutman
1dd6cdb567 Use the correct width and height of the test frame when performing the test decode
Using the stream resolution instead of the test frame resolution was causing all non-720p streams to fail on the VisionFive 2 board with the wave5 driver.

It also likely fixes a similar interoperability issue with the qcom-venus driver that was reported in #1042
2023-09-14 18:16:45 -05:00
Cameron Gutman
f4b0f4d78f Functionally revert f60e7241
Switching to indirect rendering has a high risk of performance and functionality regressions,
so let's just continue using AVSampleBufferDisplayLayer until we have a Metal renderer
since #973 is fixed.

This isn't an actual revert because we want to still keep the indirect override around.
2023-09-12 18:36:53 -05:00
Cameron Gutman
fd41226cdd Support fully-planar output in DrmRenderer 2023-09-12 18:08:48 -05:00
Cameron Gutman
64789ea8bc Destroy the VTRenderer before leaving fullscreen
Fixes #973
2023-09-11 21:07:54 -05:00
Cameron Gutman
2ac7176787 Fix a bunch of memory leaks in the VTRenderer
It appears the leaked AVSampleBufferDisplayLayer may be causing the hang in #973
2023-09-11 20:49:35 -05:00
Cameron Gutman
c98289a9e7 Use DMA_BUF_IOCTL_SYNC to synchronize swframe copies 2023-09-09 12:19:40 -05:00
Cameron Gutman
3094185cd6 Also skip SDL_RENDERER_PRESENTVSYNC on Wayland 2023-09-09 10:41:33 -05:00
Cameron Gutman
aaff04167b Only skip SDL_RENDERER_PRESENTVSYNC on Windows
macOS can still tear when using the Metal renderer backend.
2023-09-09 08:00:13 -05:00
Cameron Gutman
21bba02e6f Allow render thread usage with Metal 2023-09-09 07:45:42 -05:00
Cameron Gutman
f60e724167 Default to indirect rendering on Apple Silicon
Hopefully the UMA makes the performance impact of reimporting frames negligible
until we can get a proper Metal renderer to replace AVSampleBufferDisplayLayer.
2023-09-09 07:44:11 -05:00
Cameron Gutman
7551e90899 Adjust AV1 surface alignment to match FFmpeg behavior 2023-09-08 23:13:29 -05:00
Cameron Gutman
47d1eff45d Don't rasterize layers in fullscreen
The original artifacting bug didn't manifest in fullscreen anyway.
2023-09-08 19:53:01 -05:00
Cameron Gutman
78ea79b95a Quiet new -Wswitch warnings 2023-09-05 22:51:08 -05:00
Cameron Gutman
acbe503c12 Fix NVIDIA VAAPI X11 deprioritization check to actually check for X11 2023-09-05 20:46:43 -05:00
Cameron Gutman
0261c41574 Revert "Prefer nvidia-vaapi-driver over VDPAU for AV1"
libvdpau 1.5 has supported this for a while and we'll fall
back to VAAPI if VDPAU doesn't work.

This reverts commit 42960b7bf1.
2023-09-05 20:39:28 -05:00
Cameron Gutman
c8182dfab3 Use BT.709 for DrmRenderer 2023-09-05 19:28:22 -05:00
Cameron Gutman
9ed40b5d9f Add chroma siting metadata to EGL exported frames 2023-09-05 18:30:01 -05:00
Cameron Gutman
ebc4c71c72 Fix handling of non-standard hwaccel decoders that also set AV_CODEC_CAP_HARDWARE 2023-09-04 23:40:59 -05:00
Cameron Gutman
626fba4a8f Fix DXVA2 chroma subsampling assuming interlaced content 2023-08-19 18:09:07 -05:00
Cameron Gutman
1a2f1ed620 Enable AV1 RFI on all decoders capable of HEVC RFI 2023-08-13 16:41:48 -05:00
Cameron Gutman
50255dd896 Set Colorspace connector property when streaming HDR 2023-08-09 23:02:43 -05:00
Cameron Gutman
7404e5fce2 Prefer D3D11VA for FSE V-Sync off 2023-08-03 19:41:35 -05:00
Cameron Gutman
dc5414bd0d Force immediate destruction of the D3D11 swapchain
Possible fix for #959
2023-08-03 19:18:07 -05:00
Cameron Gutman
d147d36867 Fix leaking /dev/dri fds on each vaInitialize() failure 2023-08-01 22:53:22 -05:00
Cameron Gutman
7763ec3c5c Fix mapping frames on RPi with 64-bit kernel and 32-bit userland 2023-08-01 22:01:34 -05:00
ns6089
9764174070 Add host processing latency to ffmpeg stats overlay 2023-07-20 22:30:26 -05:00
Cameron Gutman
42960b7bf1 Prefer nvidia-vaapi-driver over VDPAU for AV1 2023-07-16 16:54:13 -05:00
Cameron Gutman
abc391f32a Improve AV1 support 2023-07-16 15:38:58 -05:00
Cameron Gutman
ce60a146dc Move RPi decoder hacks to correct location for new selection logic 2023-07-15 15:22:02 -05:00
Cameron Gutman
cd4a6f3e17 Rewrite FFmpeg decoder selection logic to dynamically discover compatible decoders
This avoids having to maintain a hardcoded list of all known H.264/HEVC/AV1 decoders
and ensures new/unknown decoders will just work automatically (assuming we have
a renderer that can process their output pixel format).
2023-07-15 15:12:58 -05:00
Casey Korver
ea06ec0133 Correct spelling mistakes found with Codespell 2023-07-09 13:21:18 -05:00
Cameron Gutman
9055496a19 Add AV1 test frames 2023-07-05 19:47:45 -05:00
Cameron Gutman
a81c6a1c5e Initial work on AV1 support 2023-07-03 00:45:36 -05:00
Cameron Gutman
68daa90b7e Refactor non-hwaccel decoders to use a single list of known codec names 2023-04-02 17:31:31 -05:00
Cameron Gutman
fb39ad896e Add h264_omx and hevc_omx decoders used by the Vision Five 2 2023-04-02 17:17:25 -05:00
Cameron Gutman
a3d1e9a117 Allow negotation of 36 and 48 bit deep color modes 2023-03-27 01:02:50 -05:00
Cameron Gutman
755c7c9895 Set max BPC property when streaming in 10-bit color modes 2023-03-27 00:44:02 -05:00
Cameron Gutman
f16b5cd337 Expose glslow config option 2023-03-26 20:27:03 -05:00
Cameron Gutman
21cda8141d Always request AV_PIX_FMT_DRM_PRIME to ensure we get it if available 2023-03-26 19:59:12 -05:00
Cameron Gutman
90f26dfa45 Support direct KMSDRM output for platforms with slow GL implementations 2023-03-26 19:46:22 -05:00
Cameron Gutman
ba507d8046 Move hw->sw frame mapping into a separate class 2023-03-26 14:41:02 -05:00
Cameron Gutman
4cd030582d Allow matching primary planes for direct rendering 2023-03-26 13:28:26 -05:00
Cameron Gutman
a0365c8e1c Evaluate D3D9 quirks before calling CreateDeviceEx() 2023-03-17 00:53:47 -05:00
Cameron Gutman
38156c9f7f Default to D3D11VA on multi-GPU systems 2023-03-13 22:56:28 -05:00
Cameron Gutman
5baa8c680a Add upstreamed NV15 format used by Rockchip devices 2023-03-11 11:44:36 -06:00
Cameron Gutman
5de29928cd Plumb HDR metadata for VideoToolbox 2023-02-02 19:16:18 -06:00
Cameron Gutman
b3cfdbb835 Fix DRM renderer build 2023-01-17 21:45:02 -06:00
Cameron Gutman
8a0142bd0f Plumb HDR metadata and horizontal scrolling with Sunshine 2023-01-16 21:51:18 -06:00
Cameron Gutman
68c6d6c932 Attempt to fix build with SDL 2.26 on systems with old GL headers 2022-11-21 20:32:10 -06:00
Cameron Gutman
b9709d0825 Fix build without SDL_VIDEO_DRIVER_WAYLAND 2022-11-14 21:11:26 -06:00
Cameron Gutman
cae666b834 Wake pacing queue waiters when Pacer is being destroyed 2022-11-12 15:55:36 -06:00
Cameron Gutman
5970ca49e9 Don't use swap interval on Wayland 2022-11-12 15:45:54 -06:00
Cameron Gutman
6ae6218043 Refactor Pacer to handle both blocking and non-blocking VsyncSources 2022-11-12 15:08:50 -06:00
Cameron Gutman
8e3e19a7f7 Removed unused NullThreadedVsyncSource 2022-11-12 14:30:38 -06:00
Cameron Gutman
e3d51fd7f7 Implement a Wayland Vsync source using frame callbacks 2022-11-12 13:03:42 -06:00
Cameron Gutman
a6fccf93d1 Use a separate texture for rendering to avoid blending in the alignment padding
Fixes #885
2022-10-26 21:48:55 -05:00
Cameron Gutman
30a5f405f5 Enable HEVC RFI for the FFmpeg software decoder 2022-10-25 23:19:19 -05:00
Cameron Gutman
17848c097c Don't switch between GLX and EGL if EGL worked 2022-10-16 22:57:08 -05:00
Cameron Gutman
8465a27a97 Deprioritize VAAPI for Gallium and Nvidia drivers and work around RFI latency bug 2022-10-16 21:51:10 -05:00
Cameron Gutman
7717749b72 Reduce max queued frames to avoid exhausting the decoder buffer pool 2022-10-15 14:34:42 -05:00
Cameron Gutman
9e4337babf Revert "Increase the number of decoder surfaces for DXVA2/D3D11VA"
This reverts commit 02c781b8f4.
2022-10-15 14:32:12 -05:00
Cameron Gutman
a860bd8dd5 Enable HEVC RFI on Tegra 2022-10-14 23:41:09 -05:00
Cameron Gutman
704ce4ff0c Add environment variable for overriding decoder capabilities 2022-10-14 23:39:49 -05:00
Cameron Gutman
125738f13d Cancel overlay update callbacks before destroying VTRenderer 2022-10-14 22:49:33 -05:00
Cameron Gutman
02c781b8f4 Increase the number of decoder surfaces for DXVA2/D3D11VA
We forgot to take into account frames buffered within Moonlight itself
2022-10-14 21:20:35 -05:00
Cameron Gutman
84fc5f3008 Use colorspace helper with VAAPI direct rendering 2022-10-14 19:23:51 -05:00
Cameron Gutman
8a224fbae4 Revert "Fix macOS build"
This reverts commit 0928d1fab2.
2022-10-13 01:19:56 -05:00
Cameron Gutman
e6c4332445 Revert "Use Rec 2020 colorspace for WCG support even if HDR is off on the host"
Rec 2020 conversion causes colors to be blown out in SDR

This reverts commit 472e8ee92e.
2022-10-13 01:19:49 -05:00
Cameron Gutman
0928d1fab2 Fix macOS build 2022-10-13 01:11:04 -05:00
Cameron Gutman
40dd588bef Use 10-bit format mask instead of hardcoding specific formats 2022-10-13 00:17:05 -05:00
Cameron Gutman
472e8ee92e Use Rec 2020 colorspace for WCG support even if HDR is off on the host 2022-10-13 00:14:10 -05:00
Cameron Gutman
c55af7fff3 Add a decoder/renderer callback to specify the desired color range 2022-10-12 23:59:01 -05:00
Cameron Gutman
7a39daf179 Implement Rec 601 Full Range support in SDLRenderer 2022-10-12 23:52:29 -05:00
Cameron Gutman
5501d7bc6b Include opt-out variable in VAAPI avoidance log output 2022-10-05 18:50:53 -05:00
Cameron Gutman
413ef42a34 Enable HEVC RFI for CUDA, VAAPI, and VDPAU decoders 2022-10-05 18:47:43 -05:00
Cameron Gutman
a1694ab951 Use nvidia-vaapi-driver on Wayland systems if available 2022-10-05 18:44:11 -05:00
Cameron Gutman
fbbbd5e0b8 Use new LiRequestIdrFrame() API 2022-10-05 00:53:31 -05:00
Cameron Gutman
f8c7e2ee41 Enable HEVC RFI for VideoToolbox 2022-10-05 00:25:59 -05:00
Cameron Gutman
2a4af0bc2c Use colorspace helpers for DRM EGL export 2022-10-05 00:20:33 -05:00
Cameron Gutman
bc68aad67b Print the frame number if decoding fails 2022-10-04 23:38:54 -05:00
Cameron Gutman
9e8a4cab7b Enable HEVC RFI for DXVA2 and D3D11VA 2022-10-04 22:56:21 -05:00
Cameron Gutman
483a601867 Display SDR/HDR status in performance overlay 2022-09-28 17:44:22 -05:00
Cameron Gutman
439e8fe33f Constify frame colorspace helper functions 2022-09-24 18:37:51 -05:00
Cameron Gutman
99885f5b4b Centralize colorspace and color range handling 2022-09-24 12:28:23 -05:00