aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Chini <georg@chini.tk>2019-07-21 15:07:18 +0200
committerArun Raghavan <arun@arunraghavan.net>2019-07-23 20:48:23 +0000
commit3929798a53c6fbc83b3d54d801c1c07cee4c78f5 (patch)
treec47efb15c0ca67d275a85354e00a274716e9c1cd
parente896fdc080c0df1eeb0a5b23eb846c3a1e3f2a4a (diff)
downloadpulseaudio-3929798a53c6fbc83b3d54d801c1c07cee4c78f5.tar.gz
Commit fd9e3452 removed -ffast-math from the compile flags. Under some
conditions this may lead to massive slowdown of floating point operations when underflows or denormals are encountered. In particular, this problem was observed with the soxr resampler after applying https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/120 Therefore this patch adds -ffast-math to the link flags of the pulseaudio daemon. Linking with -ffast-math adds a procedure set_fast_math() to the startup code of the daemon. On x86, the procedure sets bit 6 and 15 of the mxcsr register. When these bits are set, denormals and results of underflowing operations are truncated to 0.
-rw-r--r--src/Makefile.am4
-rw-r--r--src/daemon/meson.build1
2 files changed, 3 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 03535fc8..ede970b2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -175,9 +175,9 @@ PREOPEN_LIBS = $(modlibexec_LTLIBRARIES)
endif
if FORCE_PREOPEN
-pulseaudio_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(IMMEDIATE_LDFLAGS) -dlpreopen force $(foreach f,$(PREOPEN_LIBS),-dlpreopen $(f))
+pulseaudio_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(IMMEDIATE_LDFLAGS) -ffast-math -dlpreopen force $(foreach f,$(PREOPEN_LIBS),-dlpreopen $(f))
else
-pulseaudio_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(IMMEDIATE_LDFLAGS) -dlopen force $(foreach f,$(PREOPEN_LIBS),-dlopen $(f))
+pulseaudio_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(IMMEDIATE_LDFLAGS) -ffast-math -dlopen force $(foreach f,$(PREOPEN_LIBS),-dlopen $(f))
endif
if HAVE_SYSTEMD_DAEMON
diff --git a/src/daemon/meson.build b/src/daemon/meson.build
index 59bf0a2c..f246153f 100644
--- a/src/daemon/meson.build
+++ b/src/daemon/meson.build
@@ -28,6 +28,7 @@ executable('pulseaudio',
pulseaudio_headers,
install: true,
include_directories : [configinc, topinc],
+ link_args : ['-ffast-math'],
link_with : [libpulsecore, libpulsecommon, libpulse],
dependencies : [ltdl_dep, cap_dep, dbus_dep, libsystemd_dep],
c_args : pa_c_args,