mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-12 13:30:12 -05:00
Add support of little-endian on i386/x86_64 dmix
i386/x86_64 alsa-lib may need to handle big-endian formats, e.g. when running via qemu on PPC. The generic dmix code already has both endian support, so let's use it as fallback.
This commit is contained in:
parent
f49e5859fd
commit
267d7c7281
4 changed files with 79 additions and 54 deletions
|
|
@ -22,26 +22,37 @@
|
|||
#undef MIX_AREAS3
|
||||
#undef LOCK_PREFIX
|
||||
|
||||
static unsigned long long dmix_supported_format =
|
||||
(1ULL << SND_PCM_FORMAT_S16_LE) |
|
||||
(1ULL << SND_PCM_FORMAT_S32_LE) |
|
||||
(1ULL << SND_PCM_FORMAT_S24_3LE);
|
||||
#define x86_64_dmix_supported_format \
|
||||
((1ULL << SND_PCM_FORMAT_S16_LE) |\
|
||||
(1ULL << SND_PCM_FORMAT_S32_LE) |\
|
||||
(1ULL << SND_PCM_FORMAT_S24_3LE))
|
||||
|
||||
#define dmix_supported_format \
|
||||
(x86_64_dmix_supported_format | generic_dmix_supported_format)
|
||||
|
||||
static void mix_select_callbacks(snd_pcm_direct_t *dmix)
|
||||
{
|
||||
FILE *in;
|
||||
char line[255];
|
||||
int smp = 0;
|
||||
static int smp = 0;
|
||||
|
||||
/* try to determine, if we have SMP */
|
||||
in = fopen("/proc/cpuinfo", "r");
|
||||
if (in) {
|
||||
while (!feof(in)) {
|
||||
fgets(line, sizeof(line), in);
|
||||
if (!strncmp(line, "processor", 9))
|
||||
smp++;
|
||||
if (!((1ULL<< dmix->shmptr->s.format) & x86_64_dmix_supported_format)) {
|
||||
generic_mix_select_callbacks(dmix);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!smp) {
|
||||
FILE *in;
|
||||
char line[255];
|
||||
|
||||
/* try to determine, if we have SMP */
|
||||
in = fopen("/proc/cpuinfo", "r");
|
||||
if (in) {
|
||||
while (!feof(in)) {
|
||||
fgets(line, sizeof(line), in);
|
||||
if (!strncmp(line, "processor", 9))
|
||||
smp++;
|
||||
}
|
||||
fclose(in);
|
||||
}
|
||||
fclose(in);
|
||||
}
|
||||
// printf("SMP: %i\n", smp);
|
||||
dmix->u.dmix.mix_areas1 = smp > 1 ? mix_areas1_smp : mix_areas1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue