From 232ff0b3c6d7df8cc5b1efa1387e4c8ab01cc7d9 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 30 Dec 2025 15:39:47 -0600 Subject: [PATCH] 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 c26e437f405b5e5e58a4e7a2cd5071a4a858cac8. --- app/streaming/video/ffmpeg-renderers/eglvid.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/streaming/video/ffmpeg-renderers/eglvid.cpp b/app/streaming/video/ffmpeg-renderers/eglvid.cpp index 60805ea9..a318839f 100644 --- a/app/streaming/video/ffmpeg-renderers/eglvid.cpp +++ b/app/streaming/video/ffmpeg-renderers/eglvid.cpp @@ -600,7 +600,17 @@ bool EGLRenderer::initialize(PDECODER_PARAMETERS params) #endif ) { SDL_GL_SetSwapInterval(1); - m_BlockingSwapBuffers = true; + +#if SDL_VERSION_ATLEAST(2, 0, 15) && defined(SDL_VIDEO_DRIVER_KMSDRM) + // The SDL KMSDRM backend already enforces double buffering (due to + // SDL_HINT_VIDEO_DOUBLE_BUFFER=1), so calling glFinish() after + // SDL_GL_SwapWindow() will block an extra frame and lock rendering + // at 1/2 the display refresh rate. + if (info.subsystem != SDL_SYSWM_KMSDRM) +#endif + { + m_BlockingSwapBuffers = true; + } } else { SDL_GL_SetSwapInterval(0); }