Simple Directmedia Layer
Go to file
Anthony Pesch c591429542 alsa: avoid hardware parameters with an excessive number of periods.
The previous code attempted to use set_buffer_size / set_period_size
discretely, favoring the parameters which generated a buffer size that was
exactly 2x the requested buffer size. This solution ultimately prioritizes
only the buffer size, which comes at a large performance cost on some machines
where this results in an excessive number of periods. In my case, for a 4096
sample buffer, this configured the device to use 37 periods with a period size
of 221 samples and a buffer size of 8192 samples. With 37 periods, the SDL
Audio thread was consuming 25% of the CPU.

This code has been refactored to use set_period_size and set_buffer_size
together. set_period_size is called first to attempt to set the period to
exactly match the requested buffer size, and set_buffer_size is called second
to further refine the parameters to attempt to use only 2 periods. The
fundamental change here is that the period size / count won't go to extreme
values if the buffer size can't be exactly matched, the buffer size should
instead just increase to the next closest multiple of the target period size
that is supported. After changing this, for a 4096 sample buffer, the device
is configured to use 3 periods with a period size of 4096 samples and a buffer
size of 12288 samples. With only 3 periods, the SDL Audio thread doesn't even
show up when profiling.

Fixes Bugzilla #4156.
2018-05-04 21:21:32 -04:00
acinclude Fixed bug 3481 - Configure fails to detect dynamic library support on powerpc64le 2016-11-06 20:26:48 -08:00
android-project Added support for external mouse in Samsung DeX mode 2018-06-18 13:14:02 -07:00
android-project-ant Added the old ant Android build project structure 2017-10-28 12:11:25 -07:00
build-scripts Fixed bug 4065 - SDL_wave.c fail to compile in armeabi with ndk r16b 2018-01-27 12:05:26 -08:00
cmake cmake: Look in popular places for X11 headers, export this info properly. 2018-06-24 15:12:18 -04:00
debian Updated copyright for 2018 2018-01-03 10:03:25 -08:00
docs audio: Added ARM NEON versions of audio converters. 2018-05-16 02:03:06 -04:00
include Added support for external mouse in Samsung DeX mode 2018-06-18 13:14:02 -07:00
src alsa: avoid hardware parameters with an excessive number of periods. 2018-05-04 21:21:32 -04:00
test cpuinfo: Added SDL_HasAVX512F(). 2018-05-21 11:35:42 -04:00
VisualC ran 'chmod -x' on many files 2018-06-12 14:00:15 +03:00
VisualC-WinRT Windows Phone 8.0 is no longer supported 2018-02-09 08:03:03 -08:00
visualtest ran 'chmod -x' on many files 2018-06-12 14:00:15 +03:00
Xcode ran 'chmod -x' on many files 2018-06-12 14:00:15 +03:00
Xcode-iOS ran 'chmod -x' on many files 2018-06-12 14:00:15 +03:00
.hgignore Updated SDL's YUV support, many thanks to Adrien Descamps 2017-11-12 22:51:12 -08:00
Android.mk ran 'chmod -x' on many files 2018-06-12 14:00:15 +03:00
autogen.sh Don't use pushd/popd in autogen.sh; Ubuntu's /bin/sh doesn't support it. 2016-12-26 22:58:58 -05:00
BUGS.txt BUGS.txt: Changed mailing list link to discourse.libsdl.org. 2017-04-01 00:05:25 -04:00
cmake_uninstall.cmake.in Fixed bug 3867 - Can't find install_manifest.txt when running 'uninstall' target 2017-10-12 08:44:45 -07:00
CMakeLists.txt Fixed bug 4135 - Broken symlink libSDL2.so since rev11940 2018-04-15 09:37:51 -07:00
configure Fixed bug 4154 - Fix three empty variable tests in configure 2018-05-05 10:31:03 -07:00
configure.in Fixed bug 4154 - Fix three empty variable tests in configure 2018-05-05 10:31:03 -07:00
COPYING.txt Updated copyright for 2018 2018-01-03 10:03:25 -08:00
CREDITS.txt
INSTALL.txt More HTTPS doc tweaks. 2017-02-16 16:59:07 -05:00
Makefile.in vulkan: Initial Vulkan support! 2017-08-27 22:15:57 -04:00
Makefile.minimal
Makefile.pandora pandora: Fixed compiler warning about redefining SDL_REVISION. 2017-06-18 23:00:27 +02:00
Makefile.psp
Makefile.wiz
README-SDL.txt More HTTPS changes in the documentation. 2017-02-16 16:52:03 -05:00
README.txt readme: correct webpage URL to use HTTPS. 2017-02-16 13:30:34 -05:00
sdl2-config.cmake.in Applied Ubuntu patch bug_822210_fix_sdl2-config.cmake_whitespace.patch 2016-10-07 15:08:37 -07:00
sdl2-config.in
sdl2.m4
sdl2.pc.in
SDL2.spec.in
SDL2Config.cmake Fixed bug 3651 - CMake build does not install CMake package configuration 2017-08-09 19:03:10 -07:00
TODO.txt
VisualC.html
WhatsNew.txt Added SDL_GameControllerMappingForDeviceIndex() to get the mapping for a controller before it's opened 2018-03-07 13:30:40 -08:00

                         Simple DirectMedia Layer

                                  (SDL)

                                Version 2.0

---
https://www.libsdl.org/

Simple DirectMedia Layer is a cross-platform development library designed
to provide low level access to audio, keyboard, mouse, joystick, and graphics
hardware via OpenGL and Direct3D. It is used by video playback software,
emulators, and popular games including Valve's award winning catalog
and many Humble Bundle games.

More extensive documentation is available in the docs directory, starting
with README.md

Enjoy!
	Sam Lantinga				(slouken@libsdl.org)