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 F11CAC33CB1 for ; Thu, 16 Jan 2020 07:16:18 +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 7D4E020748 for ; Thu, 16 Jan 2020 07:16:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="eSxMvK5T" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D4E020748 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 4A8EA17A2; Thu, 16 Jan 2020 08:15:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4A8EA17A2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1579158976; bh=MnGifb+J7Y6OZWGIOHLgtMqaCxPF2QDW9IlyNlCEKzE=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=eSxMvK5TePnT2orZwoemD8/nSvUu4me1zDaKnUDMy0lP8eS20Ydq7H/stUf4R93lx DxW7yYqLHaIJG9nj053CJB4pmH2YXXVYE+BJkKbKqNIPVG//yxVqGDYCErAhctSFwV g5CjPvieWeJv5lD98IVkBZQRgyjSOlFJqDDhyhX0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 82F0AF8014D; Thu, 16 Jan 2020 08:15:25 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EEF30F8014E; Thu, 16 Jan 2020 08:15:22 +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 5C07DF800B9 for ; Thu, 16 Jan 2020 08:15:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5C07DF800B9 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 D901DADDF; Thu, 16 Jan 2020 07:15:13 +0000 (UTC) Date: Thu, 16 Jan 2020 08:15:13 +0100 Message-ID: From: Takashi Iwai To: Keyon Jie In-Reply-To: <20200116045318.5498-1-yang.jie@linux.intel.com> References: <20200116045318.5498-1-yang.jie@linux.intel.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 Subject: Re: [alsa-devel] [PATCH] ALSA: pcm: fix buffer_bytes max constrained by preallocated bytes issue 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 Thu, 16 Jan 2020 05:53:18 +0100, Keyon Jie wrote: > > With today's code, we preallocate DMA buffer for substreams at pcm_new() > stage, and the substream->buffer_bytes_max and substream->dma_max will > save as the actually preallocated buffer size and maximum size that the > dma buffer can be expanded by at hw_params() state, correspondingly. No, it's other way round: the former, buffer_bytes_max, is the max size defined by the driver (i.e. passed in snd_pcm_hardware) and the latter, dma_max, is the max preallocation size (passed to preallocation helper). > At pcm_open() stage, the maximum constraint of HW_PARAM_BUFFER_BYTES is > set to substream->buffer_bytes_max and returned to user space as the max > interval of the HW_PARAM_BUFFER_BYTES, this will lead to issue that user > can't choose any buffer-bytes larger than the preallocated buffer size, > and the buffer reallocation will never happen actually. > > Here change to use substream->dma_max as the maximum constraint of the > HW_PARAM_BUFFER_BYTES and fix the issue mentioned above. I don't think the logic in the current code you're changing is wrong. If there is any, it must be something else. This might be rather the FIXME code found in snd_pcm_hw_constraints_complete()? thanks, Takashi > Signed-off-by: Keyon Jie > --- > sound/core/pcm_native.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c > index c375c41496f8..326e921006e7 100644 > --- a/sound/core/pcm_native.c > +++ b/sound/core/pcm_native.c > @@ -2301,7 +2301,7 @@ static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params, > struct snd_interval t; > struct snd_pcm_substream *substream = rule->private; > t.min = 0; > - t.max = substream->buffer_bytes_max; > + t.max = substream->dma_max; > t.openmin = 0; > t.openmax = 0; > t.integer = 1; > -- > 2.20.1 > _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel