mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
cpu: add zero_denormals method
Add a method to enable/disable the denormals flush-to-zero and denormals-as-zero CPU options. Add a config option to make it possible to disable this again. Fixes high CPU usage when dealing with denormals, which can happen in many DSP functions. Fixes #1681
This commit is contained in:
parent
036371c48f
commit
85d5c8cd6c
6 changed files with 70 additions and 3 deletions
|
|
@ -176,3 +176,15 @@ x86_init(struct impl *impl)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int x86_zero_denormals(void *object, bool enable)
|
||||
{
|
||||
unsigned int mxcsr;
|
||||
mxcsr = __builtin_ia32_stmxcsr();
|
||||
if (enable)
|
||||
mxcsr |= 0x8040;
|
||||
else
|
||||
mxcsr &= ~0x8040;
|
||||
__builtin_ia32_ldmxcsr(mxcsr);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue