From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 7C941C352A3 for ; Mon, 10 Feb 2020 15:24:26 +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 0000F2082F for ; Mon, 10 Feb 2020 15:24:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="TpXBPelH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0000F2082F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de 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 56EF91664; Mon, 10 Feb 2020 16:23:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 56EF91664 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1581348264; bh=FJq0c2Fmf78QTsPjF6JzzdeyXko+x5sUVZbI/tOUZMg=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=TpXBPelHSCa3+jF+IXD5sfYedl1DDsWYXy9XyEoexH0pWSHw58vYgjY/Ybsvl11Pb U1WA9qxpULE24Gsar6TPfExKMa3s9M9uaZTJ0Z+Zc9csahnEmWUXGAoKoY6kMDFkLK uu6ntHziB6ajqy0i+zSGWaNXXnEqeEjG6i7qIaZg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D8296F8014F; Mon, 10 Feb 2020 16:23:33 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E1E6EF80157; Mon, 10 Feb 2020 16:23:32 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 528BEF80118 for ; Mon, 10 Feb 2020 16:23:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 528BEF80118 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 669F1B12A; Mon, 10 Feb 2020 15:23:29 +0000 (UTC) Date: Mon, 10 Feb 2020 16:23:29 +0100 Message-ID: From: Takashi Iwai To: Peter Ujfalusi In-Reply-To: <20200210151402.29634-1-peter.ujfalusi@ti.com> References: <20200210151402.29634-1-peter.ujfalusi@ti.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: alsa-devel@alsa-project.org, lars@metafoo.de, linux-kernel@vger.kernel.org, tiwai@suse.com, lgirdwood@gmail.com, vkoul@kernel.org, broonie@kernel.org Subject: Re: [alsa-devel] [PATCH v2] ALSA: dmaengine_pcm: Consider DMA cache caused delay in pointer callback 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Mon, 10 Feb 2020 16:14:02 +0100, Peter Ujfalusi wrote: > > Some DMA engines can have big FIFOs which adds to the latency. > The DMAengine framework can report the FIFO utilization in bytes. Use this > information for the delay reporting. > > Signed-off-by: Peter Ujfalusi > --- > Hi, > > Changes since v1: > - use bytes_to_frames() for the DMA delay calculation > - Drop changes to soc-pcm > > 5.6-rc1 now have support for reporting the DMA cached data. > With this patch we can include it to the delay calculation. > The first DMA driver which reports this is the TI K3 UDMA driver. > > Regards, > Peter > > sound/core/pcm_dmaengine.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c > index 5749a8a49784..d8be7b488162 100644 > --- a/sound/core/pcm_dmaengine.c > +++ b/sound/core/pcm_dmaengine.c > @@ -247,9 +247,14 @@ snd_pcm_uframes_t snd_dmaengine_pcm_pointer(struct snd_pcm_substream *substream) > > status = dmaengine_tx_status(prtd->dma_chan, prtd->cookie, &state); > if (status == DMA_IN_PROGRESS || status == DMA_PAUSED) { > + struct snd_pcm_runtime *runtime = substream->runtime; > + > buf_size = snd_pcm_lib_buffer_bytes(substream); > if (state.residue > 0 && state.residue <= buf_size) > pos = buf_size - state.residue; > + > + runtime->delay = bytes_to_frames(runtime, > + state.in_flight_bytes); Another call of bytes_to_frames() below... > } > > return bytes_to_frames(substream->runtime, pos); ... refers to substream->runtime. Better to align both places, either runtime or substream->runtime. With that minor nitpick, the change looks good: Reviewed-by: Takashi Iwai thanks, Takashi _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 5BD82C352A3 for ; Mon, 10 Feb 2020 15:23:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 334DD2085B for ; Mon, 10 Feb 2020 15:23:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727915AbgBJPXb (ORCPT ); Mon, 10 Feb 2020 10:23:31 -0500 Received: from mx2.suse.de ([195.135.220.15]:40708 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbgBJPXb (ORCPT ); Mon, 10 Feb 2020 10:23:31 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 669F1B12A; Mon, 10 Feb 2020 15:23:29 +0000 (UTC) Date: Mon, 10 Feb 2020 16:23:29 +0100 Message-ID: From: Takashi Iwai To: Peter Ujfalusi Cc: , , , , , , , Subject: Re: [PATCH v2] ALSA: dmaengine_pcm: Consider DMA cache caused delay in pointer callback In-Reply-To: <20200210151402.29634-1-peter.ujfalusi@ti.com> References: <20200210151402.29634-1-peter.ujfalusi@ti.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Feb 2020 16:14:02 +0100, Peter Ujfalusi wrote: > > Some DMA engines can have big FIFOs which adds to the latency. > The DMAengine framework can report the FIFO utilization in bytes. Use this > information for the delay reporting. > > Signed-off-by: Peter Ujfalusi > --- > Hi, > > Changes since v1: > - use bytes_to_frames() for the DMA delay calculation > - Drop changes to soc-pcm > > 5.6-rc1 now have support for reporting the DMA cached data. > With this patch we can include it to the delay calculation. > The first DMA driver which reports this is the TI K3 UDMA driver. > > Regards, > Peter > > sound/core/pcm_dmaengine.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c > index 5749a8a49784..d8be7b488162 100644 > --- a/sound/core/pcm_dmaengine.c > +++ b/sound/core/pcm_dmaengine.c > @@ -247,9 +247,14 @@ snd_pcm_uframes_t snd_dmaengine_pcm_pointer(struct snd_pcm_substream *substream) > > status = dmaengine_tx_status(prtd->dma_chan, prtd->cookie, &state); > if (status == DMA_IN_PROGRESS || status == DMA_PAUSED) { > + struct snd_pcm_runtime *runtime = substream->runtime; > + > buf_size = snd_pcm_lib_buffer_bytes(substream); > if (state.residue > 0 && state.residue <= buf_size) > pos = buf_size - state.residue; > + > + runtime->delay = bytes_to_frames(runtime, > + state.in_flight_bytes); Another call of bytes_to_frames() below... > } > > return bytes_to_frames(substream->runtime, pos); ... refers to substream->runtime. Better to align both places, either runtime or substream->runtime. With that minor nitpick, the change looks good: Reviewed-by: Takashi Iwai thanks, Takashi