public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: "Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>
Cc: Takashi Iwai <tiwai@suse.com>, Mark Brown <broonie@kernel.org>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Linux-ALSA <alsa-devel@alsa-project.org>,
	"linux-sound@vger.kernel.org" <linux-sound@vger.kernel.org>,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	arun@asymptotic.io, wim.taymans@gmail.com
Subject: Re: (re)use and (re)definition of snd_pcm_hw_params->fifo_size for 'jumpy DMA'
Date: Tue, 14 Apr 2026 16:47:49 +0300	[thread overview]
Message-ID: <401a7777-e83c-4120-9d82-71388bf38397@linux.intel.com> (raw)
In-Reply-To: <39fcca55-77f4-4cd9-8a94-d80e5b94c8ba@perex.cz>



On 14/04/2026 14:14, Jaroslav Kysela wrote:
> On 4/14/26 12:44, Péter Ujfalusi wrote:
> 
>>> How you would like to handle this in an universal way?
>>
>> I think both could be handled by driver provided init_chunk and
>> step_chunk value:
> I don't think so. Actually, sound servers set relatively "big" period
> sizes and expect the lower transfer granularity.

yes, this is what they do.

> The "latency" request must come from application.

Fair point, although the PCM device could advertise that I'm 'jumpy' so
application can check how it will behave.

I also have hard time applying the term 'latency' on this as the aim is
not to introduce latency, but to increase power saving which do causes
increased latency by design.
I can increase latency easily without any power saving benefit by using
big buffer and still streaming constantly into it from ALSA buffer -
let's say for running *trendy-two-letter-word* algorithm on the audio.

I'm OK with latency of XYms with this stream does not imply that jumpy
DMA is also OK. Unless the two is tied by definition in documentation.

> If you read my last proposal, there are two new flags and one changes
> (clarifies) "period size" to be related to the expected (transfer)
> latency.

With my 'simplified' view this is also possible, but the driver tells
(via a flag in snd_pcm_hardware.info) the application that on the device
the period size will relate to jumpy-DMA, please check back how this
will affect you after you set you buffers.

> So, the current (inaccurate - driver specific) behavior won't
> change until application set this flag.

Sort of similar way how the SNDRV_PCM_INFO_NO_PERIOD_WAKEUP /
SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP is implemented?

I guess an implicit flag from user space would be good so that if the
hw_params flag is not set by applications then the FIFO is either
disabled or the PCM will work with minimal buffers - like in SOF the
default PCM.

> This extension allows us to do
> the full "refine" (handshake) between application and kernel to settle
> the transfer details with the slightly updated framework. Also, this
> flag will activate init_periods and step_periods fields. Basically, the
> app will set the maximal acceptable period size (expected latency = 2 *
> period size) and the driver will return first biggest period size
> depending on driver constraints (initial periods will be included - in
> this case the period size must be lowered to maintain the requested
> latency). It's the complete handshake.

My main problem with this is that I cannot reply to application which
say that I can accept up to XYms latency.
I don't know the latency in here, it depends on the DSP topology that
has been loaded, what I can know is how the host side hw_ptr will behave.
Sure, that translates to a 'latency' It will add maximum of FIFO size
latency , but this FIFO size is not equal to the initial burst size in
some cases, if the FIFO size is small then we will overshoot with hw_ptr.

This is why I try to see this from a power or race to idle point of view.
It is sort of I'm OK to not touch data right on front of the hw_ptr
because I know that initially the DMA will move about this far and then
at every Zms it will move Zms ahead - which I can actually monitor via
the PCM delay.

> I just miss this handshake in your proposal and scratching my head why
> we cannot use period sizes for this, because (as explained) it was the
> base transfer block when the API was designed.

Yes, the handhsake was missing, let me think about this a bit more.

-- 
Péter


  reply	other threads:[~2026-04-14 13:48 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 13:34 (re)use and (re)definition of snd_pcm_hw_params->fifo_size for 'jumpy DMA' Péter Ujfalusi
2026-03-23 14:54 ` Jaroslav Kysela
2026-03-23 16:16   ` Péter Ujfalusi
2026-03-24  8:58     ` Jaroslav Kysela
2026-03-24 10:51       ` Péter Ujfalusi
2026-03-24 13:25         ` Péter Ujfalusi
2026-03-24 15:48         ` Jaroslav Kysela
2026-03-25 13:28           ` Péter Ujfalusi
2026-03-25 14:08             ` Jaroslav Kysela
2026-03-26 12:04               ` Péter Ujfalusi
2026-03-24  7:12 ` Péter Ujfalusi
2026-03-30 14:27 ` Takashi Iwai
2026-03-30 15:15   ` Péter Ujfalusi
2026-03-30 16:39     ` Takashi Iwai
2026-03-31  6:00       ` Péter Ujfalusi
2026-03-31  6:36         ` Takashi Iwai
2026-03-31  9:29           ` Jaroslav Kysela
2026-03-31 10:42             ` Kai Vehmanen
2026-03-31 10:56             ` Péter Ujfalusi
2026-03-31 12:00               ` Jaroslav Kysela
2026-03-31 14:09                 ` Péter Ujfalusi
2026-04-02 12:01                   ` Jaroslav Kysela
2026-04-07 11:59                     ` Péter Ujfalusi
2026-04-07 13:50                       ` Jaroslav Kysela
2026-04-14 10:44                         ` Péter Ujfalusi
2026-04-14 11:14                           ` Jaroslav Kysela
2026-04-14 13:47                             ` Péter Ujfalusi [this message]
2026-04-14 17:23                               ` Jaroslav Kysela
2026-03-31 11:19           ` Péter Ujfalusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=401a7777-e83c-4120-9d82-71388bf38397@linux.intel.com \
    --to=peter.ujfalusi@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arun@asymptotic.io \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=tiwai@suse.de \
    --cc=wim.taymans@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox