mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
main: hook up cpu detection code
Add CPU detection code to activate the various optimisations. Move some method definitions around. Use compatibility macros when we can.
This commit is contained in:
parent
a83f5524fb
commit
563cb2dea9
4 changed files with 20 additions and 21 deletions
|
|
@ -95,6 +95,7 @@
|
||||||
#ifdef HAVE_DBUS
|
#ifdef HAVE_DBUS
|
||||||
#include <pulsecore/dbus-shared.h>
|
#include <pulsecore/dbus-shared.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <pulsecore/cpu-x86.h>
|
||||||
|
|
||||||
#include "cmdline.h"
|
#include "cmdline.h"
|
||||||
#include "cpulimit.h"
|
#include "cpulimit.h"
|
||||||
|
|
@ -821,8 +822,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
pa_memtrap_install();
|
pa_memtrap_install();
|
||||||
|
|
||||||
pa_volume_func_init_mmx();
|
pa_cpu_init_x86();
|
||||||
pa_volume_func_init_sse();
|
|
||||||
|
|
||||||
pa_assert_se(mainloop = pa_mainloop_new());
|
pa_assert_se(mainloop = pa_mainloop_new());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,9 +91,6 @@ typedef void (*pa_do_volume_func_t) (void *samples, void *volumes, unsigned chan
|
||||||
pa_do_volume_func_t pa_get_volume_func(pa_sample_format_t f);
|
pa_do_volume_func_t pa_get_volume_func(pa_sample_format_t f);
|
||||||
void pa_set_volume_func(pa_sample_format_t f, pa_do_volume_func_t func);
|
void pa_set_volume_func(pa_sample_format_t f, pa_do_volume_func_t func);
|
||||||
|
|
||||||
void pa_volume_func_init_mmx(void);
|
|
||||||
void pa_volume_func_init_sse(void);
|
|
||||||
|
|
||||||
#define PA_CHANNEL_POSITION_MASK_LEFT \
|
#define PA_CHANNEL_POSITION_MASK_LEFT \
|
||||||
(PA_CHANNEL_POSITION_MASK(PA_CHANNEL_POSITION_FRONT_LEFT) \
|
(PA_CHANNEL_POSITION_MASK(PA_CHANNEL_POSITION_FRONT_LEFT) \
|
||||||
| PA_CHANNEL_POSITION_MASK(PA_CHANNEL_POSITION_REAR_LEFT) \
|
| PA_CHANNEL_POSITION_MASK(PA_CHANNEL_POSITION_REAR_LEFT) \
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@
|
||||||
#include <pulsecore/g711.h>
|
#include <pulsecore/g711.h>
|
||||||
#include <pulsecore/core-util.h>
|
#include <pulsecore/core-util.h>
|
||||||
|
|
||||||
|
#include "cpu-x86.h"
|
||||||
|
|
||||||
#include "sample-util.h"
|
#include "sample-util.h"
|
||||||
#include "endianmacros.h"
|
#include "endianmacros.h"
|
||||||
|
|
||||||
|
|
@ -142,7 +144,7 @@ pa_volume_ulaw_mmx (uint8_t *samples, int32_t *volumes, unsigned channels, unsig
|
||||||
static void
|
static void
|
||||||
pa_volume_s16ne_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
pa_volume_s16ne_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
||||||
{
|
{
|
||||||
int64_t channel, temp;
|
pa_reg_x86 channel, temp;
|
||||||
|
|
||||||
/* the max number of samples we process at a time, this is also the max amount
|
/* the max number of samples we process at a time, this is also the max amount
|
||||||
* we overread the volume array, which should have enough padding. */
|
* we overread the volume array, which should have enough padding. */
|
||||||
|
|
@ -203,8 +205,8 @@ pa_volume_s16ne_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsi
|
||||||
"6: \n\t"
|
"6: \n\t"
|
||||||
" emms \n\t"
|
" emms \n\t"
|
||||||
|
|
||||||
: "+r" (samples), "+r" (volumes), "+r" (length), "=D" ((int64_t)channel), "=&r" (temp)
|
: "+r" (samples), "+r" (volumes), "+r" (length), "=D" ((pa_reg_x86)channel), "=&r" (temp)
|
||||||
: "r" ((int64_t)channels)
|
: "r" ((pa_reg_x86)channels)
|
||||||
: "cc"
|
: "cc"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -212,7 +214,7 @@ pa_volume_s16ne_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsi
|
||||||
static void
|
static void
|
||||||
pa_volume_s16re_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
pa_volume_s16re_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
||||||
{
|
{
|
||||||
int64_t channel, temp;
|
pa_reg_x86 channel, temp;
|
||||||
|
|
||||||
/* the max number of samples we process at a time, this is also the max amount
|
/* the max number of samples we process at a time, this is also the max amount
|
||||||
* we overread the volume array, which should have enough padding. */
|
* we overread the volume array, which should have enough padding. */
|
||||||
|
|
@ -279,8 +281,8 @@ pa_volume_s16re_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsi
|
||||||
"6: \n\t"
|
"6: \n\t"
|
||||||
" emms \n\t"
|
" emms \n\t"
|
||||||
|
|
||||||
: "+r" (samples), "+r" (volumes), "+r" (length), "=D" ((int64_t)channel), "=&r" (temp)
|
: "+r" (samples), "+r" (volumes), "+r" (length), "=D" ((pa_reg_x86)channel), "=&r" (temp)
|
||||||
: "r" ((int64_t)channels)
|
: "r" ((pa_reg_x86)channels)
|
||||||
: "cc"
|
: "cc"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -443,7 +445,7 @@ pa_volume_s24_32re_mmx (uint32_t *samples, int32_t *volumes, unsigned channels,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RUN_TEST
|
#undef RUN_TEST
|
||||||
|
|
||||||
#ifdef RUN_TEST
|
#ifdef RUN_TEST
|
||||||
#define CHANNELS 2
|
#define CHANNELS 2
|
||||||
|
|
@ -486,7 +488,7 @@ static void run_test (void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void pa_volume_func_init_mmx (void) {
|
void pa_volume_func_init_mmx (pa_cpu_x86_flag_t flags) {
|
||||||
pa_log_info("Initialising MMX optimized functions.");
|
pa_log_info("Initialising MMX optimized functions.");
|
||||||
|
|
||||||
#ifdef RUN_TEST
|
#ifdef RUN_TEST
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@
|
||||||
#include <pulsecore/g711.h>
|
#include <pulsecore/g711.h>
|
||||||
#include <pulsecore/core-util.h>
|
#include <pulsecore/core-util.h>
|
||||||
|
|
||||||
|
#include "cpu-x86.h"
|
||||||
|
|
||||||
#include "sample-util.h"
|
#include "sample-util.h"
|
||||||
#include "endianmacros.h"
|
#include "endianmacros.h"
|
||||||
|
|
||||||
|
|
@ -140,8 +142,7 @@ pa_volume_ulaw_sse (uint8_t *samples, int32_t *volumes, unsigned channels, unsig
|
||||||
static void
|
static void
|
||||||
pa_volume_s16ne_sse (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
pa_volume_s16ne_sse (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
||||||
{
|
{
|
||||||
int64_t channel;
|
pa_reg_x86 channel, temp;
|
||||||
int64_t temp;
|
|
||||||
|
|
||||||
/* the max number of samples we process at a time, this is also the max amount
|
/* the max number of samples we process at a time, this is also the max amount
|
||||||
* we overread the volume array, which should have enough padding. */
|
* we overread the volume array, which should have enough padding. */
|
||||||
|
|
@ -210,7 +211,7 @@ pa_volume_s16ne_sse (int16_t *samples, int32_t *volumes, unsigned channels, unsi
|
||||||
"8: \n\t"
|
"8: \n\t"
|
||||||
|
|
||||||
: "+r" (samples), "+r" (volumes), "+r" (length), "=D" (channel), "=&r" (temp)
|
: "+r" (samples), "+r" (volumes), "+r" (length), "=D" (channel), "=&r" (temp)
|
||||||
: "r" ((int64_t)channels)
|
: "r" ((pa_reg_x86)channels)
|
||||||
: "cc"
|
: "cc"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -218,8 +219,7 @@ pa_volume_s16ne_sse (int16_t *samples, int32_t *volumes, unsigned channels, unsi
|
||||||
static void
|
static void
|
||||||
pa_volume_s16re_sse (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
pa_volume_s16re_sse (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
||||||
{
|
{
|
||||||
int64_t channel;
|
pa_reg_x86 channel, temp;
|
||||||
int64_t temp;
|
|
||||||
|
|
||||||
/* the max number of samples we process at a time, this is also the max amount
|
/* the max number of samples we process at a time, this is also the max amount
|
||||||
* we overread the volume array, which should have enough padding. */
|
* we overread the volume array, which should have enough padding. */
|
||||||
|
|
@ -296,7 +296,7 @@ pa_volume_s16re_sse (int16_t *samples, int32_t *volumes, unsigned channels, unsi
|
||||||
"8: \n\t"
|
"8: \n\t"
|
||||||
|
|
||||||
: "+r" (samples), "+r" (volumes), "+r" (length), "=D" (channel), "=&r" (temp)
|
: "+r" (samples), "+r" (volumes), "+r" (length), "=D" (channel), "=&r" (temp)
|
||||||
: "r" ((int64_t)channels)
|
: "r" ((pa_reg_x86)channels)
|
||||||
: "cc"
|
: "cc"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -459,7 +459,7 @@ pa_volume_s24_32re_sse (uint32_t *samples, int32_t *volumes, unsigned channels,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RUN_TEST
|
#undef RUN_TEST
|
||||||
|
|
||||||
#ifdef RUN_TEST
|
#ifdef RUN_TEST
|
||||||
#define CHANNELS 2
|
#define CHANNELS 2
|
||||||
|
|
@ -502,7 +502,7 @@ static void run_test (void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void pa_volume_func_init_sse (void) {
|
void pa_volume_func_init_sse (pa_cpu_x86_flag_t flags) {
|
||||||
pa_log_info("Initialising SSE optimized functions.");
|
pa_log_info("Initialising SSE optimized functions.");
|
||||||
|
|
||||||
#ifdef RUN_TEST
|
#ifdef RUN_TEST
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue