Commit Graph

6024 Commits

Author SHA1 Message Date
Sam Lantinga
1df0a1e497 Fixed bug 5140 - KMSDRM: Dynamic vsync toggle does not work
Manuel Alfayate Corchete

The KMSDRM backend was doing things wrong because of some small (but important) misconceptions on how KMS/DRM works: to implement a largely broken non-vsync refresh mechanism, the SwapWindow() function was issuing new pageflips before previous ones had completed, thus causing EBUSY returns, buffer mismanagement, etc... resulting in general breakage on vsync disabling from apps, that would not allow vsync to work again without KMSDRM video re-initialization.
To further clarify, on most DRM drivers async pageflips are NOT working nowadays, so all issued pageflips will complete on next VBLANK, NOT ASAP (calling drmModePageFlip() with the DRM_MODE_PAGE_FLIP_ASYNC flag will return error).

The old code was assuming that can just issue a synchronous (=on VBLANK) pageflip and then pass a 0 timeout to the pull() function so we do not wait for the pageflip event, thinking that this will lead to correct non-vsynced screen updates from the program: That is plain wrong.
Each pageflip has to be waite before issuing a new one, ALWAYS. And if we do not support ASYNC pageflips on the DRM driver level, then we are forced to wait for the next VBLANK. There is no way around it.

I have also added many comments on the KMSDRM code. This is needed for future reference for me or others who may need to look at this code: KMS/DRM terminology regarding what SYNC and ASYNC mean in pageflip terms, and where to do certain things and why, is not trivial. It is not desirable or possible to invest time on researching the same concepts every time there is need to dive into this code. So please leave all these comments in the patch.
2020-05-26 16:27:00 -07:00
Sam Lantinga
15294e2121 Fixed iOS build 2020-05-26 13:54:47 -07:00
Sam Lantinga
cc2fe84d73 Getting closer. 2020-05-26 13:19:48 -07:00
Sam Lantinga
0713c5790d More Linux fixes. 2020-05-26 13:19:44 -07:00
Sam Lantinga
c7d1dab1fe Rename Linux-only variable. 2020-05-26 13:19:41 -07:00
Sam Lantinga
b820a81ffb Include SDL_hints.h. 2020-05-26 13:19:35 -07:00
Sam Lantinga
de866e6606 Include SDL_hint.h. 2020-05-26 13:19:29 -07:00
Sam Lantinga
abd5841850 Make some changes to SDL_SetThreadPriority to try and have SDL transparently handle more of the work.
1. Comment that SDL_SetThreadPriority will make any necessary system changes when applying priority.
2. Add a hint to override SDL's default behavior for scheduler policy.
3. Modify the pthreads SDL_SetThreadPriority so that instead of just using the current thread scheduler policy it will change it to a policy that should work best for the requested priority.
4. Add hint checks in SDL_SetThreadPriority so that #3 can be overridden if desired.
5. Modify the Linux SDL_SetThreadPriority so that in the case that policy, either by SDL defaults or from the hint, is a realtime policy it uses the realtime rtkit API.
6. Prior to calling rtkit on Linux make the necessary thread state changes that rtkit requires.  Currently this is done every time as it isn't expected that SDL_SetThreadPriority will be called repeatedly for a thread.
2020-05-26 13:19:19 -07:00
Sam Lantinga
f16e6bfa8e Fixed creating a metal renderer without specifying a metal window 2020-05-25 14:10:51 -07:00
Sam Lantinga
f176d7fda0 Added a note not to use XinputUap.dll for XInput support 2020-05-22 16:45:02 -07:00
Ryan C. Gordon
600a2fc7c3 locale: Removed unused variable. 2020-05-21 04:01:37 -04:00
Ryan C. Gordon
a299fdd789 sensor: Fixed compiler warnings on mingw64. 2020-05-21 03:52:48 -04:00
Ryan C. Gordon
ba11122ea0 locale: Fixed compiler warning on Visual Studio. 2020-05-21 03:48:56 -04:00
Ryan C. Gordon
b4e76b58e7 sensor: Fix overaggressive search/replace. :) 2020-05-20 17:32:23 -04:00
Ryan C. Gordon
27c38eb22e sensor: Correct fix for redefinition of various symbols. 2020-05-20 17:22:52 -04:00
Ryan C. Gordon
5fe34a4079 hidapi: Fix compiler warning. 2020-05-20 17:01:25 -04:00
Ryan C. Gordon
c9d358bce9 sensor: Fix build on various Windows compilers with various predefinitions. 2020-05-20 16:59:35 -04:00
Ryan C. Gordon
68777406e5 windows: Fix calls to CoCreateInstance() so last parameter is a LPVOID *. 2020-05-20 16:58:33 -04:00
Ryan C. Gordon
539125b895 locale: Fixed compiler warning on WinRT. 2020-05-20 16:43:02 -04:00
Ryan C. Gordon
8bd3b2c801 configure: fix fcitx tests.
Otherwise Unix systems without D-Bus support will attempt to compile sources
they can't handle.
2020-05-20 16:34:19 -04:00
Ryan C. Gordon
d66b73666d locale: Patched to compile on Windows Phone. 2020-05-20 16:15:14 -04:00
Ryan C. Gordon
a5c654d5c3 configure: Just don't do the -idirafter on QNX.
The compiler understands it, but the "qcc" compiler driver doesn't, and the
standard Khronos headers upset QNX anyhow, since they try to include X11
headers in the __unix__ section.
2020-05-19 13:22:01 -04:00
Ryan C. Gordon
72fdc80512 configure: -idirafter needs a space, -I doesn't.
Some compilers are apparently quite cranky about the -I not having a space!
2020-05-19 12:30:26 -04:00
Ryan C. Gordon
475afe2162 configure: Do a real check for -idirafter anyhow.
(The CMake project cheats around this by asking "are we GCC or Clang?" and I'm
inclined to leave it like that for now.)
2020-05-19 12:08:05 -04:00
Ryan C. Gordon
2f565b4469 configure: Regenerate configure script. 2020-05-19 11:52:15 -04:00
Ryan C. Gordon
0e08d23793 configure: Not all compilers understand -idirafter, use -I instead.
If this is a problem, we can write a test for the compiler flag, but shouldn't
we _always_ use our Khronos headers instead of depending on the system...?
2020-05-19 11:48:22 -04:00
Ryan C. Gordon
da54eb7c3a checker-buildbot.bat: Removed. This is clearly not going to work like this. 2020-05-19 11:38:18 -04:00
Ryan C. Gordon
24a76b278a build-scripts: Attempt at a static analysis batch file for Windows. 2020-05-19 04:01:03 -04:00
Ryan C. Gordon
3808b120dc locale: Make sure C++ implementations (Haiku!) use C linkage. 2020-05-19 03:14:46 -04:00
Ryan C. Gordon
20ed8019c9 os2-buildbot.sh: Fix upload path. 2020-05-19 02:59:02 -04:00
Ryan C. Gordon
a1d7410ff8 windows-buildbot-zipper.bat: Attempt to update for new buildbot. 2020-05-19 02:56:02 -04:00
Ryan C. Gordon
863776f8dd haiku: Another attempt at fixing build. 2020-05-19 01:19:52 -04:00
Ryan C. Gordon
e53d39cf35 haiku: Patched to compile. 2020-05-19 00:09:59 -04:00
Ryan C. Gordon
e11a665cd6 raspberrypi-buildbot.sh: Fix output directory. 2020-05-18 21:20:11 -04:00
Ryan C. Gordon
9db4e6ed35 os2-buildbot.sh: Fix output directory. 2020-05-18 21:10:20 -04:00
Ryan C. Gordon
3195551b2e xcode: make sure locale sources are used in all targets. 2020-05-18 21:07:02 -04:00
Ryan C. Gordon
7558d960b6 OS/2: Forgot to add locale source dir to makefile. 2020-05-18 20:18:34 -04:00
Ryan C. Gordon
c26c348a32 raspberrypi-buildbot.sh: Leave files in the right place, don't nuke build dir. 2020-05-18 20:06:16 -04:00
Ryan C. Gordon
b0f41e1421 emscripten-buildbot.sh: Leave files in the right place, don't nuke build dir. 2020-05-18 20:02:11 -04:00
Ryan C. Gordon
5358882b10 emscripten-buildbot.sh: the SDK path changed on the new build worker. 2020-05-18 16:33:29 -04:00
Ryan C. Gordon
4c883383d4 checker-buildbot.sh: Use Ninja, not GNU make, and expect scan-build in $PATH. 2020-05-18 15:52:51 -04:00
Ryan C. Gordon
c1ef549745 emscripten-buildbot.sh: target WebAssembly instead of asm.js.
Fixes Bugzilla #5132.
2020-05-18 12:00:22 -04:00
Sylvain Becker
db4246f695 Only set colorkey, if converted surface has no alpha channel (2979) 2020-05-17 21:23:17 +02:00
Sylvain Becker
f6197aec85 Fix issue with colorkey, palette and format conversion
Set the colorkey information on the converted surface.
Test-case in bug 3826/2979, conflicting with bug 4798
2020-05-17 20:45:55 +02:00
Sylvain Becker
39690a0478 Fix static analysis warning in SDL_render.c 2020-05-15 21:33:47 +02:00
Sylvain Becker
5b65e0af01 Fixed bug 5100 - compilation CMake Android armeabi-v7a (Thanks Steve Robinson!)
fatal error: 'cpu-features.h' file not found on CMake Android armeabi-v7a
2020-05-15 21:12:23 +02:00
Ryan C. Gordon
d31dac1563 docs: README-linux.md updated for a modern Ubuntu release. 2020-05-14 21:54:51 -04:00
Ryan C. Gordon
ec2d70364a docs: Fixed README-linux.md's line endings and word wrap. 2020-05-14 21:49:29 -04:00
Ryan C. Gordon
2d5de8faf9 docs: Linux systems don't need to install wayland-protocols anymore.
We ship the protocol xml files we need with SDL's sources now.
2020-05-14 21:48:24 -04:00
Ryan C. Gordon
daf360e040 emscripten: Fix crash in SDL_SetWindowTitle().
This patch came from emscripten-ports, thanks!

Fixes Bugzilla #5133.
2020-05-13 16:48:42 -04:00