Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E928C43457 for ; Mon, 12 Oct 2020 13:56:43 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B435A2080D for ; Mon, 12 Oct 2020 13:56:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="PN4ArJtT"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="twYuSxSQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B435A2080D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 02FD9168D; Mon, 12 Oct 2020 15:55:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 02FD9168D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1602511001; bh=FubpnLLFZpyrtWKaNAf6luZJjhmgdkokyFBtkUEkBrU=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=PN4ArJtTO9FZ7G4oBQks7h6gxzegM7i49y8N66zwjN0h7JyG4IdIazmQZT0ZVMzUH LcTeehv1bjWzyPsdEVnd84/bllrQkvbecQFuGh/HnWs+7K6DIh9ECZLCizm4RJxjzV /uxMdx5YlbEARoyte46wS2gx8ZduexRPKGw4jiB8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5DAD1F8021D; Mon, 12 Oct 2020 15:55:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6D57AF80224; Mon, 12 Oct 2020 15:55:49 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C72CBF800D8 for ; Mon, 12 Oct 2020 15:55:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C72CBF800D8 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="twYuSxSQ" Received: from localhost (unknown [122.182.245.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5C2732074F; Mon, 12 Oct 2020 13:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510945; bh=FubpnLLFZpyrtWKaNAf6luZJjhmgdkokyFBtkUEkBrU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=twYuSxSQWm23maTQitdNI7Ma2klvfl7thuUMDTrzV5kfYBJKegnIXdoMIDZ+YWW7h U735P0/4ig4LXl/GsA4FT1PbIQIxOMFXPzmGwfkc4YQaTPm1GnpG5mntVhG+YxyWcC BEH0XnY2gwpQ5LD8vL4Ly6j6dVWYrWqRPZQAGRfA= Date: Mon, 12 Oct 2020 19:25:40 +0530 From: Vinod Koul To: Jaroslav Kysela Subject: Re: [PATCH] ALSA: compress: allow pause and resume during draining Message-ID: <20201012135540.GK2968@vkoul-mobl> References: <20201006062105.GQ2968@vkoul-mobl> <4bbc385b-d35a-8766-7981-034455287225@linux.intel.com> <000d01d69d58$4e2db6f0$ea8924d0$@samsung.com> <831bbfcf-9720-9100-8633-65932b415cab@perex.cz> <20201012052525.GH2968@vkoul-mobl> <20201012122423.GJ2968@vkoul-mobl> <5b26cdd5-8a15-fa26-86af-13bfbfad5341@perex.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5b26cdd5-8a15-fa26-86af-13bfbfad5341@perex.cz> Cc: alsa-devel@alsa-project.org, khw0178.kim@samsung.com, lgirdwood@gmail.com, Takashi Iwai , s47.kang@samsung.com, tiwai@suse.com, 'Pierre-Louis Bossart' , kimty@samsung.com, hmseo@samsung.com, Gyeongtaek Lee , pilsun.jang@samsung.com, tkjung@samsung.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On 12-10-20, 15:29, Jaroslav Kysela wrote: > Dne 12. 10. 20 v 14:24 Vinod Koul napsal(a): > > On 12-10-20, 09:01, Takashi Iwai wrote: > >> On Mon, 12 Oct 2020 07:25:25 +0200, > > > >>> So what if we add another state but keep it in kernel (hidden from > >>> userspace)...? > >> > >> That's fine, then it's just a kernel's business, and it should be > >> determined which one makes the code better. > >> > >> But, there are things to be considered, though: > >> > >> - SNDRV_PCM_STATE_* is defined as snd_pcm_state_t with __bitwise. > >> This indicates that the type has to be defined in that way > >> explicitly. > >> > >> - Having a value over SNDRV_PCM_STATE_LAST internally is hackish. > >> > >>> Right now tinycompress does not make use of PCM streams, kernel handles > >>> these. I am not aware of any other implementation. > >>> > >>> So if the scope if within compress then it might work... > >> > >> Yes. But currently the API uses SND_PCM_* even for the compress > >> stuff. Changing this value means to have influence on PCM, even if > >> PCM stuff doesn't use it yet. (At least you'd need to increase > >> SND_PCM_STATE_LAST, for example.) > >> > >> That said, if we want to change only for compress API by assuming that > >> the impact must be negligible, the first step would be to move from > >> SND_PCM_STATE_* to the own state, SND_COMPRESS_STATE_*. The values > >> should be compatible, but this has to be changed at first. Then you > >> can introduce a new value there. > > > > I think that sounds reasonable to me, we should not have used > > SNDRV_PCM_STATE_* in the first place and long term fix for this should > > be SNDRV_COMPRESS_STATE_ > > > > I will cook a patch for this > > Although the impact is not high, I do think that we should enable the new > behaviour conditionally (when the user space asks for it) even if the state > values are split. I think that the whole thread is about 'how to extend the > current APIs'. The hidden way is really not so nice. > > Unfortunately, there are no reserved fields in the snd_compr_params structure > for this, but I see the similarity with the 'no_wake_mode' field which > controls the driver behaviour. I was not really thinking of exporting the states to userspace. Tinycompress does not use it, I do not see any uses of it to enable userspace with it.. Do you think it should be exposed? If so why..? Worst case we add an ioctl to query the state.. the state transitions are anyway result of control ops on the stream Btw what was the motivation for pcm to expose the stream states..? -- ~Vinod