All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Sriram Periyasamy <sriramx.periyasamy@intel.com>
Cc: ALSA ML <alsa-devel@alsa-project.org>,
	Vinod Koul <vinod.koul@intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Ramesh Babu <ramesh.babu@intel.com>,
	Takashi Sakamoto <o-takashi@sakamocchi.jp>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Patches Audio <patches.audio@intel.com>,
	Mark Brown <broonie@kernel.org>,
	"Subhransu S . Prusty" <subhransu.s.prusty@intel.com>
Subject: Re: [RESEND][PATCH v4 1/3] ALSA: core: let low-level driver or userspace disable rewinds
Date: Sun, 25 Mar 2018 16:58:58 +0200	[thread overview]
Message-ID: <s5h1sg88aml.wl-tiwai@suse.de> (raw)
In-Reply-To: <20180325104643.GA13721@intel.com>

On Sun, 25 Mar 2018 12:46:43 +0200,
Sriram Periyasamy wrote:
> 
> On Tue, Mar 20, 2018 at 05:17:35PM +0100, Takashi Iwai wrote:
> > On Tue, 20 Mar 2018 17:01:06 +0100,
> > Sriram Periyasamy wrote:
> > > 
> > > From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> > > 
> > > Add new hw_params flag to explicitly tell driver that rewinds will never
> > > be used. This can be used by low-level driver to optimize DMA operations
> > > and reduce power consumption. Use this flag only when data written in
> > > ring buffer will never be invalidated, e.g. any update of appl_ptr is
> > > final.
> > > 
> > > Note that the update of appl_ptr include both a read/write data
> > > operation as well as snd_pcm_forward() whose behavior is not modified.
> > > 
> > > Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> > > Signed-off-by: Ramesh Babu <ramesh.babu@intel.com>
> > > Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
> > > Signed-off-by: Sriram Periyasamy <sriramx.periyasamy@intel.com>
> > 
> > Well, I'm still not convinced with this flag.
> > 
> > First off, does it really need to be per PCM stream?  The introducing
> 
> Flag per PCM stream helps where each stream in given system may have
> different requirement such as low power or low latency based on the
> use case. For example in case of low power stream, driver can perform
> required optimizations at hardware level based on the no_rewind flag.

Yes, but does it really need to be PCM stream, i.e. per application?
Certainly the system will be using some sound backend (like PA).  In
which scenario can such behavior change -- some application uses a
different backend on a phone or a tablet?


> > something to hw_parms implies that it varies per application.  But I
> > can't imagine that a system requires different behavior per stream
> > regarding such a thing.
> > 
> > Second, the driver can implement a check in PCM ack callback to
> > prevent the rewind, too.  Then there is no need to touch the PCM
> > core.
> > 
> 
> As per the previous discussion at [1],
> 
> [1]
> https://patchwork.kernel.org/patch/9795233/
> 
> from Pierre,
> 
> "The application (which is in most cases an audio server) *knows* if it
> requires rewinds or not. It's part of its design, with rewinds typically
> disabled if period interrupts are required. It's been that way for a
> number of years now. The use of rewinds is typically associated with the
> combination of a large buffer and no interrupts (having either of the
> two would not require rewinds).
> 
> So the idea is that the application makes a statement that rewinds will
> not be used, and the low-level driver makes use of the information to
> enable whatever optimizations are available at the hardware level.
> 
> Exposing more information to userspace would quickly lead to a confusing
> decision-making and would require more than just a flag."

And, requiring *that* information is already confusing, IMO.
Think from the application writer POV: what is the relation between
the power-saving and no_rewind behavior in application level at all?
If you have no idea about the hardware details, they are totally
irrelevant.

Or, think like this way: imagine a hardware that requires a different
constraint, e.g. the power-of-two buffer size, for power-efficient
operation.  What would you do?  Adding a new power_of_two bit flag
into hw_params?  Likely not.

In such a case, I would expect some operation mode switch
(e.g. power-saving vs low latency or whatever) instead of a very
specific hw_parmas flag.  It might be a module option, via ALSA
control, or something else.  But it's clearer for which purpose it's
present, at least, and it can be implemented well without changing the
existing API.


thanks,

Takashi

  reply	other threads:[~2018-03-25 14:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 16:01 [RESEND][PATCH v4 0/3] Add SPIB Support for Intel Skylake platforms Sriram Periyasamy
2018-03-20 16:01 ` [RESEND][PATCH v4 1/3] ALSA: core: let low-level driver or userspace disable rewinds Sriram Periyasamy
2018-03-20 16:17   ` Takashi Iwai
2018-03-25 10:46     ` Sriram Periyasamy
2018-03-25 14:58       ` Takashi Iwai [this message]
2018-03-28 14:30         ` Pierre-Louis Bossart
2018-03-28 15:20           ` Takashi Iwai
2018-03-28 17:58             ` Pierre-Louis Bossart
2018-03-28 18:35               ` Takashi Iwai
2018-03-28 19:50                 ` Pierre-Louis Bossart
2018-03-28 21:09                   ` Takashi Iwai
2018-03-28 21:51                     ` Pierre-Louis Bossart
2018-03-29 15:42                       ` Takashi Iwai
2018-03-29 19:16                         ` Pierre-Louis Bossart
2018-03-29 20:10                           ` Takashi Iwai
2018-03-29 21:40                             ` Pierre-Louis Bossart
2018-03-20 16:01 ` [RESEND][PATCH v4 2/3] ALSA: hda: ext: add spib to stream context Sriram Periyasamy
2018-03-20 16:01 ` [RESEND][PATCH v4 3/3] ASoC: Intel: Skylake: Add support for spib mode Sriram Periyasamy
2018-03-21  1:34 ` [RESEND][PATCH v4 0/3] Add SPIB Support for Intel Skylake platforms Mark Brown

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=s5h1sg88aml.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=o-takashi@sakamocchi.jp \
    --cc=patches.audio@intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ramesh.babu@intel.com \
    --cc=sriramx.periyasamy@intel.com \
    --cc=subhransu.s.prusty@intel.com \
    --cc=vinod.koul@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.