Commit Graph

61 Commits

Author SHA1 Message Date
Cameron Gutman aac5ad3fd0 Add a libplacebo-based Vulkan renderer for HDR and Vulkan video decoding support
Vulkan H.264/HEVC video decoding isn't supported with Fedora's Mesa binaries due to
patent issues, so only the VAAPI/DRM-PRIME import path was tested locally with ANV.

HDR video is getting tonemapped to my SDR monitor reasonably, so HDR output probably
works with GameScope but I haven't confirmed yet.

See #1117
2023-12-12 23:54:23 -06:00
Cameron Gutman 7e4fddbe62 Only block EGL rendering on Pi 4 and earlier
Hopefully Pi 5 is powerful enough to at least render 1080p 60 FPS.
2023-10-08 16:16:33 -05:00
Casey Korver ea06ec0133 Correct spelling mistakes found with Codespell 2023-07-09 13:21:18 -05: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 5970ca49e9 Don't use swap interval on Wayland 2022-11-12 15:45:54 -06:00
Cameron Gutman 17848c097c Don't switch between GLX and EGL if EGL worked 2022-10-16 22:57:08 -05:00
Cameron Gutman 99885f5b4b Centralize colorspace and color range handling 2022-09-24 12:28:23 -05:00
Cameron Gutman d39a29759c Don't draw with test-only renderers 2022-08-21 18:38:09 -05:00
Cameron Gutman aa7d5fa924 Don't use swap interval 1 by default on Wayland systems 2022-08-14 13:09:31 -05:00
Cameron Gutman be2f4433db Avoid hardcoding VIDEO_FORMAT_H265_MAIN10 for HDR/10-bit color 2022-06-26 16:22:05 -05:00
Cameron Gutman f8a6012c3a Improve overlay format handling 2022-05-28 22:48:23 -05:00
Cameron Gutman f99f1f6441 Disable EGL renderer on RPi due to very poor performance 2022-05-23 23:05:07 -05:00
Cameron Gutman 8aa42ff1d9 Reset the EGL renderer when specialization fails 2022-05-17 17:10:40 -05:00
Cameron Gutman 0f5d4aa72f Enhance EGLRenderer's waitForRender() implementation 2022-04-10 20:20:44 -05:00
Cameron Gutman d8dbe77427 Tiny EGL code cleanup 2022-04-10 19:35:29 -05:00
Cameron Gutman e3a7b54f90 Use EGL fences to reduce video latency 2022-04-08 19:28:22 -05:00
Cameron Gutman 474591c6a5 Use a separate callback to indicate EOS instead of renderFrame() 2022-04-07 21:30:20 -05:00
Cameron Gutman 940ae6406b Add helper functions to perform NDC transformations 2022-04-05 00:50:04 -05:00
Cameron Gutman 2fc1dda232 Partially revert e64b15d and b85d5b8
These changes cause excessive window recreation using the Flatpak on Nvidia with Wayland
2022-03-19 14:50:38 -05:00
Cameron Gutman 3fcf31d009 Improve robustness of EGL retry logic for 10-bit color 2022-01-29 01:12:38 -06:00
Cameron Gutman e64b15d2a7 Rework how we deal with window re-creation for EGLRenderer
Previously we opted to just lie to SDL and tell it that the current
GL context is actually GLES 3.0 when it wasn't. This meant that
we avoided our window being recreated for GLES usage on Wayland
and KMSDRM, but that meant our 10-bit color change didn't apply
either. I suspect this hackery is what led EGLRenderer to get
stuck in a state where SDL_CreateRenderer() always failed.

