From: Takashi Iwai <tiwai@suse.de> To: Keyon Jie <yang.jie@linux.intel.com> Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] [PATCH] ALSA: pcm: fix buffer_bytes max constrained by preallocated bytes issue Date: Thu, 16 Jan 2020 08:15:13 +0100 Message-ID: <s5hd0bjq3cu.wl-tiwai@suse.de> (raw) In-Reply-To: <20200116045318.5498-1-yang.jie@linux.intel.com> 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 <yang.jie@linux.intel.com> > --- > 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
next prev parent reply index Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-16 4:53 Keyon Jie 2020-01-16 7:15 ` Takashi Iwai [this message] 2020-01-16 9:50 ` Keyon Jie 2020-01-16 10:27 ` Takashi Iwai 2020-01-16 11:25 ` Keyon Jie 2020-01-16 11:50 ` Takashi Iwai 2020-01-16 14:14 ` Jie, Yang 2020-01-16 15:31 ` Jie, Yang 2020-01-16 16:07 ` Takashi Iwai 2020-01-16 16:39 ` Pierre-Louis Bossart 2020-01-16 17:25 ` Rajwa, Marcin 2020-01-16 17:40 ` Pierre-Louis Bossart 2020-01-16 20:37 ` Takashi Iwai 2020-01-17 5:30 ` Keyon Jie 2020-01-17 7:57 ` Takashi Iwai 2020-01-17 10:13 ` Keyon Jie 2020-01-17 10:30 ` Takashi Iwai 2020-01-17 10:56 ` Keyon Jie 2020-01-17 11:15 ` Takashi Iwai 2020-01-17 5:37 ` Keyon Jie 2020-01-17 8:00 ` Takashi Iwai 2020-01-17 10:43 ` Keyon Jie 2020-01-17 11:12 ` Takashi Iwai 2020-01-19 3:52 ` Keyon Jie 2020-01-19 7:09 ` Takashi Iwai 2020-01-19 8:11 ` Keyon Jie 2020-01-19 9:04 ` Takashi Iwai 2020-01-19 10:14 ` Keyon Jie 2020-01-19 10:43 ` Takashi Iwai 2020-01-20 2:23 ` Keyon Jie 2020-01-16 15:45 ` Takashi Iwai
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=s5hd0bjq3cu.wl-tiwai@suse.de \ --to=tiwai@suse.de \ --cc=alsa-devel@alsa-project.org \ --cc=yang.jie@linux.intel.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
Alsa-Devel Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/alsa-devel/0 alsa-devel/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 alsa-devel alsa-devel/ https://lore.kernel.org/alsa-devel \ alsa-devel@alsa-project.org public-inbox-index alsa-devel Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.alsa-project.alsa-devel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git