Commit Graph

21 Commits

Author SHA1 Message Date
Francesco Abbate
0dd7024d55 Modifies WaitEvent and WaitEventTimeout to actually wait instead of polling
When possible use native os functions to make a blocking call waiting for
an incoming event. Previous behavior was to continuously poll the event
queue with a small delay between each poll.

The blocking call uses a new optional video driver event,
WaitEventTimeout, if available. It is called only if an window
already shown is available. If present the window is designated
using the variable wakeup_window to receive a wakeup event if
needed.

The WaitEventTimeout function accept a timeout parameter. If
positive the call will wait for an event or return if the timeout
expired without any event. If the timeout is zero it will
implement a polling behavior. If the timeout is negative the
function will block indefinetely waiting for an event.

To let the main thread sees events sent form a different thread
a "wake-up" signal is sent to the main thread if the main thread
is in a blocking state. The wake-up event is sent to the designated
wakeup_window if present.

The wake-up event is sent only if the PushEvent call is coming
from a different thread. Before sending the wake-up event
the ID of the thread making the blocking call is saved using the
variable blocking_thread_id and it is compared to the current
thread's id to decide if the wake-up event should be sent.

Two new optional video device methods are introduced:

WaitEventTimeout
SendWakeupEvent

in addition the mutex

wakeup_lock

which is defined and initialized but only for the drivers supporting the
methods above.

If the methods are not present the system behaves as previously
performing a periodic polling of the events queue.

The blocking call is disabled if a joystick or sensor is detected
and falls back to previous behavior.
2021-06-04 13:50:50 -07:00
Sylvain Becker
0e7d435f13 Add basic testgles2_sdf program to demonstrate sign distance field with opengles2 2021-01-24 00:51:24 -05:00
Sam Lantinga
67e9132dd5 Fixed circular dependency problem when building in the test directory 2020-12-20 12:22:28 -08:00
Simon McVittie
65847539dd test: Add a unit test for input device classification heuristics
This uses pre-recorded evdev capabilities, so that we can check for
regressions without the devices having to be physically present.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-11-11 19:15:43 -08:00
Ryan C. Gordon
77c9d73b63 Removed SDL_AndroidOpenURL, added SDL_OpenURL.
Still needs to be wired into Xcode and Visual Studio projects.
2020-10-05 11:30:33 -04:00
Ryan C. Gordon
fa23e3d00b locale: Implemented SDL_GetPreferredLocales().
This was something I proposed a long time ago, Sylvain Becker did
additional work on it, then back to me.

Fixes Bugzilla #2131.
2020-05-04 02:27:29 -04:00
Ryan C. Gordon
18d83093a8 test: configure/make shouldn't build GL/GLES1/GLES2 programs if unsupported. 2019-05-18 23:47:57 -04:00
Ryan C. Gordon
aae29c9ebd test: Makefile should copy .dat files for testoverlay2. 2018-09-02 00:35:11 -04:00
Sam Lantinga
7c3040e08a First pass on the new SDL sensor API 2018-08-21 12:11:34 -07:00
Sam Lantinga
4764f7a45c Fixed building YUV test programs (thanks Ozkan!) 2017-11-17 10:54:46 -08:00
Sam Lantinga
a6a4e27ae8 Updated SDL's YUV support, many thanks to Adrien Descamps
New functions get and set the YUV colorspace conversion mode:
	SDL_SetYUVConversionMode()
	SDL_GetYUVConversionMode()
	SDL_GetYUVConversionModeForResolution()

SDL_ConvertPixels() converts between all supported RGB and YUV formats, with SSE acceleration for converting from planar YUV formats (YV12, NV12, etc) to common RGB/RGBA formats.

Added a new test program, testyuv, to verify correctness and speed of YUV conversion functionality.
2017-11-12 22:51:12 -08:00
Ryan C. Gordon
25e3a1ec90 vulkan: Initial Vulkan support!
This work was done by Jacob Lifshay and Mark Callow; I'm just merging it
into revision control.
2017-08-27 22:15:57 -04:00
Ryan C. Gordon
5dc350133f test: Makefile.in should copy bitmap and wave files to build directory.
I've lost count of the times I've forgotten to do this manually and wondered
why loopwave can't open sample.wav.  :)
2017-05-29 18:24:06 -04:00
Sam Lantinga
60ba8552d8 Backed out changeset e3fcdad257fc - testaudiocapture.c already does what we want 2017-03-16 16:45:12 -07:00
Sam Lantinga
570e286fd6 Added an audio recording test program 2017-03-15 11:39:54 -07:00
Ryan C. Gordon
ee09975007 audio: Initial bits to enable audio capture support. 2016-08-01 00:18:56 -04:00
Brandon Schaefer
578edca454 Tests: Would be wise to compile this 2016-07-13 09:41:43 -07:00
Ryan C. Gordon
deb2acbcd9 A simple test program for SDL_qsort(). 2016-03-10 01:50:43 -05:00
Ryan C. Gordon
c3114975db Added SDL_GetDisplayUsableBounds(). 2016-01-04 23:52:40 -05:00
Ryan C. Gordon
b7ecc67009 Added test/testdisplayinfo.c 2015-07-14 21:28:26 -04:00
Philipp Wiesemann
0e45984fa0 Fixed crash if initialization of EGL failed but was tried again later.
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().
2015-06-21 17:33:46 +02:00