All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Alexander E. Patrakov" <patrakov@gmail.com>
Cc: Raymond Yau <superquad.vortex2@gmail.com>,
	ALSA Development Mailing List <alsa-devel@alsa-project.org>,
	Clemens Ladisch <clemens@ladisch.de>,
	David Henningsson <david.henningsson@canonical.com>,
	Takashi Sakamoto <o-takashi@sakamocchi.jp>
Subject: Re: Master Plan on rewinding
Date: Mon, 15 Sep 2014 12:08:12 +0200	[thread overview]
Message-ID: <s5hd2axw60j.wl-tiwai@suse.de> (raw)
In-Reply-To: <5416B852.6080406@gmail.com>

At Mon, 15 Sep 2014 15:58:42 +0600,
Alexander E. Patrakov wrote:
> 
> 15.09.2014 15:19, Takashi Iwai wrote:
> > At Sun, 14 Sep 2014 18:07:23 +0600,
> > Alexander E. Patrakov wrote:
> >>
> >> 14.09.2014 17:37, Raymond Yau wrote:
> >>>
> >>>   >
> >>>   >
> >>>   >> === On the rewind safeguard ===
> >>>   >
> >>>   >
> >>>   > Result 1: it has been decided that the return value of
> >>> snd_pcm_rewindable() is not changed, and the safeguard is returned by a
> >>> separate function.
> >>>
> >>> It is unlikely to return any value which is safe, it is the
> >>> responsiability of the application to decide how much can be rewind
> >>
> >> You are placing a responsibility on an application without giving it any
> >> means to make an informed decision. E.g. 4 ms is OK on snd-hda-intel,
> >> but definitely not OK on ymfpci even on infinitely fast CPU (because of
> >> the fixed 5 ms interrupt interval). The whole question here is: how is
> >> an application supposed to know that?
> >
> > Well, maybe the word "safeguard" is somewhat confusing to be used as
> > a driver API.  There is no "safety" at all there.  There is only
> > "theoretically minimal" (and it often lies even if the hardware chip
> > says so).  How much value to be taken as "safeguard" is rather a
> > choice by each application or sound backend.
> 
> I agree with this "bad wording" remark. Let's talk about the 
> "theoretically minimal non-rewindable amount of samples" from now on.
> 
> > Right now, the only information we give from the sound driver is
> > INFO_BATCH flag.  And I agree with a bit more detailed information to
> > be exposed from the driver -- but only if possible.  This must be an
> > optional information and not mandatory.
> 
> Here I mostly agree.
> 
> Indeed, this INFO_BATCH flag exists. However, its documentation is so 
> vague that IMHO a documentation patch is needed to legitimize its use as 
> a "you must not leave less than one period when rewinding" indicator. 
> Also, the documentation says about snd_pcm_hw_params_is_batch(): "This 
> function should only be called when the configuration space contains a 
> single configuration" - I believe that it is an error (and PulseAudio 
> calls it without obeying this restriction), because this function is 
> helpful exactly for choosing hardware parameters such as period size. 
> May I write "if the configuration space contains more than one 
> configuration, the result indicates whether a configuration exists where 
> such double-buffering is done"? Also the documentation talks about 
> "hardware", should I extend it to the whole plugin chain?

The whole hw_params_*() descriptions are something like bot-style
tweets, we need a bit better texts there :)

The batch parameter was (and partly is) indeed very ambiguous.  Its
usage has been materialized a few years ago.

> As for the desire to export other information if available, it is 
> certainly good.
> 
> What remains not fully understood for me is the claim that the 
> information already exposed by every driver (in the form of the minimal 
> period size) is not useful. I understand that two people are against 
> this idea, so it must be bad. But I must understand why. Is it because 
> the minimum period size reported by some drivers (which ones are 
> suspected, if any?) may be a lie?

A kind of yes.  Many drivers, especially the old ones, set the minimal
period size without actually knowing the real limit.  It tends to be
smaller than the hardware really supports.  This is, in most cases, 
just because no hardware spec defines that.  So, it can't be blindly
taken as the bottom line, unfortunately.  That's why I suggested the
new field would be optional; we simply don't know the value.


