Commit Graph

83 Commits

Author SHA1 Message Date
Cameron Gutman b6d10a34c8 Update blocking swap buffer opt-out comment 2025-12-30 15:43:31 -06:00
Cameron Gutman 232ff0b3c6 Revert "Remove opt-out of blocking swap buffers logic for KMSDRM"
This significantly hurts performance on slower GPUs by preventing
the pipelining required when frametimes exceed the video frame
interval.

This reverts commit c26e437f40.
2025-12-30 15:39:47 -06:00
Cameron Gutman c26e437f40 Remove opt-out of blocking swap buffers logic for KMSDRM
We don't set SDL_HINT_VIDEO_DOUBLE_BUFFER since b1c77ff.
2025-12-29 16:51:03 -06:00
Cameron Gutman e89f63b8fb Skip unnecessary glClear() on X11 2025-12-29 16:50:15 -06:00
Cameron Gutman 3e5aa9b127 Simplify EGLImageFactory and remove caching logic for now
The platforms that would most benefit (embedded V4L2 decoders)
either don't use frame pooling or don't synchronize with
modified DMA-BUFs unless eglCreateImage() is called each time.
2025-12-28 17:54:31 -06:00
Cameron Gutman c5b7a9c679 Optimize EGLRenderer with overlay VAOs and reduced GL_BLEND usage 2025-12-28 13:14:16 -06:00
Cameron Gutman f1451a0db3 Fix UB due to missing shader attribute location binding
Mesa drivers seem to generally bind attributes in order, but the
proprietary PowerVR driver (pvr) doesn't and renders incorrectly
as a result.
2025-12-27 23:56:17 -06:00
Cameron Gutman 8a5f34fb01 Remove logic to force the OpenGL ES library to load
This isn't necessary now that we turn on EGL everywhere,
and it breaks OpenGL ES 2.0 support too.
2025-12-27 23:11:53 -06:00
Cameron Gutman d1f43ca258 Use ESSL 1.0 for EGLRenderer shaders
We still ostensibly support GLES 2.0 GPUs.
2025-12-27 22:56:20 -06:00
Cameron Gutman 3425fec33d Use EGL+GLES workaround for Nvidia X11
We can avoid disabling EGL entirely by forcing Qt to use GLES,
which is not impacted by the black window issue. This lets us
simplify back to EGL everywhere.
2025-12-14 16:21:32 -06:00
Cameron Gutman 54163e30d0 Disable EGL on Nvidia XWayland environments too
It renders a black window, just like native X11.
2025-12-11 20:13:14 -06:00
Cameron Gutman 9c6d2bab19 Use EGL_VENDOR instead of NV-CONTROL for Nvidia detection
The latter will still match on a hybrid system when the iGPU's EGL
implementation is in use. This scenario works properly with EGL
rendering in Qt and SDL, so we want to allow that.
2025-12-06 11:20:03 -06:00
Cameron Gutman 1c24aada0a Never use X11 EGL on Nvidia proprietary drivers
Fixes #1751
2025-12-05 23:10:31 -06:00
Cameron Gutman 8324f61db0 Reduce per-frame GL calls in EGLRenderer
Uniforms are attached to the program object, so they don't need to
be set each time we swap between the YUV shader and the overlay
shader.

Since 0 overlays is by far the most common case and > 1 is highly
unlikely, move the glViewport() call into renderOverlay() to let
us skip it in the common case (and be no worse than today in the
2nd most common case of 1 overlay).
2025-11-06 17:52:30 -06:00
Cameron Gutman 7f7cc89e61 Switch EGLRenderer to the shared functions for CSC matrix generation and chroma co-siting 2025-11-05 22:27:31 -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 96fb6ee5e9 Share SDL's EGL display with EGLRenderer
Fixes #1396
2024-09-12 22:37:25 -05:00
Cameron Gutman e76780e105 Add a new prepareToRender() callback for renders to perform their initial window clears
This consolidates all the clearing that was strewn across the codebase.
2024-06-25 23:12:18 -05:00
Cameron Gutman 2a05b890d8 Enable transparent resizing and display changes for supported renderers 2023-12-17 21:15:40 -06:00
Cameron Gutman 481f23b6e9 Remove some dependencies on fixed window and frame sizes 2023-12-17 20:39:26 -06:00
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