Now SDL will recreate our window once to configure a compatible GL
API for our renderer. If that fails, we'll move on to a different
renderer (which may recreate the window again).
2022-01-27 21:49:03 -06:00
Cameron Gutman 2416618b34 Don't require 2 bits of alpha for 10-bit color 2022-01-26 18:55:56 -06:00
Cameron Gutman b85d5b8822 Enable P010 surface export from VAAPI to EGL 2022-01-23 18:33:30 -06:00
Cameron Gutman dd941154d6 Fix EGL renderer overlay rendering with SDL_ttf 2.0.18
Fixes #721
2022-01-20 18:02:44 -06:00
Cameron Gutman 1193943228 Re-add comment on color_range comparison 2021-11-19 00:56:46 -06:00
Cameron Gutman 2959faca0c Fix colorspace transitions in EGLRenderer 2021-11-19 00:54:59 -06:00
Cameron Gutman 43e3679297 Revert "Disable the EGL render thread on Wayland"
This reverts commit dcc567ebda.
2021-11-15 21:33:28 -06:00
Cameron Gutman dcc567ebda Disable the EGL render thread on Wayland 2021-07-31 17:24:18 -05:00
Cameron Gutman 8159e07427 Ensure our GL context is always current 2021-07-28 20:31:22 -05:00
Cameron Gutman e74753bec1 Allow fallback from EGL to direct on EGLImage export failure 2021-03-22 22:51:29 -05:00
Cameron Gutman 26d04b5f9c Render DRM-PRIME frames as opaque images
We can't always assume they are NV12. Even if they _are_ NV12,
they may have DRM format modifiers that are incompatible with
simply assuming linear Y and UV buffers (such as tiling).
2021-03-21 23:23:12 -05:00
Cameron Gutman a0b9684504 Continue refactoring for non-NV12 support in EGLRenderer 2021-03-21 21:43:57 -05:00
Cameron Gutman 402b6d1f0c Begin refactoring for non-NV12 support in EGLRenderer 2021-03-21 19:20:52 -05:00
Cameron Gutman d33ccce683 Hold a reference to the underlying DMA-BUFs until the next frame 2021-03-07 12:01:25 -06:00
Cameron Gutman d722bf10b9 Don't use glFinish() with KMSDRM backend 2021-03-07 11:23:31 -06:00
Cameron Gutman 164b3edd41 Fix viewport size on High DPI Wayland systems
Fixes #533
2021-03-01 22:47:14 -06:00
Cameron Gutman 93d21a0d1d Fix EGLImage leak when not using a hwaccel backend 2021-02-06 17:59:05 -06:00
Cameron Gutman 36dd6c83e0 Fix assert failure when using v4l2m2m with EGL 2021-02-04 20:38:18 -06:00
Cameron Gutman c3895f06c0 Fix handling of preferred/compatible pixel formats with EGLRenderer and VAAPI/DRM backends 2021-02-04 19:39:18 -06:00
Cameron Gutman c3cea0238e Fix build with old EGL 1.5 headers without EGL_EGL_PROTOTYPES 2021-01-31 21:42:56 -06:00
Cameron Gutman baffab62ce Fix uninitialized variable warning 2021-01-31 12:58:19 -06:00
Cameron Gutman dbfdc2fd14 Share DRM FD and GBM device with SDL
Depends on https://hg.libsdl.org/SDL/rev/d75deb75464a
2021-01-30 21:11:52 -06:00
Cameron Gutman a0cc93b813 Fix EGL renderer build on SDL 2.0.9 and earlier 2021-01-03 14:24:30 -06:00
Cameron Gutman e5bcc793e5 Implement overlay support in EGLRenderer
Fixes #405
2020-12-19 23:01:41 -06:00
Cameron Gutman 2f3a1a5d79 Work around bug where GLES surface creation repeatedly fails on X11 2020-09-07 23:53:29 -07:00
Cameron Gutman 88ed72fdc1 Use regular VSync when enabled because adaptive VSync still tears 2020-06-20 14:44:21 -07:00
Cameron Gutman f1c459fd6c Fix leak of renderer when we fail to create a GL context 2020-06-08 20:39:12 -07:00
Cameron Gutman 994312c212 Force GL to block after the current frame instead during the next frame 2020-05-16 16:25:13 -07:00
Cameron Gutman 5f25e0d4e2 Add limited support for frame pacing to EGLRenderer 2020-05-16 15:59:10 -07:00
Cameron Gutman 4bbe571f5f Fix build without FFmpeg and with older EGL 1.5 headers 2020-05-16 13:25:10 -07:00