Re: (re)use and (re)definition of snd_pcm_hw_params->fifo_size for 'jumpy DMA'

Péter Ujfalusi
2026-03-24T13:26:32Z

On 24/03/2026 12:51, Péter Ujfalusi wrote:
> The question is: is it enough to only have single value exposed or do we
> need/want add all small variations of this to be exposed?
> I would think that a single dma_fifo_size should be OK and apps should
> prepare for the crawling DMA case.
>
>> But if we agree on other name like 'burst_size' or 'batch_size', I'll be
>> fine with it, too.
>
> I think neither of these are right, unless we substitute them with a
> variable which tells the size of the FIFO in hardware that is going to
> be filled.
> max_hw_ptr_burst_size or max_dma_burst_size or max_burst_size - in frames?

something like this in kernel and then we need alsa-lib update and then we can introduce the use in pipewire?

diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index d3ce75ba938a..3a1872b3e701 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -421,7 +421,8 @@ struct snd_pcm_hw_params {
unsigned int rate_den; /* R: rate denominator */
snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
unsigned char sync[16]; /* R: synchronization ID (perfect sync - one clock source) */
- unsigned char reserved[48]; /* reserved for future */
+ snd_pcm_uframes_t max_dma_burst_size; /* R: maximum DMA burst size in frames */
+ unsigned char reserved[48 - sizeof(snd_pcm_uframes_t)]; /* reserved for future */
};

enum {
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index e71f393d3b01..462588f3527b 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -64,7 +64,9 @@ struct snd_pcm_hw_params32 {
u32 rate_num;
u32 rate_den;
u32 fifo_size;
- unsigned char reserved[64];
+ unsigned char sync[16];
+ u32 max_dma_burst_size;
+ unsigned char reserved[44];
};

struct snd_pcm_sw_params32 {
@@ -247,9 +249,11 @@ static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream,
if (!data)
return -ENOMEM;

- /* only fifo_size (RO from userspace) is different, so just copy all */
+ /* copy common members and fix up 32-bit uframe fields explicitly */
if (copy_from_user(data, data32, sizeof(*data32)))
return -EFAULT;
+ data->fifo_size = data32->fifo_size;
+ data->max_dma_burst_size = data32->max_dma_burst_size;

if (refine) {
err = snd_pcm_hw_refine(substream, data);
@@ -262,7 +266,8 @@ static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream,
if (err < 0)
return err;
if (copy_to_user(data32, data, sizeof(*data32)) ||
- put_user(data->fifo_size, &data32->fifo_size))
+ put_user(data->fifo_size, &data32->fifo_size) ||
+ put_user(data->max_dma_burst_size, &data32->max_dma_burst_size))
return -EFAULT;

if (! refine) {

--
Péter