Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1535950

Re: [PATCH 2/3 v2] ALSA: usb-audio: avoid setting of sample rate multiple times on bus

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Takashi Sakamoto <o-takashi@sakamocchi.jp>
Newsgroups linux.kernel
Subject Re: [PATCH 2/3 v2] ALSA: usb-audio: avoid setting of sample rate multiple times on bus
Date Mon, 05 Dec 2016 11:00:02 +0100
Message-ID <sKYdY-2SD-11@gated-at.bofh.it> (permalink)
References <sJ7Y6-3eC-3@gated-at.bofh.it> <sJ7Y6-3eC-17@gated-at.bofh.it> <sJaCB-4Za-11@gated-at.bofh.it> <sKW2t-1wo-1@gated-at.bofh.it>
X-Original-To Jiada Wang <jiada_wang@mentor.com>
X-Virus-Status clean(LOLIPOP-Fsecure)
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1
MIME-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 52
Organization linux.* mail to news gateway
X-Original-Cc perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, apape@de.adit-jv.com, linux-kernel@vger.kernel.org, Mark_Craske@mentor.com
X-Original-Date Mon, 5 Dec 2016 18:58:09 +0900
X-Original-Message-ID <120588a7-e7a7-bf8e-4e5d-c89f2fbe8563@sakamocchi.jp>
X-Original-References <20161130075923.15205-1-jiada_wang@mentor.com> <20161130075923.15205-3-jiada_wang@mentor.com> <c4579c3f-4798-7096-2c05-b0670ccbad08@sakamocchi.jp> <58451823.8040207@mentor.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1535950

Show key headers only | View raw


On Dec 5 2016 16:32, Jiada Wang wrote:
> Hi Sakamoto
>
> On 11/30/2016 02:45 AM, Takashi Sakamoto wrote:
>> Hi Jiada,
>>
>> I don't oppose this patch. Nevertheless, your description is not
>> necessarily correct.
>>
>> On Nov 30 2016 16:59, Jiada Wang wrote:
>>> From: Daniel Girnus <dgirnus@de.adit-jv.com>
>>>
>>> ALSA usually calls the prepare function twice before starting the
>>> playback:
>>> 1. On hw_params call from userland and
>>> 2. internally when starting the stream.
>>
>> ALSA PCM core in kernel land doesn't perform like this.
>>
>> In alsa-lib, 'snd_pcm_hw_params()' calls
>> 'snd_pcm_hw_params_internal()' and 'snd_pcm_prepare()' sequentially.
>> http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/pcm/pcm.c;h=cd87bc759ded95953e332b7e8d56b0f2d5b4185d;hb=HEAD#l853
>>
>>
>> In system call level (e.g. see by strace(1)), this looks like two
>> ioctl(2)s with 'SNDRV_PCM_IOCTL_HW_PARAMS' and 'SNDRV_PCM_IOCTL_PREPARE'.
>>
>> Well, when applications are written to execute 'snd_pcm_hw_params()'
>> and 'snd_pcm_hw_prepare()' sequentially, additional ioctl(2) with
>> 'SNDRV_PCM_IOCTL_PREPARE' appears. PulseAudio is this kind of
>> application. I indicated the useless in 2014, but it still remains:
>> https://lists.freedesktop.org/archives/pulseaudio-discuss/2014-January/019773.html
>>
>>
>> You have the misunderstanding due to a nature of alsa-lib and tendency
>> of major applications, from my point of view.
>>
> Thanks for your indication, so because some of userland applications
> call 'snd_pcm_hw_params()' and
> 'snd_pcm_hw_prepare()' sequentially, means the second
> 'SNDRV_PCM_IOCTL_PREPARE' be called in 'SNDRV_PCM_STATE_PREPARED' state,

Exactly. Furthermore, ALSA PCM core has no code to call .prepare() in 
contexts unrelated to SNDRV_PCM_IOCTL_PREPARE.

> some devices are unable to manage this and stop working.
> I will update Changelog in v2 Patchset.


Regards

Takashi Sakamoto

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 2/3 v2] ALSA: usb-audio: avoid setting of sample rate multiple times on bus Jiada Wang <jiada_wang@mentor.com> - 2016-11-30 09:00 +0100
  Re: [PATCH 2/3 v2] ALSA: usb-audio: avoid setting of sample rate multiple times on bus Takashi Iwai <tiwai@suse.de> - 2016-11-30 10:00 +0100
    Re: [PATCH 2/3 v2] ALSA: usb-audio: avoid setting of sample rate  multiple times on bus Jiada Wang <jiada_wang@mentor.com> - 2016-12-01 08:10 +0100
  Re: [PATCH 2/3 v2] ALSA: usb-audio: avoid setting of sample rate  multiple times on bus Takashi Sakamoto <o-takashi@sakamocchi.jp> - 2016-11-30 11:50 +0100
    Re: [PATCH 2/3 v2] ALSA: usb-audio: avoid setting of sample rate  multiple times on bus Takashi Sakamoto <o-takashi@sakamocchi.jp> - 2016-11-30 23:30 +0100
    Re: [PATCH 2/3 v2] ALSA: usb-audio: avoid setting of sample rate  multiple times on bus Jiada Wang <jiada_wang@mentor.com> - 2016-12-05 08:40 +0100
      Re: [PATCH 2/3 v2] ALSA: usb-audio: avoid setting of sample rate  multiple times on bus Takashi Sakamoto <o-takashi@sakamocchi.jp> - 2016-12-05 11:00 +0100

csiph-web