Takashi

> Clemens Ladisch mentioned USB as a counterexample, but it is a batch 
> device for which the current period size is more relevant than the 
> minimal one. Pierre-Louis Bossart just said that it is "really asking 
> for trouble" without much explanation.
> 
> Can anyone name a sound controller that is not of a batch variety, where 
> the theoretically minimal non-rewindable amount of samples is, at some 
> settings, higher than the reported minimum period size at the same 
> number of channels, sample rate and sample format?
> 
> [and yes, I understand that I can always cheat and say: let's change the 
> definition of INFO_BATCH so that it includes such cases]
> 
> -- 
> Alexander E. Patrakov
> 

  reply	other threads:[~2014-09-15 10:08 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-07 15:16 Master Plan on rewinding Alexander E. Patrakov
2014-09-07 18:38 ` Tanu Kaskinen
2014-09-07 19:05   ` Alexander E. Patrakov
2014-09-07 20:51 ` Clemens Ladisch
2014-09-08  3:06   ` Raymond Yau
2014-09-08  7:31   ` Alexander E. Patrakov
2014-09-09  8:43     ` Clemens Ladisch
2014-09-09  8:55       ` Alexander E. Patrakov
2014-09-09  9:08         ` David Henningsson
2014-09-09  9:31           ` Alexander E. Patrakov
2014-09-21  2:02             ` Raymond Yau
2014-09-22 13:20               ` Lars-Peter Clausen
2014-09-22 13:36                 ` Alexander E. Patrakov
2014-09-22 13:44                   ` Lars-Peter Clausen
2014-09-23  8:29                   ` Raymond Yau
2014-09-23 10:22                     ` Alexander E. Patrakov
2014-09-09 13:45         ` Clemens Ladisch
2014-09-09 15:55           ` Alexander E. Patrakov
2014-09-09 16:09             ` Takashi Iwai
2014-09-07 23:12 ` David Henningsson
2014-09-09 19:56   ` Pierre-Louis Bossart
2014-09-10  5:38     ` Alexander E. Patrakov
2014-09-08  7:34 ` Lars-Peter Clausen
2014-09-08  7:59 ` David Henningsson
2014-09-08  8:46   ` Alexander E. Patrakov
2014-09-08  9:26     ` David Henningsson
2014-09-08 10:21       ` Alexander E. Patrakov
2014-09-09  8:43         ` Clemens Ladisch
2014-09-11  3:49 ` Raymond Yau
2014-09-11  4:19   ` A. C. Censi
2014-09-13  9:15     ` Raymond Yau
2014-09-11  5:28   ` Alexander E. Patrakov
2014-09-11  6:21     ` Raymond Yau
2014-09-13  8:57     ` Raymond Yau
2014-09-13 10:43       ` Alexander E. Patrakov
2014-09-13 11:33         ` Raymond Yau
2014-09-13 11:36           ` Alexander E. Patrakov
2014-09-13 18:35 ` Alexander E. Patrakov
2014-09-14 11:37   ` Raymond Yau
2014-09-14 12:07     ` Alexander E. Patrakov
2014-09-15  2:43       ` Raymond Yau
2014-09-15  9:19       ` Takashi Iwai
2014-09-15  9:58         ` Alexander E. Patrakov
2014-09-15 10:08           ` Takashi Iwai [this message]
2014-09-15 17:01             ` Pierre-Louis Bossart
2014-09-15 17:14               ` Alexander E. Patrakov
2014-09-15 18:08                 ` Takashi Iwai
2014-09-18  1:15                   ` Raymond Yau
2014-09-21  9:22                     ` Alexander E. Patrakov
2014-09-21  9:53                     ` Clemens Ladisch
2014-09-21 10:56                       ` Alexander E. Patrakov
2014-09-22  3:27                       ` Raymond Yau

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=s5hd2axw60j.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=david.henningsson@canonical.com \
    --cc=o-takashi@sakamocchi.jp \
    --cc=patrakov@gmail.com \
    --cc=superquad.vortex2@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 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.