mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
SDL: ensure swap interval is set correctly for SDL2 kmsdrm driver
It appears that SDL2's kmsdrm driver ignores the swap interval setting if the SDL context has not yet been created. Moving the call to after context creation allows it to work as expected. Fixes vsync when running ppsspp in a KMS context using the SDL2 kmsdrm driver (which is especially useful for Raspberry Pi 4 B, but is also needed for other systems including Raspberry Pi 3B via firmware KMS & Intel Haswell i965 via KMS on x64).
This commit is contained in:
parent
5a4a96893e
commit
18edfefa0a
2 changed files with 6 additions and 2 deletions
|
@ -443,7 +443,6 @@ int main(int argc, char *argv[]) {
|
|||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
||||
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
|
||||
// Force fullscreen if the resolution is too low to run windowed.
|
||||
if (g_DesktopWidth < 480 * 2 && g_DesktopHeight < 272 * 2) {
|
||||
|
@ -571,6 +570,9 @@ int main(int argc, char *argv[]) {
|
|||
NativeResized();
|
||||
}
|
||||
|
||||
// Ensure that the swap interval is set after context creation (needed for kmsdrm)
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
|
||||
SDL_AudioSpec fmt, ret_fmt;
|
||||
memset(&fmt, 0, sizeof(fmt));
|
||||
fmt.freq = 44100;
|
||||
|
|
|
@ -119,11 +119,13 @@ bool GLDummyGraphicsContext::InitFromRenderThread(std::string *errorMessage) {
|
|||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
||||
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
|
||||
screen_ = CreateHiddenWindow();
|
||||
glContext_ = SDL_GL_CreateContext(screen_);
|
||||
|
||||
// Ensure that the swap interval is set after context creation (needed for kmsdrm)
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
|
||||
#ifndef USING_GLES2
|
||||
// Some core profile drivers elide certain extensions from GL_EXTENSIONS/etc.
|
||||
// glewExperimental allows us to force GLEW to search for the pointers anyway.
|
||||
|
|
Loading…
Add table
Reference in a new issue