On Wed, 27 Jun 2018 20:34:34 +0200, slava wrote:
Sorry, don't receive my own post, so can't reply
Find in alsa-lib-1.1.6 file src/pcm/pcm-params.c line 1945
static const snd_mask_t refine_masks[SND_PCM_HW_PARAM_LAST_MASK - SND_PCM_HW_PARAM_FIRST_MASK + 1] = { [SND_PCM_HW_PARAM_ACCESS - SND_PCM_HW_PARAM_FIRST_MASK] = { .bits = { 0x1f }, }, [SND_PCM_HW_PARAM_FORMAT - SND_PCM_HW_PARAM_FIRST_MASK] = { .bits = { 0x81ffffff, 0xfff},
Change last 0xfff to 0xfffff and now can use DSD formats
How i understand, in version 1.0.27 last format = 43 and when new format was added but mask not changed
May be i absolutely wrong and what i do has side effects or needed any else?
That's the correct observation, the needed bits are missing.
We should have listed each bit explicitly to avoid such an overlook from the beginning.
Below is the fix patch. Could you check whether it works as expected?
thanks,
Takashi
-- 8< -- From: Takashi Iwai tiwai@suse.de Subject: [PATCH] pcm: Define refine mask bits explicitly (and fix missing DSD support)
Instead of the expanded bit numbers like 0x81ffffff, list up the all supported PCM bits explicitly for refine_masks[] in pcm_params.c. This makes easier to update any additional formats or other parameters, and easier to spot out missing ones.
Actually the GSM and DSD formats were missing; with this commit, they are supported properly now.
Signed-off-by: Takashi Iwai tiwai@suse.de --- src/pcm/pcm_params.c | 70 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 3 deletions(-)
diff --git a/src/pcm/pcm_params.c b/src/pcm/pcm_params.c index 608a2324cb26..8826bc3d3197 100644 --- a/src/pcm/pcm_params.c +++ b/src/pcm/pcm_params.c @@ -1936,16 +1936,80 @@ static const snd_pcm_hw_rule_t refine_rules[] = { };
#define RULES (sizeof(refine_rules) / sizeof(refine_rules[0])) +#define PCM_BIT(x) \ + (1U << ((x) < 32 ? (x) : ((x) - 32)))
static const snd_mask_t refine_masks[SND_PCM_HW_PARAM_LAST_MASK - SND_PCM_HW_PARAM_FIRST_MASK + 1] = { [SND_PCM_HW_PARAM_ACCESS - SND_PCM_HW_PARAM_FIRST_MASK] = { - .bits = { 0x1f }, + .bits = { + PCM_BIT(SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) | + PCM_BIT(SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED) | + PCM_BIT(SNDRV_PCM_ACCESS_MMAP_COMPLEX) | + PCM_BIT(SNDRV_PCM_ACCESS_RW_INTERLEAVED) | + PCM_BIT(SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) + }, }, [SND_PCM_HW_PARAM_FORMAT - SND_PCM_HW_PARAM_FIRST_MASK] = { - .bits = { 0x81ffffff, 0xfff}, + .bits = { + /* first 32bits */ + PCM_BIT(SNDRV_PCM_FORMAT_S8) | + PCM_BIT(SNDRV_PCM_FORMAT_U8) | + PCM_BIT(SNDRV_PCM_FORMAT_S16_LE) | + PCM_BIT(SNDRV_PCM_FORMAT_S16_BE) | + PCM_BIT(SNDRV_PCM_FORMAT_U16_LE) | + PCM_BIT(SNDRV_PCM_FORMAT_U16_BE) | + PCM_BIT(SNDRV_PCM_FORMAT_S24_LE) | + PCM_BIT(SNDRV_PCM_FORMAT_S24_BE) | + PCM_BIT(SNDRV_PCM_FORMAT_U24_LE) | + PCM_BIT(SNDRV_PCM_FORMAT_U24_BE) | + PCM_BIT(SNDRV_PCM_FORMAT_S32_LE) | + PCM_BIT(SNDRV_PCM_FORMAT_S32_BE) | + PCM_BIT(SNDRV_PCM_FORMAT_U32_LE) | + PCM_BIT(SNDRV_PCM_FORMAT_U32_BE) | + PCM_BIT(SNDRV_PCM_FORMAT_FLOAT_LE) | + PCM_BIT(SNDRV_PCM_FORMAT_FLOAT_BE) | + PCM_BIT(SNDRV_PCM_FORMAT_FLOAT64_LE) | + PCM_BIT(SNDRV_PCM_FORMAT_FLOAT64_BE) | + PCM_BIT(SNDRV_PCM_FORMAT_IEC958_SUBFRAME) | + PCM_BIT(SNDRV_PCM_FORMAT_IEC958_SUBFRAME) | + PCM_BIT(SNDRV_PCM_FORMAT_MU_LAW) | + PCM_BIT(SNDRV_PCM_FORMAT_A_LAW) | + PCM_BIT(SNDRV_PCM_FORMAT_IMA_ADPCM) | + PCM_BIT(SNDRV_PCM_FORMAT_MPEG) | + PCM_BIT(SNDRV_PCM_FORMAT_GSM) | + PCM_BIT(SNDRV_PCM_FORMAT_S20_LE) | + PCM_BIT(SNDRV_PCM_FORMAT_S20_BE) | + PCM_BIT(SNDRV_PCM_FORMAT_U20_LE) | + PCM_BIT(SNDRV_PCM_FORMAT_U20_BE) | + PCM_BIT(SNDRV_PCM_FORMAT_SPECIAL), + /* second 32bits */ + PCM_BIT(SNDRV_PCM_FORMAT_S24_3LE) | + PCM_BIT(SNDRV_PCM_FORMAT_S24_3BE) | + PCM_BIT(SNDRV_PCM_FORMAT_U24_3LE) | + PCM_BIT(SNDRV_PCM_FORMAT_U24_3BE) | + PCM_BIT(SNDRV_PCM_FORMAT_S20_3LE) | + PCM_BIT(SNDRV_PCM_FORMAT_S20_3BE) | + PCM_BIT(SNDRV_PCM_FORMAT_U20_3LE) | + PCM_BIT(SNDRV_PCM_FORMAT_U20_3BE) | + PCM_BIT(SNDRV_PCM_FORMAT_S18_3LE) | + PCM_BIT(SNDRV_PCM_FORMAT_S18_3BE) | + PCM_BIT(SNDRV_PCM_FORMAT_U18_3LE) | + PCM_BIT(SNDRV_PCM_FORMAT_U18_3BE) | + PCM_BIT(SNDRV_PCM_FORMAT_G723_24) | + PCM_BIT(SNDRV_PCM_FORMAT_G723_24) | + PCM_BIT(SNDRV_PCM_FORMAT_G723_40) | + PCM_BIT(SNDRV_PCM_FORMAT_G723_40) | + PCM_BIT(SNDRV_PCM_FORMAT_DSD_U8) | + PCM_BIT(SNDRV_PCM_FORMAT_DSD_U16_LE) | + PCM_BIT(SNDRV_PCM_FORMAT_DSD_U32_LE) | + PCM_BIT(SNDRV_PCM_FORMAT_DSD_U16_BE) | + PCM_BIT(SNDRV_PCM_FORMAT_DSD_U32_BE) + }, }, [SND_PCM_HW_PARAM_SUBFORMAT - SND_PCM_HW_PARAM_FIRST_MASK] = { - .bits = { 0x1 }, + .bits = { + PCM_BIT(SNDRV_PCM_SUBFORMAT_STD) + }, }, };